startvs.cmd 788 B

12345678910111213141516171819202122232425262728293031
  1. @ECHO OFF
  2. SETLOCAL
  3. :: This command launches a Visual Studio solution with environment variables required to use a local version of the .NET SDK.
  4. :: This tells .NET to use the same dotnet.exe that build scripts use
  5. SET DOTNET_ROOT=%~dp0.dotnet
  6. SET DOTNET_ROOT(x86)=%~dp0.dotnet\x86
  7. :: Put our local dotnet.exe on PATH first so Visual Studio knows which one to use
  8. SET PATH=%DOTNET_ROOT%;%PATH%
  9. SET sln=%~1
  10. IF "%sln%"=="" (
  11. echo Error^: Expected argument ^<SLN_FILE^>
  12. echo Usage^: startvs.cmd ^<SLN_FILE^>
  13. exit /b 1
  14. )
  15. IF NOT EXIST "%DOTNET_ROOT%\dotnet.exe" (
  16. echo .NET has not yet been installed. Run `%~dp0restore.cmd` to install tools
  17. exit /b 1
  18. )
  19. IF "%VSINSTALLDIR%" == "" (
  20. start "" "%sln%"
  21. ) else (
  22. "%VSINSTALLDIR%\Common7\IDE\devenv.com" "%sln%"
  23. )