Signing mixed code assembly
I have a mixed assambly written in C++ managed and unmanaged. To sign this assembly I use delayed signing with the following Post-build event:
sn -R $(TargetPath) $(ProjectDir)Fischer.snk
This works without any problems on my own PC (VS2010 english, Windows XP 32Bit).
If I transfer this project on another PC (VS2010 german, Win7 32Bit), this build step failes with an error message.
Fehler 1 error MSB3073: Der Befehl "sn -R C:\Daten\APRGX\DotNet\VisualData\Master3DControlClasses\Project\Debug\Fischer.APRGX.MathAlg.Native.dll c:\Daten\APRGX\DotNet\MathAlg\Native\Fischer.snk :VCEnd" wurde mit dem Code 1 beendet. C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets 113 6 Fischer.APRGX.MathAlg.Native
What can be the reason?
Edit: Starting the tool in command prompt it says:
"C:\D开发者_运维知识库aten\APRGX\DotNet\VisualData\Master3DControlClasses\Project\Debug\Fischer.APRGX.MathAlg.Native.dll" stellt keine Assembly mit einem starken Namen dar.
It says that the dll doesn't have a strong name. I don't understand that, because the same project builds without problems on my first machine.
I found the solution: The problem was that on my original PC I'm using VS2010 and on the second PC I'm using VS2010 SP1.
VS2010 without SP1 stores in project file:
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>
</AdditionalDependencies>
<KeyFile>$(ProjectDir)Fischer.snk</KeyFile>
<DelaySign>true</DelaySign>
</Link>
VS2010 with SP1 stores:
<LinkKeyFile>$(ProjectDir)Fischer.snk</LinkKeyFile>
<LinkDelaySign>true</LinkDelaySign>
So VS2010 with SP1 igonores the /DELAYSIGN option that was set without SP1. And so sn.exe couldn't sign the assembly.
Installing SP1 on my original PC and setting the delay sign option again solved the problem.
精彩评论