views:

324

answers:

3

I am getting the following error when I publish my ClickOnce application with MSBuild. I have a pre-publish task which copys the correct app.config file into the project before the publish and this is the only thing that I think could be causing this error. How can I correct this?

Following failure messages were detected: File, MyApplication.exe.config, has a different computed hash than specified in manifest.

+1  A: 

You're copying the file after the hash is generated.

You need to copy the file during BUILD and before PUBLISH. The ClickOnce mechanism thinks there is tampering going on.

Brett Veenstra
+1  A: 

Brett's answer is correct, the GenerateManifests target gets run in the middle of the CoreBuild target (in Microsoft.Common.targets) so the best place to update the build file is in BeforeBuild.

I'm guessing the reason you are switching the app.config is to replace the config with one that has the right values for the environment you are publishing too? If that is the case have a read of my posting on publishing to multiple environments...will help to answer questions like 'how do I override the BeforeBuild target?'.

wallismark
A: 

Sign the click-once manifists and (re)create a Test Certificate for you application under the signing tab in the project properties... This solved the problem for me. Good Luck

Vijay Swami