Hi Scott,
after playing around with MSBuild for awhile, I have modified your build
configuration and have achieved the following:
* the build process can cope with blanks (at least inside the "temp" path)
* the build process only rebuilds the target if files are changed
* a "clean" cleans the temp directory
There's just one or thing missing (maybe you've got an ieas for that):
I explicitly have to reference the DLL file inside the webb app; just
erferencing the project does not do. There must be some information inside
the project file that tells VisualStudio which files are to be copied as part
of the build processs, but I can't figure out where that information lives.
For your records, this is how my build file looks now:
<PropertyGroup>
<ILMergeEXE>"$(ProgramFiles)\Microsoft\ILMerge\ILM erge.exe"</ILMergeEXE>
<TempDirectory>$(Temp)\MSBuildTemp</TempDirectory>
</PropertyGroup>
<Target Name="PrecompiledAssemblies" Inputs="@(Compile)"
Outputs="$(TempDirectory)\PrecompiledApp.config">
<AspNetCompiler Debug="false" PhysicalPath="$(MSBuildProjectDirectory)"
TargetPath="$(TempDirectory)" Updateable="false" Force="true"
VirtualPath="$(MSBuildProjectName)" />
</Target>
<Target Name="SingleDll" DependsOnTargets="PrecompiledAssemblies"
Outputs="$(OutputPath)\$(MSBuildProjectName).dll"
Inputs="$(TempDirectory)\PrecompiledApp.config">
<CreateItem Include="$(TempDirectory)\bin\*.dll">
<Output ItemName="PrecompiledAssemblies" TaskParameter="Include" />
</CreateItem>
<Exec Command="$(ILMergeEXE)
/out:$(OutputPath)\$(MSBuildProjectName).dll /targetplatform:v2
%22@(PrecompiledAssemblies, '%22 %22')%22" />
</Target>
<Target Name="AfterClean">
<RemoveDir Directories="$(TempDirectory)" />
</Target>
(I hobe this survives the post...)
Feel free to use it, maybe even to update your blog entry (I would feel
proud about that :-)
Guenter
"Scott Allen" wrote:
Hmm - my temp directory and project directory avoid spaces in the
names. I'd have to experiement with MSBuild a little more.
--
Scott
http://www.OdeToCode.com/blogs/scott/
On Thu, 20 Oct 2005 01:47:04 -0700, "Guenter"
<gtschech(at)hotmail(dot)com> wrote:
Hi Scott,
the article read great, but I coudn't manage to get it to work yet.
(I am running on RC1, BUild 50727)
Problems are many:
* first, I had to recognize that ILMerge is not an intrinsic part of the
.net framework (ok, one who can identify and follow links in your post
clearly has an advantage :-)
* then, the TempDirectory variable is not declared by default, I had to
insert a <PropertyGroup>
* and now the persisting problem: my Temp Directory contains spaces, and I
can't get MSBuild to surround the dll names with quotes (seems that the
<CreateItem does not offer this feature)
Is there a way around that ?