Skip to content

Commit

Permalink
Fix VS errors about repotasks when repotasks have not been built, and…
Browse files Browse the repository at this point in the history
… update documentation to indicate that VS users should invoke restore.cmd first (dotnet#6295)
  • Loading branch information
natemcmaster authored Jan 2, 2019
1 parent f182b1a commit 97d3a34
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<IsSampleProject Condition="$(RepoRelativeProjectDir.Contains('sample'))">true</IsSampleProject>
</PropertyGroup>

<Import Project="build\tasks\RepoTasks.tasks" Condition="'$(MSBuildProjectName)' != 'RepoTasks'" />
<Import Project="build\tasks\RepoTasks.tasks" Condition="'$(MSBuildProjectName)' != 'RepoTasks' AND '$(DesignTimeBuild)' != 'true'" />

<Import Project="eng\Dependencies.props" />
<Import Project="eng\PatchConfig.props" />
Expand Down
7 changes: 4 additions & 3 deletions docs/BuildFromSource.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,14 @@ Before opening our .sln files in Visual Studio or VS Code, you need to perform t

1. Executing the following on command-line:
```
.\build.cmd
.\restore.cmd
```
This will download required tools and build the entire repository once. At that point, you should be able to open .sln files to work on the projects you care about.

2. Use the `startvs.cmd` script to open Visual Studio .sln files. This script first sets required environment variables.
> :bulb: Pro tip: you will also want to run this command after pulling large sets of changes. On the master branch, we regularly update the versions of .NET Core SDK required to build the repo.
> You will need to restart Visual Studio every time we update the .NET Core SDK.
> :bulb: Pro tip: you will also want to run this command after pulling large sets of changes. Visual Studio will only build projects in a solution file, and makes a best effort to use other files on disk. If you pull many changes, the files on disk may be stale and will need to re-build.
2. Use the `startvs.cmd` script to open Visual Studio .sln files. This script first sets required environment variables.

### Solution files

Expand Down
10 changes: 5 additions & 5 deletions startvs.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ SET PATH=%DOTNET_ROOT%;%PATH%

SET sln=%1

IF NOT EXIST "%DOTNET_ROOT%\dotnet.exe" (
echo .NET Core has not yet been installed. Run `build.cmd -restore` to install tools
exit /b 1
)

IF "%sln%"=="" (
echo Error^: Expected argument ^<SLN_FILE^>
echo Usage^: startvs.cmd ^<SLN_FILE^>

exit /b 1
)

IF NOT EXIST "%DOTNET_ROOT%\dotnet.exe" (
echo .NET Core has not yet been installed. Run `%~dp0restore.cmd` to install tools
exit /b 1
)

start %sln%

0 comments on commit 97d3a34

Please sign in to comment.