Guenter from Frankfurt/Germany
http://odetocode.com/Blogs/scott/archive/2005/10/06/2326.aspx
--
Scott
http://www.OdeToCode.com/blogs/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 ?
Guenter
--
Scott
http://www.OdeToCode.com/blogs/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\ILMerge.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
>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.
>
That's another area that I could not tidy up to the point I would like
it. I've been hesitant to spend anymore time with it at this date
because I know the ASP.NET team is releasing a merge and deplyoment
tool around RTM, so I want to wait and see what that tool looks like.
>
>Feel free to use it, maybe even to update your blog entry (I would feel
>proud about that :-)
>
Sure thing :) I'm going to add a reference to this post in the
comments for people to find.