All notes


Default Path



Visual c++:

c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cl.exe

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe

And we need to add the path "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\" to PATH for mspdb100.dll. See stackOverflow: MS C asks for mspdb100.dll.

Common Macros

MSDN: Common Macros.

Macros correspond to the MSBuild properties that are set by default, or in .props or .targets files, or in your project settings. For details on how MSBuild property definitions are created and used as macros in .props, .targets, and .vcxproj files, see MSBuild Properties.

These macros are case insensitive.

$(Configuration): "Debug"
$(Platform): "Win32"

$(OutDir): Path to the output file directory. This path should have a trailing slash. Do not use $(IntDir) to define this property.
$(IntDir): Path to the directory specified for intermediate files.

$(ProjectDir): The directory of the project (defined as drive + path); includes the trailing backslash '\'.
$(ProjectPath): The absolute path name of the project (defined as drive + path + base name + file extension).
$(ProjectName): The base name of the project.
$(ProjectFileName): The file name of the project (defined as base name + file extension).
$(ProjectExt): The file extension of the project. It includes the '.' before the file extension.

Similarly to Solution and Target:



$(RootNameSpace): The namespace, if any, containing the application.

$(DevEnvDir): The installation directory of Visual Studio (defined as drive + path); includes the trailing backslash '\'.





Extension location

Most extensions are per-user extensions and are installed in the %LocalAppData%\Microsoft\VisualStudio\<Visual Studio version>\Extensions\ . A few extensions are administrative extensions, and are installed in the <Visual Studio installation folder>\Common7\IDE\Extensions\

E.g. in VS2010, it is: "c:/Users/me/AppData/Local/Microsoft/VisualStudio/10.0/Extensions/".

Installing Without Using the Extensions and Updates Dialog Box

Extensions that have been packaged in .vsix files may be available in locations other than the Visual Studio Gallery. The Extensions and Updates dialog box can't detect these files, but you can install a .vsix file by double-clicking the file.

Collapse in Solution Explorer

Use "Collapse Selection In Solution Explorer" extension, which is created by Microsoft. And it is integrated by default from VS2012. In VS2010 you have to install through extension manager.

Dark theme

Tools | Extension Manager.
Click Online Gallery.
In the Search Online Gallery box, type "visual studio color theme editor".
Download, install and restart VS.
Import Expression.vstheme.
Go to and download VS2012 dark theme for VS2010.




A program database (.pdb) file, also called a symbol file, maps the identifiers that you create in source files for classes, methods, and other code to the identifiers that are used in the compiled executables of your project. The .pdb file also maps the statements in the source code to the execution instructions in the executables. The debugger uses this information to determine two key pieces of information: the source file and line number that are displayed in the Visual Studio IDE and the location in the executable to stop at when you set a breakpoint.


MSDN: suo. The solution user options (.suo) file contains per-user solution options. This file should not be checked in to source code control.


MSDN: resx.

The .resx resource file format consists of XML entries, which specify objects and strings inside XML tags.

When viewing a .resx file, you can actually see the binary form of an embedded object (a picture for example) when this binary information is a part of the resource manifest. Usually the MIME type specifier holds the base type (Base64) of the binary information stored, if the object consists of binary data.


A test metadata file has the extension .vsmdi.


Ignore files in SCM


/testcontainer:[file name] Example: /testcontainer:BankAccountTest.dll.

You can use the /testmetadata option to run tests in multiple test containers.

The test metadata file is an XML file that is created in the solution folder. This file is shown in Solution Explorer under the Solution Items node. A test metadata file has the extension .vsmdi, and is associated with the Test List Editor window.


Install Visual Studio offline

MSDN: Creating an Offline Installation of Visual Studio.

To create an offline installation layout

  1. Choose the edition of Visual Studio that you want to install from the download page.
  2. After you download the installer to a location on your file system, run "executableName /layout". For example, run: vs_enterprise.exe /layout D:\VisualStudio2015. By using the /layout switch, you can download almost all the installation packages, not just the ones that apply to the download machine. This approach gives you the files that you need to run this installer anywhere and it might be useful if you want to install components that weren't installed originally.
  3. After you run this command, a dialog box will appear that allows you to change the folder where you want the offline installation layout to reside. Next, click the Download button.
  4. When the package download is successful, you should see a message that says Setup Successful!

MSDN. If there is any error, alternate the following two options:

vs_community.exe /layout .
vs_community.exe /layout . /overridefeeduri ""
vs_community.exe /layout . /overridefeeduri ""

Path used for locating DLLs


Windows first searches for "known DLLs", such as Kernel32.dll and User32.dll. Windows then searches for the DLLs in the following sequence:

  1. The directory where the executable module for the current process is located.
  2. The current directory.
  3. The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.
  4. The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.
  5. The directories listed in the PATH environment variable.

For setting PATH in VS, see this SO.

Copy files after build

MSDN Social: extending path during debug of c app.

copy "$(SolutionDir)"ThirdParty\* "$(ProjectDir)\bin\$(ConfigurationName)\"

Debug and Release config

SO: how to select different app config for several build configurations.

VS has implicit support to have Debug/Release version of web.config. For app.config, you may use VS plugin - SlowCheetah.

SlowCheetah: Right click on config file - Add Transform. And then you can "Preview Transform".


codeproject: transform web config when deploying.

