static void

Visual Studio


Example command line build:

"%PROGRAMFILES(X86)%\MSBuild\14.0\Bin\MSBuild.exe" ..\MyProject.csproj /p:Configuration=Release /p:OutputPath=..\MyPackage\lib\net20

For VS2017/MSBuild v15, msbuild could be in multiple locations, so from VS2017 update 2, you can use "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere" (or get the vswhere binary)

Below is from the example

@echo off
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere" -latest -products * -requires Microsoft.Component.MSBuild -property installationPath`) do (
set InstallDir=%%i

if exist "%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" (
"%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" build.xml /t:PublishAll /fl & pause
) else (
echo "Must install VS2017 update 2 or greater"

Visual Studio Keys

When resharper isn't available... (you should at least use CodeRush Xpress!)

F12 Goto Definition
Ctl I Incremental search. Ctl I Ctl I uses the last search pattern.
Ctl - (minus) Go back
Ctl-K Ctl-D Reformat
Ctl arrow Left/right moves by word
Ctl ] (on a brace) Move to matching (or next) brace
Control-Dot Resolve usings (also on right-click). if there are no Resharper hints!

MRU tabs hack from here: under HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0 key, create a DWORD UseMRUDocOrdering = 1

FXCop Code Analysis errors

Code Analysis dies (and even breaks the build) when binding redirects are not honoured.

Change C:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Static Analysis Tools\FxCop\FxCopCmd.exe.config (as applicable for VS version)

In appSettings, change AssemblyReferenceResolveMode from StrongName to StrongNameIgnoringVersion

<add key="AssemblyReferenceResolveMode" value="StrongNameIgnoringVersion" />

IIS Express

You may need to alter the IIS overrides (error "This configuration section cannot be used at this path. This happens when the section is locked at a parent level.", in full IIS this is "Feature Delegation"). The IIS config is located...


Stop VS2012's SHOUTING menus:
REG_DWORD value: 1

NHibernate Mappings

In C:\Program Files\NHibernate\src extract the zip then goto C:\Program Files\NHibernate\src\src\NHibernate
Copy nhibernate-mapping.xsd and nhibernate-configuration.xsd
to C:\Program Files\Microsoft Visual Studio 8\Xml\Schemas (Vs2005)
or C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas (Vs2008)

Linked (shared) source

Easiest is to hack the proj file (File/@Link ). In VS= Add Existing Item/Open+Link File.

Configuration/ binding