How to connect SQL Server Data Tools 2012 to TFS 2013

Problem: I installed SQL Server 2012 Standard Edition with SP1 with SQL Server Data Tools and I need to version my projects in TFS 2013. Solution: The IDE for SQL Server Data Tools is Visual Studio 2010 Shell. By installing Microsoft Visual Studio Team Explorer 2010, Microsoft Visual Studio 2010 Service Pack 1 and Visual Studio 2010 SP1 Team Foundation Server Compatibility GDR you will be able to connect to TFS 2013. You can read more about the compatibility between Team Foundation clients and Team Foundation Server here.  Please note that when you connect to a more recent version of TFS than that of the client, you only have access to those features supported by your client. You cannot access any features that Visual Studio 2010 does not support.

How to set the “default” configuration for a project.

Being a Process Consultant specializing in TFS I teach many companies how to use Team Build.  When you create a new build definition you have the option to set “Configurations to Build”. However, if you leave that value blank the build will build the “default” configuration. The questions I am inevitability ask are “what is the default configuration” and “how do we set the default configuration”?  Well in this post I will show you where it is stored and how to update it for typical Visual Studio 2012 project. Visual Studio projects are msbuild scripts and because of that we can set properties in the actual project files that are going to be sent to msbuild to be compiled.  To change the default configuration you we need to load the project file as xml which is the file format of msbuild.  With the project open in Visual Studio simply right click on the desired project and select “Unload Project” from the context menu.  Once the project is unloaded right click on it again and select “Edit [Project Name]” and Visual Studio will open the file as an xml file we can edit.  Search the file for a “Configuration” element in a property group (it is normally the first group).  It should look similar to this: <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>   This is the line responsible for setting the default configuration of your build.  Simply change “Debug” to the desired default configuration, save the file then right click on project file in Solution Explorer and select “Reload Project”.  After you check in your changes an queue a new build it will be built using this configuration if the “Configurations to Build” is blank in the build definition.

I can't access app.config from my web test plug in

Problem:  I want to read the connection strings from my app.config of my Web Test Project but it never loads.  Solution:  Use the Configuration Manager OpenMappedExeConfiguration call to load the app.config file.  Code:  // Map the new configuration file.ExeConfigurationFileMap configFileMap = new ExeConfigurationFileMap();configFileMap.ExeConfigFilename =   System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name + ".config"; // Get the mapped configuration filevar config = ConfigurationManager.OpenMappedExeConfiguration(   configFileMap, ConfigurationUserLevel.None); Explanation: The app.config of the test project is not loaded for web or load tests, because they are run in the same application domain as the test process (either vstesthost.exe or qtagent.exe), so they will load their config files instead. Therefore, we simply load the configuration file ourselves. Loading a configuration file is a two phased process.  First we build a ExcConfigurationFileMap object and set the name of our configuration file to be loaded. Then we open that file with a call to OpenMappedExeConfiguration method of the ConfigurationManager class. I am not a fan of hard coded values so we are going to get the name of the assembly using reflection and simply concatenate ".config" to the end of it.  Calling System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name will return the name of the assembly. After calling OpenMappedExeConfiguration you can use the returned object to access the connection strings or any other data from the app.config.

How do I convert a Web Site to a Web Application

Problem: We created our application using the Web Site project template and would like to change to a Web Application. Solution: http://msdn.microsoft.com/en-us/library/aa983476(v=vs.100).aspx Explanation: Just don't use Web Sites! Why would I want my source code (all of my IP) on a server that could be compromised? They also do not play nice with source control systrems or automated build.

I can't connect to my load test repository.

Problem: When I try to Open and Manage Results from my load test I get an error: Solution: Make sure your controller is configured with the full name to the database server instead of . or .\sqlexpress.  Change to mySqlServer or mySqlServer\sqlExpress.

My web test data source is not loading all the columns from my csv file.

Problem: I have a data driven web test that calls other web test. The called web tests are also data bound to data loaded by the parent data source.  When I run my test I was getting the following error: Request failed: Context parameter 'FluidManagement.FluidManagement_json#csv.spacer2' not found in test context Solution: Expand the Data Sources node of your web test until you can select the desired table.  From the Properties window change the Select Columns from “Only select bound columns” to “Select all columns”. Explanation: The default behavior is to only select the columns that are bound the web test that defines the data source.  This is a reasonable assumption as long as the test does not call any other data bound web test.  If the test you call rely on columns that are not bound in the caller you must change the Select Columns setting.

How do I reset my Visual Studio Settings

Problem: I selected the wrong language when I started Visual Studio for the first time. Solution: From the Tools menu select Import and Export Settings.... From the Import and Export Settings Wizard select Reset all settings.  Complete the wizard to reset your settings.

More fun with CUIT

Problem: I have a CUIT that does not run as fast as I would like. Solution: Use the Coded UI Test Editor in Feature Pack 2 to adjust the actions recorded. Explanation:

Custom Action causes install to fail

Normal 0 false false false EN-US X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} Problem: I get “Could not find file *.InstallState” when using a custom action in Windows Setup Project. Solution: Override Install, Commit, Rollback, and Uninstall methods. Explanation: You will get this method if you don’t implement Install action. In my case I only implemented the Commit method.  Once I implemented the other methods my error went away.