Here I am using the Jan 2006 P&P Enterprise Blocks as the example
The basic command line for signing from the command line are:
msbuild EnterpriseLibrary.sln
/p:SignAssembly=true
/p:AssemblyOriginatorKeyFile=%KEYFILE%
/p:Configuration=Signed
/p:DefineConstants=NOINTERNAL
/t:=rebuild
The path for %KEYFILE% generally needs to be absolute, as in the case of the EntLib as there are project files at multiple path depths. So sleezy trick for getting an absolute path for a relative one is:
@set KEYFILE=%CD%\mySNFile.snk
Additionally, we added a new build type =Signed with an output of 'bin\signed' so that signed assemblies will go elsewhere
In the EntLib they expose a number of the assemblies to test assemblies, but this requires the public key of SNK file, so to avoid it, we do not make the signed versions available to the unit tests (warning: lazy hack) using conditional compilation as in:
#if (NOINTERNAL)
#else
[assembly: InternalsVisibleTo("Microsoft.Practices.EnterpriseLibrary.Configuration.Design.Tests")]
#endif
Notice the reverse logic, when we define the symbol we do nothing to enable unit testing
Lastly, we need to force a rebuild |