views:

320

answers:

1

Right now I am setting the Linker/Advanced/KeyFile option.

I am getting the "mt.exe : general warning 810100b3: is a strong-name signed assembly and embedding a manifest invalidates the signature. You will need to re-sign this file to make it a valid assembly.".

Reading from the web, it sounds like I have to set the delay signing option, download the SDK, and run sn.exe as a post build event. Surely there must be an easier way to do this common operation in VS2010?

+4  A: 

There's a fair amount of lameness here, this just never worked before. It got "fixed" in VS2010, mt.exe now generates a warning instead of letting this silently go wrong. Not a real fix, and there's not an obvious one, the linker can't just embed the signature and still allow mt.exe to run afterwards.

The solution is to re-sign the assembly with a post-build event. Make it look like this:

Command = sn -Ra "$(TargetPath)" $(ProjectName).snk

If you don't already have the key file, you'll need to create the .snk file yourself, run sn.exe from the Visual Studio Command prompt. for example:

cd \whereTheProjectIsLocated
sn.exe -k MyProject.snk

Or extract it from a container or use your designated key file. Delay signing is just a matter of running sn.exe with the proper command line options.

Hans Passant
Not what I wanted to hear.Needs quotes around $(TargetPath).Suggestions:Add: specify KeyFile and DelaySign to make mt.exe shut up.Add: -q option to make sn.exe shut up.
jyoung
It appears to me that this worked fine in Visual Studio 2008 - the manifest is embedded with no warning and the resulting assembly is still properly signed (sn -v reports no errors). Do you know any more details about why this changed in VS 2010?
Charlie
Vote to fix it on MSDN Connect: https://connect.microsoft.com/VisualStudio/feedback/details/464524/mt-error-810100b
brickner