Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start-vs.cmd will point to instructions if no sln found #4118

Merged
merged 1 commit into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <keywords>
```

For example, to generate a solution that contains projects with "Http" and "Fakes" in their names you can run: `.\build.cmd -vs Http,Fakes`.<br />
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
Expand Down
6 changes: 4 additions & 2 deletions start-code.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand All @@ -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
)

Expand Down
13 changes: 10 additions & 3 deletions start-vs.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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%"""
Expand Down