I can't view my localized values of my MVC application

Problem: I have changed the language of my browser but I am still only getting me default resources. Solution: Add the following line to your web.config as a child of the system.web element. <globalization enableClientBasedCulture="true" uiCulture="auto" culture="auto"/> Explanation: While working on an ASP.NET MVC application I wanted to test my localized resource files.  From the options of my browser I updated the language.  However, when I viewed the page I continued to see the default values.  Not until I added the globalization element to me web.config did my browser load the correct resources.

All my workspaces are missing!

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: After a TFS server move all my workspaces are missing. Solution: Use the TF.exe Workspace command with the /newowner option. Explanation: During a recent TFS upgrade and migration from TFS 2010 running in workgroup mode to TFS 2012 on a new server I lost all my workspaces.  From the new TFS server I could run the TF.exe workspaces command and see all the existing workspaces.  However, if I were to open Visual Studio on any of the client machines none of those workspaces would show up. When TFS is in workgroup mode user accounts are all local accounts.  On the TFS server there was for example a Donovan L Brown account.  The name would be in the format of ComputerName\UserName.  After I moved to new hardware the computer name was different.  However, all the workspaces were owned by the accounts with the old computer name.  You can confirm that by running the TF.exe workspaces command and looking at the owner column. My goal is to simply update the owner of the workspace to point at the new local Donovan L Brown account on the new computer.  tf workspace [/collection:TeamProjectCollectionUrl] [workspacename[;workspaceowner]] [/newowner:ownername] If you have pending changes in the workspaces you will have to shelve them first.  This can be a bit of a challenge as well because you are not the owner of the workspace yet.  To work around this just use the TF.exe workspace command to change the workspace to public.  After which you can shelve the changes using your new account.  Once the changes are shelved you can change the workspace owner to the new account. Finally you can unshelve your changes and return to work.

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:

ReSharper Code Cleanup does not fix “Convert to Lambda Expression” issues.

Problem: ReSharper Code Cleanup does not fix “Convert to Lambda Expression” issues. Solution: Use regular expression find and replace to correct. Explanation: I am a recent ReSharper convert so my code does not match the format suggested by ReSharper.  The Code Cleanup feature of ReSharper can really help to get your code in line. However, there does not appear to be an option to have it convert code to Lambda Expressions for you. Because I had so many lines of code to fix I decided to use the Regular Expression option of the Find and Replace dialog to fix all my lines at once.  The goal of a regular expression is to allow you to describe patterns of interest. Below is an example of a line of code that would cause ReSharper to suggest changing to a Lambda Expression. dest.DeviceGet = () => { return diverter; };   After being converted to an expression the results would appear like this: dest.DeviceGet = () => diverter; As you can see the curly braces, semicolon and return statement were removed. If you review the lines you will realize there is a pattern we can use to locate the lines that need to be corrected. We are looking for a line that contains a curly brace ‘{‘ followed by a space ‘ ‘ and the word ‘return’ and another space ‘ ‘. Now we want to copy everything up to the ‘;’. This portion of the line will remain after it is converted. Finally we want to select the ‘;’, space ‘ ‘ and closing curly brace ‘}’;  The regular expression to select this line is below: \{ return {[^;]+}; \} The regular expression begins be locating the starting curly brace \{. I must precede the curly brace with a backslash because it is a reserved character. Next is the space followed by the word ‘return’ and another space. Next we have to identify the portion of the string we need to copy. We do this by using a pair of curly braces {} to tag that portion of the string. Any pattern matched within those braces will be tagged so we can use it in the replace textbox of the Find and Replace dialog. The next portion of our regular expression needs to match all characters up to but not including the first semicolon ‘;’.  We achieve this by adding “[^;]+” to our regular expression.  The square brackets define a character class.  A character class matches any character within the brackets.  However, if the first character is a circumflex ‘^’ it changes the meaning to match any character except the ones within the brackets.  Adding the + matches one or more occurrences of the preceding regular expression.  Because we places our character class within curly braces the matched string will be tagged for later use. Finally we match the actual ‘;’, space and closing curly brace with “; \}”. The completed regular expression defines what we want to find and tags the portion we need to retain. Each pair of curly braces is given a number staring from 1. To use the first tagged portion in the Find and Replace dialog we simply type \1.  Below is a screen shot of the Find an Replace dialog ready to correct all your “Convert to Lambda Expression” warnings.  Note: you must check the “Use Regular expressions” check box.

Registering Workgroup Test Agent with Test Controller in Domain

Problem: I have a test controller in a domain and a test agent in a workgroup and I can’t register the agent with the controller. Solution: Create shadow accounts on the agent machine and on the controller machine that are in the Administrators Group.  Shadow accounts are accounts with the exact same name and password. You can test your shadow account by trying to map to a share on the controller machine from the agent machine.  Try to access \\controlerMachine\c$  when you are challenged for credentials use the shadow account.  Note you may have to disable your firewall to perform this test. Install and configure the controller on the controller machine.  In the Configure Controller dialog use your TFS account and select the project collection. Using Microsoft Test Manager (MTM) under the Lab Center tab verify that your controller is registered on the controller tab. Second log in to the test agent machine as the shadow account and install and configure the test agent with the test controller.  When asked for a user name use the shadow account again. Using MTM refresh the contoller and you should see the Test Agent listed.  This machine is now ready to be used in Lab to create a physical environment.

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.

How to mole System.dll

Problem: I get “no suitable method found to override” errors when I mole system.dll. Solution: Modify the System.moles file in your project and exclude everything except the types you are trying to mole. Explanation: I was trying to mole the SerialPort class in System.IO.Ports. After adding the mole for System.dll I began to get “no suitable method found to override” errors.  To resolve this issue I simply double clicked the System.moles file to open it in my IDE.  Then I modified the file so that moles were created only for the types under System.IO.  Change System.moles from this: <Moles xmlns="http://schemas.microsoft.com/moles/2010/">  <Assembly Name="System" /></Moles> to this: <Moles xmlns="http://schemas.microsoft.com/moles/2010/">   <Assembly Name="System" />   <StubGeneration>      <Types>         <Clear />         <Add Namespace="System.IO!" />      </Types>   </StubGeneration></Moles>

What to do when my CUIT thows a PlaybackFailureException

Updated (Oct 11, 2011) Problem: I have a textbox that has a maximum length of five characters. I want to record a Data Driven CUIT to test that you cannot type in more than five characters.  However, when I attempt to set the textbox to a six character value the CUIT throws a PlaybackFailureException. Solution: Simply set Playback.PlaybackSettings.SkipSetPropertyVerification = true; before the call that throws the PlaybackFailureException and return it to false after. Explanation: After setting a property of any UI control, the record and playback engine performs a verification step to make sure that the set succeeded and the UI control now has the value it attempted to set it to. For example if you have a text box that only allows 5 characters and you attempt to set it to 6 characters the engine will throw a PlaybackFailureException. If you are trying to test that if I actually type 123456 that the value is 12345 you will have to set Playback.PlaybackSettings.SkipSetPropertyVerification = true; before your test attempts to fill in the value.

Build workspace folder already mapped.

Problem: My Team Build keeps failing with an error that my source folder is already mapped in another workspace. The path C:\Builds\1\Demo\Reports\Sources is already mapped in workspace 7_1_WIN-GS9GMUJITS8. Solution: Use the tf.exe tool to delete the workspace holding on to that location. Explanation: tf workspace /delete [/collection:TeamProjectCollectionUrl] workspacename[;workspaceowner] [/login:username,[password]]