by dotnetpete
30. July 2010 10:00
I found a neat way to find a table in a large LINQ to SQL (or Entity Framework) designer workspace. No more scrolling, zooming and panning. Click on the design workspace so a table etc is not selected and view the properties. Up the top of the properties window there is a drop down list of table. Select the table you're after and it's automatically selected in the design workspace.
by dotnetpete
24. September 2009 11:45
I found a post for the macro code in VS to collapse regions only (and not methods) here.
I have mapped collapse all to Ctrl-R,C and expand all to Ctrl-R,E.
I got thinking about other useful key combinations and found that in the text editor Ctrl-Q is not assigned so I did:
Ctrl-Q,A to close all documents
Ctrl-Q,W to close all but the current document.
I am forever closing all before shutting down VS (or killing the process).
by dotnetpete
16. September 2009 10:08
Sara Ford was a speaker at a very popular session at Tech.Ed last week about visual studio top tips.
There is an entry on her blog about the top 25 here.
by dotnetpete
16. September 2009 09:36
I came across a very annoying problem with VS2008 and IE8 where you can't turn off script debugging.
The workaround is documented here where you download the silverlight tools for VS2008 SP1 and turn on silverlight debugging. Because the debugger can't debug javascript and silverlight at the same time, javascript debugging is effectively turned off. Interestingly, to enable silverlight debugging I had a slight variation to the steps below.
Right click on the project -> properties, go to the web tab, and check the silverlight option under debuggers.
The original steps are:
- This work around requires the Silverlight 2 Tools for Visual Studio 2008 SP1 to be installed. So if you don't have these tools installed, you can download them from Microsoft (download here). If this is not an option for you, there is some alternative work arounds at the bottom of this blog post.
- Right click on your project and open up project properties
- Go to the 'Start Options' sheet, and click the 'Silverlight' button at the bottom of the screen. Because the debugger cannot debug both Silverlight code and Script code at the same time, this will disable Script debugging and therefore avoid the problem.
Alternatively you can turn off script debugging altogether:
- Open a new command prompt (start->run, cmd.exe). If you are on a 64-bit computer this needs to be a 32-bit prompt (start->run, c:\windows\syswow64\cmd.exe)
- reg add HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\AD7Metrics\Engine\{F200A7E7-DEA5-11D0-B854-00A0244A1DE2} /v ProgramProvider /d {4FF9DEF4-8922-4D02-9379-3FFA64D1D639} /f
And to re-enable:
- reg add HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\AD7Metrics\Engine\{F200A7E7-DEA5-11D0-B854-00A0244A1DE2} /v ProgramProvider /d {170EC3FC-4E80-40AB-A85A-55900C7C70DE} /f
Happy non-script debugging.
by dotnetpete
8. September 2009 14:15
A project I have been consulting on had an issue with treeview images sometimes not apprearing correctly and inconsistently so.
It turns out that the last of the call the EnableVisualStyles on the main entry point caused this issue.
I still have to investigate the workings of EnableVisualStyles to work why it is so.
by dotnetpete
3. September 2009 14:11
I wrote about the very handy Ctrl-K,D command on Visual Vtudio that formats code in ASPX files as well here.
Another handy "feature" in ASPX markup is that Ctrl-K,D does nothing if there is a errorin the ASPX file i.e. no matching end tag etc.
And as I found out, no matter how hard you try the key combination, it wont format is there is an error!
by dotnetpete
28. May 2009 16:49
Visual studio's shortcut keys for commenting (Ctrl-K, C) and uncommenting (Ctrl-K, U) and very handy for blocks of code or even singles lines if your cursor is not at the start of the line.
Something interesting though is that these shortcuts also work within the config files putting <-- and --> at the start and end of the line(s) as required (or removing them if you're uncommenting).
Very handy if your development config files contain multiple connection strings etc.
by dotnetpete
24. March 2009 17:17
Why on earth isn't the references node visible by default in VB.NET projects. You have to kick and scream to get the solution node displayed, ok melodramatic, Tools -> Options -> Projects And Solutions -> and then check "Always show solution", but there doesn't seem to be the same level of respect for the references node.
You can see it if you show all files (project by project mind you), but then you see the bin and obj directories as well.
I found a feedback post here, which was attached to VS2005 and to quote:
"One of our goals for VB 2005 was to reduce the clutter in the IDE and let you focus on the code you are writing."
Ah now this is a totally different situation now. If you're trying to reduce clutter and focus on the code you're writing, why don't you hide the My Project, App_*, Web References, Service References and any project folders you have as well.
And while you're at it, speed up VS and make it crash less so we can actually get on to focus on actual code instead of loads of wait time and having the VS splash screen burned into my monitor.
Although I am very grateful that I am using MS IDEs. I was working on a project last year that had a Java middle tier and on more than one occasion the middle tier guys had to debug their IDE!
by dotnetpete
19. March 2009 11:53
The Visual Studion 2008 setup project launch conditions contains two entries for .NET 3.5 - 3.5 SP1 Client and 3.5.70329. So which one is actually 3.5 SP1?
According to wiki 3.5 SP1 is actually 3.5.70329.1 and straight 3.5 is 3.5.21022.8.
So what's 3.5 SP1 Client?
Interestingly you get a build warning if either of these options is installed and Windows 3.1 is not a pre-requisite.
As a side issue I could not tick 3.5 SP1 as a pre-requisite and also use the "Download pre-requisites from the same loction as my application" option. I would get the following error at build time
The install location for prerequisites has not been set to component vendor's web site and the file 'DotNetFX35SP1\dotNetFX20\netfx20a_x86.msi' in item '.NET Framework 3.5 SP1 can not be located on disk.
You can find instructions here in section 2.3.1.1.
by dotnetpete
9. September 2008 12:12
Another goodie to come out of Tech.Ed was finding out about some new debugging enhancements in VS2008.
When you set a breakpoint and it's hit at runtime, you can right-click on the yellow line and get two new options:
- Step Into Specific - allows you to choose which method to step into. Very handy for when a method call has a method as one of it's paramaters.
- Step over properties and operators toggle - most of the time property gets and sets and simple returns and assignments.
Both of these really improve the debugging experience in my opinion.
Now if only I could create code that didn't need debugging! :)