开发者

Why does ILMerge do nothing when publishing?

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?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