Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The attribute "Name" in element <Target> is unrecognized

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="&quot;C:\Program Files (x86)\Windows Kits\10\bin\x64\signtool.exe&quot; sign /f &quot;$(ProjectDir)My_Cert.pfx&quot; /p mypassword &quot;$(ProjectDir)obj\$(ConfigurationName)\MyExe.exe&quot;" />
</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?

like image 805
Al Lelopath Avatar asked Jun 03 '16 16:06

Al Lelopath


1 Answers

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.

like image 143
stijn Avatar answered Sep 20 '22 00:09

stijn