Visual Studio
MsBuild
- v4: "%systemroot%\Microsoft.Net\Framework\v4.0.30319\MSBuild.exe"
- VS2015/C#6: "%PROGRAMFILES(X86)%\MSBuild\14.0\Bin\MsBuild.exe"
- VS2017/C#7: "%PROGRAMFILES(X86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MsBuild.exe" (check VS edition eg
Enterprise, BuildTools, Community) or
(if applicable) "install-package Microsoft.NET.Sdk" or "dotnet msbuild"
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
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...
- VS2013: C:\Users\Name\Documents\IISExpress\config\applicationhost.config
- VS2015: $(solutionDir)\.vs\config\applicationhost.config
VS2012
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\General\SuppressUppercaseConversion
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
- configuration/startup/supportedRuntime to limit .Net versions (in .Net 1.0 requiredRuntime)
- assemblyBinding/dependentAssembly/assemblyIdentity and bindingRedirect if same publicKey and different version numbers (oldversion can be * wildcard)
- (Development machine.config only) runtime/developmentMode/@developerInstallation="true" tells .Net to use a "DEVPATH" environmental variable to specific paths.
Assemblies
- Move a class to another dll but allow dependencies to still see it: TypeForwardTo
Exceptions
- Exception.Data is an untyped IDictionary to pass, um, data. Don't try to put it in the Message string.