问题
When I use a strong name key file
as indicated in the project properties, it requires that all referenced assemblies to also use such a similar signature.
But what I want is to sign using the WinDDK Signtool.exe
. This I already do manually, but I also want to debug sign assemblies, and the best way of doing that is including the signature in the build, probably as a AfterBuild
step.
The problem is I don't know how to create a AfterBuild
step
回答1:
You are mixing things up here. A strong name is not the same thing as the certificate that's added to a binary with signtool.exe. There is also no requirement that dependent assemblies have a certificate or that it needs to match. Nor does it make sense to sign a debug build, only your customer is interested in it. You already know that you can trust yourself.
Running sn.exe to give an assembly a strong name is already supported by msbuild.
回答2:
I had to add the following lines to the *.csproj
file:
<Target Name="AfterBuild">
<Exec Command="sign.bat" />
</Target>
And then I added a sign.bat
file to the project root folder
I found this solution at some blog
来源:https://stackoverflow.com/questions/4386726/how-to-sign-the-output-executable-during-the-build-process-in-visual-studio