How to add additional files to adobe air installer? - apache-flex

I've created an AIR application, but it uses an external SWF for extra functionality. I want that SWF to be included in the install, but currently it's not. Is there anyway I can get FlexBuilder or any other tool to include this extra file in the installer? I've tried manually adding the file (as a .air file is just a zip file in disguise), but there must be hash checks inside the file.

If you place the SWF file in your application's src directory it will give you the option to include in the installer (previously I tried putting it in the application's root folder).

If you are working in Flash, go to File>Adobe AIR 2.0 Settings. At the bottom of the dialgoue box is a list of included files. Add your SWF to that list.

What if you wanted to add a text file instead to the installer using Flex Builder? I tried to add it using the export release build wizard, but I don't see the text file generated in the application directory...any ideas?

I would add a custom builder, under project -> properties -> builders
I use something like the following for one of my projects that I want to package some mxml and as files with so that the compiler doesn't try to compile them on export. Save the xml below as something like copy_files.xml and add a new Ant Builder to your project. Under the targets tab of the builder I have mine set to run the copy-files target on every clean.
<?xml version="1.0" encoding="UTF-8"?>
<project name="SampleProject">
<target name="copy-files" description="Copy Source Files">
<copy todir="bin-debug/sources">
<fileset dir="sources" >
<include name="**/*.*" />
</fileset>
</copy>
<copy todir="bin-release/sources">
<fileset dir="sources" >
<include name="**/*.*" />
</fileset>
</copy>
</target>
</project>

Related

How to discover .js, .css files, what are in the filesystem (and repo) but not in .csproj?

