The scenario is: I'm building my solution with TeamCity, I'm not running the build account as an administrator; so I get problems with the strong name keys.
I know of a few solutions out there, like running the build as an administrator and registering the certificates in the proper container.
Is there anyway to sign the assemblies within a solution file only during a release build and not during a debug build. Or are there any similar solutions?
I think it is strange that there isn't a MSBuild parameter that can be set wether the assemblies should be signed or not. Because if you look at the csproj-files there is an option there for signed or not signed
You can use preprocessor directives:
Then define the
SIGNsymbol in the Release configuration.You must install the key into a key container using
sn.exe. Alternatively, you can use[AssemblykeyFile]to specify a path.The
#pragmasuppresses this warning.