Following instructions here, I get the following error:
The attribute "Name" in element is unrecognized
In the .csproj file, I have removed the PostBuild
section and replaced it with:
<Target Name="SignOutput" AfterTargets="CoreCompile">
<Exec Command=""C:\Program Files (x86)\Windows Kits\10\bin\x64\signtool.exe" sign /f "$(ProjectDir)My_Cert.pfx" /p mypassword "$(ProjectDir)obj\$(ConfigurationName)\MyExe.exe"" />
</Target>
I'm doing this because I'm getting a “File has a different computed hash than specified in manifest" error" when trying to run a newly published SmartClient application. What is wrong?
The default PostBuildEvent inserted in a csproj is defined as a Property in a PropertyGroup, and it seems you pasted the code for the Target inside that propertyGroup. Not only does that not have the desired effect, it even gives errors loading the project file because properties do not have a Name attribute hence you've got some malformed xml. Resolution: just put the Target at the project level and it will get invoked automatically when building, after CoreCompile but before linking etc, so it's also a way of defining a 'post build event' hence the confusion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With