Context
I regularly make the mistake to forget include a vendor .css or .js to the Asp Mvc project. I just copy/download with a tool, or from a theme, and referencing them. All works locally because the files are in the virtual directory so IIS Express will server them.
When publish times come, and I publish the new version, those files which are not in the .csproj will not be deployed.
Question
Although some tools or itself the IDE creates warning in some cases if in a syntax construct I refer to a resource what is not in the .csproj, this is not all working (for example: when using BundleConfig)
It seems to be pretty simple prevent this source of errors: Just check the file system with a well picked filter and list all files what are not included in the .csproj. (the filter could be: (*.css, .js, ...) or (assets/.*)
How can I accomplish this task?
If you switch to the new .csproj format supported by Visual Studio 2017, you no longer need to add references to files in the file system, they are picked up by default and you have to exclude files that you don't want.
Migration to the new .csproj format is pretty straightforward - you can use the dotnet migrate tool to make the conversion.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net47</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\MyProj\MyProj.csproj" />
</ItemGroup>
<ItemGroup>
<!-- /* Exclude files you don't want */ -->
<Compile Remove="Text\AnyTransliterator.cs" />
<Compile Remove="Text\BreakTransliterator.cs" />
</ItemGroup>
</Project>
If you have files outside of your project directory that you want to include, you can create a link to a file or directory.
<!-- /* Link to an individual file outside of the project */ -->
<Content Include="..\..\..\Assets\something.css" Link="Assets\something.css" />
<!-- /* Create a virtual directory in Visual Studio named Assets
and link to external Assets directory. All files in that
directory will be included in the project */ -->
<Content Include="..\..\..\Assets\**\*" LinkBase="Assets" />
<!-- /* Create a virtual directory in Visual Studio named Assets
and link to external Assets directory. Only .css files in that
directory will be included in the project */ -->
<Content Include="..\..\..\Assets\**\*.css" LinkBase="Assets" />
This works with .NET Framework, but do note that you need to install the .NET Core SDK 2.0.0 in addition to VS 2017 15.3 (and ensure no global.json selects a lower SDK version) for the LinkBase option to work.
Reference: New .csproj format - How to specify entire directory as "linked file" to a subdirectory?

FDT Templates: set output folder as absolute path

When i set the output folder in FDT, this is always REALTIVE to the project folder, even if it has a forward slash...
ex: /Users/paolo/deploy will create the folder in /User/paolo/my_project/Users/paolo/deploy
first.... WHY?????
second: is there a way to set this folder as ABSOLUTE?
many thanx
The reason is to enable multiple developers to develop on the same project. The path is saved in the project. If you share the project via CVS/SVN other developers would need to have the same path. Absolute paths are a bad idea when developing in a team.
I don't know if there is a way to force an absolute path, but I doubt it.
Edit:
I remember there was the possibility to attach an ant script to an run configuration to be executed each time the project is build. You might be able to write the ant script such that it copies the output files to an absolute directory.
In your launch configuration there is a tab for Ant tasks. Add a post-compile ant script, here's an example:
<project name="copy files">
<property name="from" value="../bin"/>
<property name="to" value="/Users/username/deploy>
<target name="Copy All">
<copy todir="${to}" >
<fileset dir="${from}">
<exclude name="Test.swf"/>
</fileset>
</copy>
</target>
</project>

Ant MXMLC task with arbitrary list of source/lib paths?

Does anyone know of a way to use the mxmlc Flex Ant task with a user-defined list of source or library paths?
The user should be able to define an arbitrary list of source and/or library (.swc) paths in an Ant properties file and the build file can use these values in the mxmlc task.
Are there any tricks (maybe use filtering/string replacing) to get this working?
Don't know if this helps, but you can include an external XML in your Ant build file:
<?xml version="1.0" ?>
<project name="test" default="test" basedir=".">
<target name="setup">
...
</target>
<import file="./common.xml" />
</project>
I ran across your question, looking for a way to define the library (and source path) definitions in external files. Looping through a list of defined properties seems somewhat problematic to me, since you would possibly have to define a list of library paths as well as sub-lists of files in each defined path in the list.
Seems that including external files defining the library and various source paths might be a better and just as extensible way to go.
They way I do it is list my source paths, library paths etc. in an external mxmlc configuration file (e.g. flex-config.xml), my more-or-less universal build.xml file just does
<mxmlc file="${app.mainClass}" output="${swf}">
<load-config filename="${air.sdk.config}" />
<load-config filename="${app.config}" />
</mxmlc>
Where air.sdk.config points to the SDK's default config xml and app.config is the app's custom config xml.
I don't know if it is possible to do it from a properties file.
You can use this in your Ant script:
<source-path>
<source-path path-element="my/src/dir" />
</source-path>
<library-path dir="my/libs/dir" append="true">
<include name="*.swc" />
</library-path>
Or maybe develop some Ant module to simulate this from your properties file.
I can't understand why you want to make your properties file dynamic, it is the role of your build.xml normally, but hey :)

how to use this flex compiler option copy non embeded files to destination folder

i am using mxmlc for building the flex projects using ant.how to use flex builder-> copy non embeded files to destination folder compiler option in ANT
I'm not sure if this will help you out but when you check that option using flex builder it updates the .actionScriptProperties file:
<compiler additionalCompilerArguments="-locale en_US" copyDependentFiles="true">
<compilerSourcePath/>
</compiler>
setting the copyDependentFiles to true or false turns this on and off
You can all just copy the directory over but this doesn't remove the embedded files.
<copy todir="${SRC_DIR}/assets">
<fileset dir="${DEPLOY_DIR}">
</fileset>
</copy>

Using nant to automate a publish of my flex site?

I am using Flex and I am tired of having to manually place files in the right folders whenever I want to do a publish. I'd like to do a publish when the build suceeds.
Is there a quick way, using Nant (not my current build tool of choice), to automate this? I have a virtual directory on my PC which is my hosting directory.
Thanks
NAnt has a copy task that will let you do this. Just specify the files and folders you want to copy and the target folder.
If you also build your Flex app with NAnt, you could automatically do the build and the file/folder copy.
An example:
<copy todir="${build.dir}">
<fileset basedir="bin">
<include name="*.dll" />
</fileset>
</copy>
http://nant.sourceforge.net/release/latest/help/tasks/copy.html

Resources