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

Create instructions on how to test private bits #5818

Merged
merged 9 commits into from
Oct 26, 2020
24 changes: 24 additions & 0 deletions documentation/Deploy-MSBuild.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Deploying Just-Built MSBuild

## Visual Studio

[Deploy-MSBuild](https://github.com/dotnet/msbuild/blob/deploy-msbuild/scripts/Deploy-MSBuild.ps1) is a way to conveniently take private bits and install them into Visual Studio (VS) for testing. To use it:

- If you haven't already, clone [MSBuild](https://github.com/dotnet/msbuild) and make the changes you want.
- Build MSBuild with the changes you want using `build.cmd /p:CreateBootstrap=true`.
rainersigwald marked this conversation as resolved.
Show resolved Hide resolved
- In an administrator powershell window, navigate to the msbuild folder.
- Run `scripts\Deploy-MSBuild.ps1 -destination {destination} -configuration {configuration}`.
- Specify the Bin folder of MSBuild in your VS install as the destination. This is somewhere like `"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"`.
- Make sure the `{configuration}` you pass to the deploy script matches the one you gave to `build.cmd` (this is `Debug` by default).

The Deploy-MSBuild script creates backups of the relevant MSBuild binaries, then copies the new binaries in their place.

⚠ CAUTION: If you overwrite the MSBuild in Visual Studio you can break Visual Studio. That in turn can prevent you from building MSBuild to fix your bug! The deploy script makes backups by default which you may need to manually copy back over.
rainersigwald marked this conversation as resolved.
Show resolved Hide resolved

### Crossing machines

If you cannot build or cannot deploy MSBuild on the same machine on which you wish to use the updated version of VS, build and deploy to an empty folder instead. Then, manually make a backup of the files in that folder and overwrite them in the VS install of choice.

## .NET (Core) SDK

Deploy-MSBuild can also patch a .NET (Core) SDK installation. Pass the `-runtime Core` argument to `Deploy-MSBuild.ps1` to ensure that it selects .NET Core MSBuild.
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ To build projects using the MSBuild binaries from the repository, you first need

Now, just point `dotnet ./artifacts/bin/bootstrap/netcoreapp2.1/MSBuild/MSBuild.dll` at a project file.

Alternatively, if you want to test the msbuild binaries in a more realistic environment, you can overwrite the dotnet CLI msbuild binaries (found under a path like `~/dotnet/sdk/3.0.100-alpha1-009428/`) with the msbuild binaries from the above bootstrap directory. You might have to kill existing `dotnet` processes before doing this. Then, (using the previous dotnet example directory) just point `~/dotnet/dotnet build` at a project file.
Alternatively, if you want to test the msbuild binaries in a more realistic environment, you can overwrite the dotnet CLI msbuild binaries (found under a path like `~/dotnet/sdk/3.0.100-alpha1-009428/`) with the just-built MSBuild . You might have to kill existing `dotnet` processes before doing this. You can use [`Deploy-MSBuild.ps1 -runtime Core`](../Deploy-MSBuild.md#.NET-(Core)-SDK) to do the copy. Then, (using the previous dotnet example directory) just point `~/dotnet/dotnet build` at a project file.
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ dependencies (Roslyn compilers, NuGet, etc.) from packages or from your local ma
from Visual Studio). To produce a bootstrap build, run `.\build.cmd /p:CreateBootstrap=true` from the root of your enlistment.

Now, just point `artifacts\bin\bootstrap\net472\MSBuild\Current\Bin\MSBuild.exe` at a project file.

### Patching Visual Studio

Sometimes it's useful to patch your copy of Visual Studio. You can use the [Deploy-MSBuild script](../Deploy-MSBuild.md) for that.