Unable to delete swc files in Flash Builder after building using an ANT script - flash-builder

I'm trying to incorporate an ant build script to be used in the FlashBuilder IDE, but I am running into an issue when trying to delete a swc file that is created when running the 'clean' target.
I get the error that "Problem Occurred"
'Deleting files...' has encountered a problem. Problems encountered while deleting resources.
Problems encountered while deleting resources.
Could not delete 'C:\project_src\trunk\flash\labs\bin\commonUtilities.swc'.
Problems encountered while deleting files.
Could not delete: C:\project_src\trunk\flash\labs\bin\commonUtilities.swc.
This error occurs even when I try to delete by right clicking from the Package Explorer in Flash Builder. When I try to delete it from Windows Explorer I get an error stating that FlashBuilder.exe is using the file. This makes me suspect that somehow Flash Builder has locked this file. In order for the clean to work I need to close FlashBuilder and then reopen it.
One interesting note, is that once I reopen Flash Builder and if I do a clean/build repeatly just ONLY the swc project it works without fail, BUT once I try to do a full build with the main project, linking does the 'lock' happen.
This problem does not occur if I am using the default "Flex" in the Builders under the Properties for the project. It only occurs when I import and use my own build file.
I'm extremely new to ant and using the flex compiler. I'm using the to compile my swc file. Does the some how cause FlashBuilder to hold on to the swc file produced?
Buildfile: C:\project_src\trunk\flash\master-build.xml
clean-labs:
[delete] Deleting C:\project_src\trunk\flash\labs\bin\commonUtilities.swc
BUILD FAILED
C:\project_src\trunk\flash\master-build.xml:37: Unable to delete file C:\project_src\trunk\flash\labs\bin\commonUtilities.swc
Total time: 614 milliseconds
I'm using the following:
[echo] ANT_HOME: C:/apache-ant-1.8.4
[echo] flexTasks jar location: C:/apache-ant-1.8.4/lib/flexTasks.jar
[echo] FLEX_HOME: C:/Program Files (x86)/Adobe/Adobe Flash Builder 4.5/sdks/4.5.0
[echo] BRANCH_BASE: C:/justice_src/trunk/
[echo] DEBUG: false
Here's the target for clean-labs:
<target name="clean-labs">
<delete verbose="true" failOnError="true">
<fileset dir="${BRANCH_BASE}/flash/labs/bin/" includes="labs.swc" />
</delete>
</target>
The build target for the swc for the compc part is as follows:
<compc output="${BRANCH_BASE}/flash/labs/bin/commonUtilities.swc"
debug="${DEBUG}"
locale="en_US"
incremental="true" >
The build target for the main project is using and includes
<compiler.library-path dir="${BRANCH_BASE}/flash/labs/bin/" append="true">
<include name="commonUtilities.swc" />
</compiler.library-path>
Does anyone have any idea what is going on? Any thoughts on solutions and workarounds are greatly appreciated.

Related

Executing post-build step Intellij IDEA CE 2020.3?

I am using IntelliJ IDEA CE 2020.3 to build a simple JAR file. After the build, I'd like to copy the created JAR to a library directory.
I am using the Ant plugin that comes bundled with the IDE. I can't seem to find the underlying Ant build/control files that make the whole thing work. I assume Ant uses the .XML files that are part of the IDE's project settings, but this is unclear.
In any case, is there a way to add the "copy" step that I mention above?
Do I have to either use the built-in Ant or take it over completely myself?
Can I edit the default that ships with the IDE?
All,
So after some experimenting, I found that if I manually create the build.xml file, I can execute post-build steps. For my example here, I created the following, simple build.xml and added it to the top-level IntelliJ project directory (where the .iml file lives):
build.xml (manually created)
<project name="mylib" default="copy-file">
<target name="copy-file">
<copy file="out/artifacts/mylib_JAR/mylib.jar" tofile = "./mylib.jar" />
</target>
</project>
Note that the directories are relative to the project directory.
IntelliJ IDEA enabled me to add the copy-file task to augment the default, built-in build. To configure your tasks via the IDE, open the Ant tool window via the View/Tool Windows/Ant main menu item.
I hope this helps someone out there!

How to avoid msbuild not to rebuild if it has assembly file is already build from another machine

I have created MSBuild script for build automation, earlier we were doing build manually on each server.
In my build script, it has the following target
Download Source Code
Build Solution
Now in the normal workflow at the very first time, it does download source code and builds all assembly files into bin/debug folder, during this process it does change assembly version number as well which is correct because since it does not have any previous timestamp information.
Till this step everything works fine, now what I am looking is that after download source code from SVN, I will stop my build process and copy my all assembly files from the server and paste into my source code folder under bin/debug and resume my MSBuild script execution for the second target. i.e. Build Solution
Since both source code and assembly files are same no code change, how can I handle such scenario in MSBuild that not to rebuild assembly files?
I have searched on google that how MSBuild check if all assembly files are up to date? and implement following way to handle it and it works as expected. Is there any better way to handle this scenario?
<Target Name="BuildSolution" Inputs="#(CsFiles)" Outputs="#(AssemblyFile)">
<MSBuild Projects="#(SolutionFile)" />

WiX Heat: Pre-build event fires too early on build server

