Microsoft recommends that all assemblies be assigned a strong name by signing them with a key file. It is further recommended that only the build process be allowed to sign assemblies for distribution with a private key.
In order to meet these requirements with a minimum of inconvenience to developers you can allow developers to fully sign assemblies with a developer’s key and reserve the signing with the production key for the build box. An easy way to accomplish this is to create an environment variable on the developer’s machines that points to the developer’s key and change the value of this environment variable on the build box to point to the production key file.
The following steps are intended to help step you through the process of setting up an environment variable that points to the DeveloperKey.snk file and to then alter the project file to use this variable. Setting up the environment variable will only need to be done once on your machine and altering the project file will only need to be done when you first create a new project.
- Step One, Open System Properties Dialog.
The figure below shows the advanced tab of the System Properties Dialog. You can access this dialog by selecting the system icon from the control panel

- Step 2, Open Environment Variables Dialog
Click the Environment Variables button to open the dialog as shown in the figure below.

- Step 3 Create a new variable
Click new under the user variable section of the dialog to open the New User Variable dialog shown below. Enter the values shown below, KEY_FILE for the variable name and D:\IT\Object\Lib\DeveloperKey.snk for the variable value.

This completes the process of creating an environment variable. This is a one time event. As long as the DeveloperKey.snk file appears on your machine everything should compile and be strongly named with your key.
The only other task to discuss on this topic is the alteration to a project file that must be done to take advantage of this environment variable. This task only needs to be done once for each project as the project is created.
- Check the project file out of source control for editing.
- Open the file in an editing tool. You can use Visual Studio as long as you do not already have the project open.
- Change the SignAssembly tag to true as shown in the figure below.
- Change or Add an AssemblyOriginatorKeyFile tag to specify the environment variable $(KEY_FILE).
- Check the project file back into source control.
The altered file is shown in the figure below
