views:

50

answers:

2

ILMerge usually merges my assemblies fine when building a Release, but when Publishing for ClickOnce the resulting EXE doesn't contain the DLLs that were supposed to be merged.

I think ILMerge is working, but Publish is overwriting the new merged assembly with the old original one. I made a Post-Build event that stopped the build right after ilmerge ran, and it was merged as expected.

Why is this happening, and is there a workaround?

A: 

ClickOnce performs a build before doing the publish. If you want something changed about your deployment, you'll have to assemble the files manually and edit the deployment manifest (.application file) and application manifest (yourapp.exe.manifest file) with MageUI and re-sign the files.

RobinDotNet
A: 

Apparently, after the project builds, and the post-build script runs, Publish recopies the output files from the obj directory to the bin directory (probably because it modified the manifest file). At least in Visual Studio 2010.

I fixed this by adding this to my post-build script after the ilmerge line:

ECHO Copying assembly from bin back to obj directory: COPY "$(TargetFileName)" "....\obj\$(ConfigurationName)" COPY "$(TargetFileName)" "....\obj\$(ConfigurationName)"

It copies the file back into the obj directory so Publish can do its thing with the right files.

drifter