I'm harvesting a directory for my Visual Studio solution.
It works on my local system so far probably because the project build order is being respected.
When I run the installer on a build server it finds the right directory but it has not been created at the time of building the setup file. It throws a HEAT5052 error saying The directory 'a:\b\c' could not be found.
Is there any way to "wait" until or to execute the heat command after all project references are built?
OK so I've spent hours to figure out how to fire Heat AFTER all references are resloved. I only found solutions for the <PreBuildEvent> and <PostBuildEvent> using the Heat command line and the BeforeBuild and AfterBuild targets.
So I found all kind of targets inside the wix2010.targets file located in my
Program files (x86)\MSBuild\Microsoft\Wix\ folder. It contains a target called AfterResolveReferences and it does exactly that. So here's my code I ended up with (in case someone is interested):
<Target Name="AfterResolveReferences">
<HeatDirectory
ToolPath="$(WixToolPath)"
OutputFile="Product.Binaries.wxs"
SuppressFragments="$(HarvestDirectorySuppressFragments)"
Transforms="Filter.xslt"
Directory="$(HarvestFolder)"
DirectoryRefId="MY_FOLDER"
ComponentGroupName="Binaries"
GenerateGuidsNow="true"
SuppressRootDirectory="true"
SuppressRegistry="true"
PreprocessorVariable="var.App.TargetDir">
</HeatDirectory>
</Target>
I had the same problem and it was solved by combining the accepted answer and this answer to ensure that my post build event, which was copying files, always runs:
<RunPostBuildEvent>Always</RunPostBuildEvent>
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
Also, my build server was using the MSBuild command line, and I used this answer to locate my local MSBuild.exe so I could test my changes locally without having to push to the build server.

Team Foundation Server 2010 - build configuration not set for project

(I´ve updated the title, to reflect my new findings)
I've just ported a bunch of projects from TFS2008 to TFS2010 and have run into a (actually several :)) problem with a specific project. When compiling with build configuration 'Debug', everything works as expected. However when compiling with build configuration 'Release' I get a linker error, due to al.exe cannot find the specified file in 'obj\debug'.
Error:
Task "AL" (TaskId:781)
...
ALINK : error AL1047: Error importing file 'c:\Builds\23\...\obj\Debug\someproject.exe' -- The system cannot find the file specified. [C:\Builds\23\...\Release\Sources\...\someproject.csproj]
The command exited with code 1. (TaskId:781)
Done executing task "AL" -- FAILED. (TaskId:781)
I've enabled the team build info diagnostic logging and found the following variable:
IntermediateOutputPath = obj\Debug\
My question is why would the linker look in the Debug folder, when I'm building under the release configuration. I've inspected the solution and project configuration and there are no 'Debug' configurations under the release solution configuration. Any ideas why this is happening and how to resolve it?
Thanks in advance.
!! Bonus info
I have the following statement in the project file that is failing, assuring if the build configuration is unspecified, it will be set to Debug.
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
I've tried to change it to Release as default and now my debug team build fails, pointing at obj\release instead. So it seems that the build configuration is unspecified, when the project is compiled. How can this be?
Found the problem. I have to set the build configuration explicitly for my publish target defined in the someproject.csproj project file. I've inserted the line 'Configuration=Release'
<MSBuild ToolsVersion="3.5" Projects="$(SolutionRoot)\...someproject.csproj"
Properties="RunCodeAnalysis=false;
Configuration=Release;
ClrVersion=2.0.50727.0;
ApplicationVersion=$(VersionNumber);
UpdateUrl=$(DevtestUpdateUrl);
InstallUrl=$(DevtestInstallUrl);
IsWebBootstrapper=true;
PublishDir=$(DropLocation)\$(BuildNumber)\Publish\Update\;
SolutionDir=$(SolutionRoot)\Kl******\;
DeploymentConfiguration=devtest;
SignManifests=true;
ManifestCertificateThumbprint=23...23;"
Targets="PublishOnly" />

Unable to build solution incrementally: Input file ".NETFramework,Version=v3.5" does not exist

I'm not able to build solution incrementally. I checked diagnostic log and I found that every project containing workflows are always rebuild because of this:
Input file ".NETFramework,Version=v3.5" does not exist.
Workflows are always recompiled, new temporary files are created and project is build again.
Building target "WorkflowCompilation" completely.
Input file ".NETFramework,Version=v3.5" does not exist.
Using "CompileWorkflowTask" task from assembly "System.Workflow.ComponentModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
Task "CompileWorkflowTask"
No files found with '.xoml' extension in the set of input files.
Generated temporary code file: C:\Users\Ludwo\AppData\Local\Temp\uwdnm5th.cs
Workflow markup validations completed with 0 errors and 0 warnings.
Done executing task "CompileWorkflowTask".
Done building target "WorkflowCompilation" in project "Delta.Workflow.Common.Merged.csproj".
Target "CoreCompile" in file "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.targets" from project "h:\Prj\R4x\M\CountrySystems\Delta\Common\Delta.Workflow.Common\Delta.Workflow.Common.Merged.csproj" (target "Compile" depends on it):
Building target "CoreCompile" completely.
Input file "C:\Users\Ludwo\AppData\Local\Temp\uwdnm5th.cs" is newer than output file "obj\Debug\Delta.Workflow.Common.pdb".
I'm building my projects using MSBuild 4.0. My projects are set to build with v3.5 TargetFrameworkVersion, unit tests projects are build with TargetFrameworkVersion set to v4.0. I tried to build it on different PC but the result is still the same. I also played with references in my projects. It seems to be like v4.0/v3.5 conflict, but I don't know how to fix it. Any ideas?
I found it. The root cause is wrong version of Workflow.targets file imported inside my workflow (.csproj) projects. Workflow.targets for .NET v4.0 was imported instead of v3.5. It should be related to projects upgrade from VS2008 to VS2010 I did some time ago.
I changed Workflow.targets Import from
<Import Project="$(MSBuildToolsPath)\Workflow.targets"/>
to
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.5\Workflow.targets" />
Hope it helps someone...