From cb688f13c0e36a39a2cd70c9d844959778ce11af Mon Sep 17 00:00:00 2001 From: Igor Velikorossov Date: Mon, 26 Jun 2023 18:35:27 +1000 Subject: [PATCH] start-vs.cmd will point to instructions if no sln found (#4118) Resolves #4116 --- docs/building.md | 5 ++++- start-code.cmd | 6 ++++-- start-vs.cmd | 13 ++++++++++--- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/docs/building.md b/docs/building.md index dcc6e01c5e..95d86ba356 100644 --- a/docs/building.md +++ b/docs/building.md @@ -98,12 +98,15 @@ To find out more about the script and its parameters run: `.\build.cmd -help`. #### TL;DR -Generating a new solution and opening it in Visual Studio is as easy as running: +Generating a new "filtered" solution and opening it in Visual Studio is as easy as running: ```powershell > build.cmd -vs ``` +For example, to generate a solution that contains projects with "Http" and "Fakes" in their names you can run: `.\build.cmd -vs Http,Fakes`.
+If for some reason you wish to generate a solution with all projects you can pass `*` for the keyword, e.g.: `.\build.cmd -vs *`. + If you already have a solution you'd like to open in Visual Studio then run the following command: ```powershell diff --git a/start-code.cmd b/start-code.cmd index b2f9a14604..3f584e34e7 100644 --- a/start-code.cmd +++ b/start-code.cmd @@ -7,7 +7,8 @@ FOR /f "delims=" %%a IN ('where.exe code') DO @SET vscode=%%a& GOTO break :break IF ["%vscode%"] == [""] ( - echo [ERROR] Visual Studio Code is not installed or can't be found. + echo [ERROR] Visual Studio Code is not installed or can't be found. + echo. exit /b 1 ) @@ -22,7 +23,8 @@ SET DOTNET_MULTILEVEL_LOOKUP=0 SET PATH=%DOTNET_ROOT%;%PATH% IF NOT EXIST "%DOTNET_ROOT%\dotnet.exe" ( - echo [ERROR] .NET SDK has not yet been installed. Run `%~dp0restore.cmd` to install the toolset. + echo [ERROR] .NET SDK has not yet been installed. Run %~dp0restore.cmd to install. + echo. exit /b 1 ) diff --git a/start-vs.cmd b/start-vs.cmd index 322db7f134..6d25cad8d5 100644 --- a/start-vs.cmd +++ b/start-vs.cmd @@ -13,18 +13,25 @@ set DOTNET_MULTILEVEL_LOOKUP=0 :: Put our local dotnet.exe on PATH first so Visual Studio knows which one to use set PATH=%DOTNET_ROOT%;%PATH% +set SLN=SDK.sln +if not exist "%~dp0%SLN%" ( + echo [ERROR] %~dp0%SLN% not found. + echo See %~dp0%docs\building.md for instructions on how to generate a solution file. + echo. + exit /b 1 +) + call restore.cmd if not exist "%DOTNET_ROOT%\dotnet.exe" ( - echo [ERROR] .NET Core has not yet been installed. Run `%~dp0restore.cmd` to install tools + echo [ERROR] .NET SDK has not yet been installed. Run %~dp0restore.cmd to install. + echo. exit /b 1 ) :: Prefer the VS in the developer command prompt if we're in one, followed by whatever shows up in the current search path. set "DEVENV=%DevEnvDir%devenv.exe" -set SLN=SDK.sln - if exist "%DEVENV%" ( :: Fully qualified works set "COMMAND=start "" /B "%ComSpec%" /S /C ""%DEVENV%" "%~dp0%SLN%"""