Welcome to MN VSTS User Group Sign in | Join | Help

Syndication

Tags

    No tags have been created or used yet.

Navigation

Save yourself some heartach

Since you do not get the latest version by default when you check a file out of TFS, it is easy to forget and make changes to a version that is out of date.  Most of the time it is just a matter of merging your changes when you check the file back into source control, but at other time it could be more difficult.

In order to avoid the situation I have changed my settings in Visual Studio to always get the latest version when opening a project or solution.  This ensures that I always get the latest code changes that other developers have made.  The setting to accomplish this is shown in the figure below.

Posted Wednesday, December 20, 2006 1:00 PM by cdpratt | 0 Comments

Signing Assemblies with a Common Key File

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


Posted Friday, October 20, 2006 4:36 PM by cdpratt | 2 Comments