Showing posts with label Visual Studio 2010. Show all posts
Showing posts with label Visual Studio 2010. Show all posts

Tuesday, January 18, 2011

Do not use regions

"A violation of this rule occurs whenever a region is placed anywhere within the code. In many editors, including Visual Studio, the region will appear collapsed by default, hiding the code within the region. It is generally a bad practice to hide code, as this can lead to bad decisions as the code is maintained over time." - one of readability rules of style cope.

If you have regions in your code, you can solve this problem in Visual Studio 2010 by expanding all regions by default.

Got to 'Tools->Option->Text Editor->C#->Advanced' and 'Enter outlining mode when files open' must be unchecked.

Tuesday, December 28, 2010

Group files in visual studio file explorer

Open the *.csproj file in a text editor. Find the following element:

<Compile Include="MVP\IMyView.cs" />
<Compile Include="MVP\IMyViewPresenter.cs" />
<Compile Include="MVP\MyOperation.cs" />

and edit it as follows:

<Compile Include="MVP\IMyView.cs" />
<Compile Include="MVP\IMyViewPresenter.cs">
   <DependentUpon>IMyView.cs</DependentUpon>
</Compile>
<Compile Include="MVP\MyOperation.cs" >
   <DependentUpon>IMyView.cs</DependentUpon>
</Compile>

The result is:

Tuesday, December 21, 2010

Guidelines in Visual Studio 2010

To enable guidelines in Visual Studio 2010 you must complete a few steps:

  • Install an Editor Guidelines tool. You can download it from here.
  • Run regedit.exe and select the key in register editor:      HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Text Edit
  • Add string (REG_SZ) value called Guides and change its data to RGB(139,0,0) 120