26.04.2015 Views

Team Development with Visual Studio Team Foundation Server

Team Development with Visual Studio Team Foundation Server

Team Development with Visual Studio Team Foundation Server

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

System.Configuration.ConfigurationManager class. In the WinForm application,<br />

you must add a reference to System.Configuration.dll explicitly.<br />

using System.Configuration;<br />

private string GetDBaseConnectionString()<br />

{<br />

return ConfigurationManager.ConnectionStrings["DBConnStr"].ConnectionString;<br />

}<br />

4. Ensure that the User.config file is deployed along <strong>with</strong> the application code. To do so<br />

in Solution Explorer right click the User.config file, click the Properties and then in<br />

the Properties pane, set the Copy To Output Directory property to Copy if newer.<br />

Do not add the User.config file to source control. In this way, each developer and the<br />

test team can explicitly specify the connection string through their own User.config<br />

file. Source control may contain other User.config files, for example for testing and<br />

for production. These files should be managed by the users responsible for managing<br />

the testing and production environments. These test and production User.config files<br />

should not be stored as part of the database projects but should be in different areas of<br />

the source control system.<br />

In source control you should have a User.config file for each of the environments that<br />

you use, such as production and test. These configuration files should specify the<br />

connection string for the database. The User.config file must be present for the<br />

configuration system to work.<br />

Tip: By default, the user configuration file is automatically added to source control when<br />

you add the solution. To prevent this, when you first check in the files, clear the<br />

User.config file check box. You can then right-click on the file in Solution Explorer and<br />

select Under Pending Changes to ensure that the file never comes under source control.<br />

It is important to understand that if you are using this mechanism, the User.config file<br />

must be present. Somebody needs to be responsible for ensuring the environment is<br />

correct when creating builds for production releases and for any test environments. As<br />

part of this build setup, the appropriate User.confg file will need to be retrieved from the<br />

source control system and copied into the correct location for MSBuild to be able to find<br />

it.<br />

Summary<br />

When managing projects or third-party assemblies, you can use either branching or<br />

workspace mapping. Branching is the preferred approach because it stores the<br />

dependency relationship on the source control server. Using branches enables you to<br />

make a conscious decision to pick up updated binaries or source.<br />

Workspace mapping is a client-side-only approach, which means each team member<br />

needs to create the mapping on their own computer as well as on the build server in order

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!