I have been trying to use type names instead of “var” in my C# code lately. However, ReSharper wants me to convert every type name in a declaration to “var”. The squiggles under my type names were driving me nuts, so I decided to dig into the settings to turn this off.
To disable these suggestions, do the following:
Go to the ReSharper menu and select Options.
From the resulting dialog box, select Code Inspection, Inspection Severity.
Select the C# tab and then Language Usage Opportunities.
Set both “Use var keyword when initializer explicitly declares type” and “Use “var” keyword when possible” to “Do not show”.
I recently decided to get on the PowerShell bandwagon again (after starting many times and then forgetting “everything”), so I went to Scott Hanselman’s blog about using the Visual Studio environment from the PowerShell prompt. I followed everything in his article except where I was supposed to store my profile (i.e. startup script) for PowerShell. It turns out that there are four places where you can put your profile, depending on whether it’s per-user or machine-wide. They are as follows:
This profile applies only to the current user and the Microsoft.PowerShell shell.
I found this information on the following MSDN page. I’m still learning about what the “Microsoft.PowerShell shell” is, but that’s where Scott recommended putting it.
So, here are the lines I added to the end of Scott’s VsVars32 function:
[sourcecode language=”powershell”]
# add a call to set-consoleicon as seen below…hm…!
. ‘C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Set-ConsoleIcon.ps1’
Set-ConsoleIcon ‘C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\vspowershell.ico’
[/sourcecode]
Also, for those of your writing PowerShell scripts, note that the ‘#’ character is used at the beginning of a line to indicate a comment.
Finally, if you modify your profile and want to reload it, you can just issue the following command from the PowerShell prompt:
I began following Julie Lerman’s excellent tutorials on getting started with Entity Framework (EF) version 4.1 and the Code First technique of generated databases on the MSDN web site. However, the defaults for Code First expect you to have SQL Server Express installed for the examples to work. I was able to get EF Code First to work with SQL Server (not Express) by adding the following connection string to my web.config file:
Just make sure that the name, e.g. BlogContext, matches the name of the class derived from DbContext. Note that you will also likely need to replace the “.” in “Server=.” with whatever your server name is. The “.” is just a reference to the SQL Server running on your local machine.
I am migrating from one dev machine to another and wanted to export/import my TFS connections for Visual Studio 2010. It turns out they are all stored in the following registry key:
Every time I set up Visual Studio on a new machine, one of the first things I do is add the WCF Test Client tool to the Tools menu. This tool lets you call methods on your WCF web services to test them. It can be found here:
1
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\WcfTestClient.exe"