There are many flexible options to transform Web.config files using the xdt:Transform and xdt:Locator elements.

wcfNote: xdt:locator="Match(key)" for "<add key=..." xdt:locator="Match(name)" for "<add name=..."


<configuration xmlns:xdt="">  
    <add key="Email" value="[email protected]" 
      xdt:locator="Match(key)" xdt:transform="RemoveAll">
    <add key="EMailFrom" value="[email protected]"/>    
    <add key="EMailCC" value="[email protected]"/>
    <add key="EMailBCC" value="[email protected]" 
      xdt:locator="Match(key)" xdt:transform="Insert"/>
  <connectionstrings xdt:transform="Replace">
    <add name="Release-Mode" connectionstring="data source=MOIN-PC;initial catalog=MasterCareEMR; 
      user id=sa;password=123" providername="System.Data.SqlClient"/>
    <compilation xdt:transform="RemoveAttributes(debug)"/>
    <compilation batch="false" xdt:transform="SetAttributes(batch)"/>
    <authentication mode="Windows" xdt:transform="SetAttributes(mode)"/>

Default web.config:

    <add value="[email protected]" key="Email"/>
    <add value="[email protected]" key="EMailFrom"/>
    <add value="[email protected]" key="EMailCC"/>

    <add providername="System.Data.SqlClient" 
      connectionstring="data source=MOIN-PC;initial catalog=MasterCareEMR; 
         user id=sa;password=123" name="MCEMRBPPConnectionString"/>

    <compilation targetframework="4.0" batch="true" debug="true"/>
    <authentication mode="Windows"/> 

When building with Release mode, we will get:

    <add value="[email protected]" key="EMailFrom"/>
    <add value="[email protected]" key="EMailCC"/>
    <add value="[email protected]" key="EMailBCC"/>

    <add providername="System.Data.SqlClient" connectionstring="data source=MOIN-PC;initial 
      catalog=MasterCareEMR; user id=sa;password=123" name="Release-Mode"/>

    <compilation targetframework="4.0" batch="false"/>
    <authentication mode="Forms"/>

Mixed platforms, Any CPU

SO: mixed platform vs any cpu.


When AnyCPU is selected, the resultant DLL is marked as able to run anywhere; when x86 is selected, the resultant DLL is marked as only being able to run on 32-bit systems and will not run in 64-bit applications or processes (but will run in 64-bit Windows;) and so on and so forth.

This just sets flags on the compiled DLL - it does not change other aspects of compilation process at all.

Mixed Platform

When all of the projects in a solution are of the same type (e.g. C#/VB projects) the solution configurations will match up exactly with the project configurations. Once you have projects in a solution that have mismatched configurations/platforms, Visual Studio creates the solution level configuration(s) "Mixed Platforms/Debug" and possibly "Mixed Platforms/Release". These configurations are just mappings to individual project level configurations.

For example, if you have a C# project and a C++ project, typically "Mixed Platforms/Debug" will map to "Any CPU/Debug" for the C# project and "Win32/Debug" for the C++ project.

Run multiple console when debugging

SO: start multiple projects when debugging in VS.

Right clicking on the solution node on the solution explorer and selecting Properties from the menu. Select the radio button for "Multiple startup projects" and choose the action as Start for the required projects.

VS doesn't copy references dlls

SO: msbuild doesn't copy references DLLs.

Suppose project X references assembly A, and assembly A references assembly B. Now, you create a new project Y which references project X. If project X references B implicitly (e.g. through Reflection), then assemly B is missing in the output DIR of project Y.

Solution 1

Add dummy code to X:

private void DummyFunctionToMakeSureReferencesGetCopiedProperly_DO_NOT_DELETE_THIS_CODE()
    // Assembly A is used by this file, and that assembly depends on assembly B,
    // but this project does not have any code that explicitly references assembly B. Therefore, when another project references
    // this project, this project's assembly and the assembly A get copied to the project's bin directory, but not
    // assembly B. So in order to get the required assembly B copied over, we add some dummy code here (that never
    // gets called) that references assembly B; this will flag VS/MSBuild to copy the required assembly B over as well.
    var dummyType = typeof(B.SomeClass);

Solution 2

Go to the properties of your reference and do this:

Set "Copy local = false"
Set "Copy local = true"

This is the equivalent to Have you tried turning it off and on again?, and it worked!

The project type is not supported by this installation

StackOverflow: the project type is not supported by this installation.

Usually, the problem you're having is that your project using Asp.Net MVC4 but you've only installed 2 and 3. If you install Asp.Net MVC4 it should allow you to open the project. Download MVC4 here. Note: VS2010 SP1 is required.

{fae04ec0-301f-11d3-bf4b-00c04f79efbc}: C# project
{349c5851-65df-11da-9384-00065b846f21}: Web Application
{e53f8fea-eae0-44a6-8774-ffd645390401}: ASP.Net MVC 3
{E3E379DF-F4C6-4180-9B81-6769533ABE47}: Asp.Net MVC 4

.NET 4.0 vs .NET 4.0 Client Profile

The Microsoft .NET Framework 4 Client Profile redistributable package installs the .NET Framework runtime and associated files that are required to run most client applications.

.NET Framework 的减肥一直都是 .NET 开发人员的愿望与期待,而 .NET Framework Client Profile 就是微软针对这个需要的主要响应。