Skip to content

Refresh BuildFromSource docs #37362

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

Closed
wants to merge 3 commits into from
Closed
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
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unclear how this fits in

// See https://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"ms-dotnettools.csharp",
"k--kato.docomment"
]
}
420 changes: 68 additions & 352 deletions docs/BuildFromSource.md

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions docs/BuildScript.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# A Guide to the Build Script

This ASP.NET Core repo contains a top-level build script located at `eng/build.cmd` and `eng/build.sh` and local build scripts within each directory. The scripts can be used to restore, build, and test the repo with support for a variety of flags. This page documents the common flags and some recommended invocation patterns.

It is _not_ recommended to run the top-level build script for the repo. You'll rarely need to build the entire repo and building a particular sub-project is usually sufficient for your workflow.

## Common Arguments

Common arguments that can be invoked on the `build.cmd` or `build.sh` scripts include:

| Property | Description |
| ------------------ | ------------------------------------------------------------ |
| Configuration | `Debug` or `Release`. Default = `Debug`. |
| TargetArchitecture | The CPU architecture to build for (x64, x86, arm, arm64). |
| TargetOsName | The base runtime identifier to build for (win, linux, osx, linux-musl). |

## Common Invocations

| Command | What does it do? |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| `.\eng\build.cmd -all -pack -arch x64` | Build development packages for all the shipping projects in the repo. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this list should mainly contain the commands that we think users should be using, like .\build.cmd -t and have them at the top, and maybe even place the .\eng\build.cmd ... commands in a separate table for "less common" commands. Especially since a couple sentences ago we said

It is not recommended to run the top-level build script for the repo.

| `.\eng\build.cmd -test -projects .\src\Framework\test\Microsoft.AspNetCore.App.UnitTests.csproj` | Run all the unit tests in the `Microsoft.AspNetCore.App.UnitTests` project. |
| `.\build.cmd -Configuration Release` | Build projects in a subdirectory using a `Release` configuration. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `.\build.cmd -Configuration Release` | Build projects in a subdirectory using a `Release` configuration. |
| `.\eng\build.cmd -Configuration Release` | Build projects in a subdirectory using a `Release` configuration. |

| `.\eng\build.cmd -noBuildNative -noBuildManage` | Builds the repo and skips native and managed projects, a quicker alternative to `./restore.cmd` |
| `.\eng\build.cmd -buildInstallers` | Builds Windows installers for the ASP.NET Core runtime. |

25 changes: 25 additions & 0 deletions docs/RepoDependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Repo Dependencies
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This page is not helpful from the perspective of someone trying to build the repo. Which of these do I need to install vs which are acquired automatically or come built in? What's the minimum version I need?

Visual Studio and it's many components are a required build dependencies on Windows that's not listed here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Listing the minimum required version will likely get out of date, but we could link to the place in the repo that defines it.


To support building and testing all the projects in the repo, various dependencies need to be installed. Some dependencies are required regardless of what project area you want to work in. Other dependencies are optional depending on the project

## Required Dependencies

| Dependency | Use |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| [Git source control](https://git-scm.org/) | Used for cloning, branching, and other source control-related activities in the repo. |
| [.NET](https://dotnet.microsoft.com/) | A preview version of the .NET SDK is used for building projects within the repo. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They don't actually need to install this, it will be downloaded for them.

| [NodeJS]() | Used for building JavaScript assets in the repo. |
Copy link
Member

@BrennanConroy BrennanConroy Oct 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I'm mistaken Node and Yarn are optional, used when building SignalR client or Blazor
And Yarn is installed and used automatically if you use the build script.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And Yarn is installed and used automatically if you use the build script.

I wasn't sure of this. The last time I had to build the repo from a clean set up I needed to install yarn separately. Do you have a reference to where in the scripts we install it?

Unless I'm mistaken Node and Yarn are optional, used when building SignalR client or Blazor

Correct. However, since we have users run a repo-wide restore before they activate their dotnet environment and launch the editor Node/Yarn are needed for the install phase in the restore.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Yarn.MSBuild": "1.22.10",

https://github.com/natemcmaster/Yarn.MSBuild#usage

Guess it doesn't matter much if we move away from Yarn soon

| [Yarn](https://yarnpkg.com/) | Used for installing JavaScript dependencies in the repo. |
| [curl](https://curl.haxx.se/)/[wget](https://www.gnu.org/software/wget) | Used for downloading installation files and assets from the web. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preinstalled?

| [tar](http://gnuwin32.sourceforge.net/packages/gtar.htm) | Used for unzipping installation assets. Included by default on macOS, Linux, and Windows 10 and above. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We previously mentioned gtar.htm as a fallback only. On Windows, users should stick w/ the pre-installed program or use eng/scripts/InstallTar.ps1 to place the git copy where the build will find it.


## Optional Dependencies

| Dependency | Use |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| [Selenium](https://www.selenium.dev/) | Used to run integration tests in the `Components` (aka Blazor) project. |
| [Playwright](https://playwright.dev/) | Used to run template tests defined in the `ProjectTemplates` work. |
| [Chrome](https://www.google.com/chrome/) | Required when running tests with Selenium or Playwright in the projects above. When using Playwright, the dependency is automatically installed. |
| [Java Development Kit (v11 or newer)](https://jdk.java.net/) | Required when building the Java SignalR client. Can be installed using the `./eng/scripts/InstallJdk.ps1` script on Windows. |
| [Wix](https://wixtoolset.org/releases/) | Required when working with the Windows installers in the [Windows installers project](https://github.com/dotnet/aspnetcore/tree/main/src/Installers/Windows). |

34 changes: 34 additions & 0 deletions docs/UsingBuildResults.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Using Build Results

Typically, you'll want to validate changes made in the repo by writing unit tests, integration tests, and manually verifying in the sample app. There are some scenarios where it is also helpful to validate changes in larger, more complex apps.

For these scenarios, you can build development versions of the packages shipped from the repo then consume those development versions in your test app.

To start, build the packages with your changes locally on your repo.

```
.\build.cmd -all -pack -arch x64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.\build.cmd -all -pack -arch x64
.\eng\build.cmd -all -pack -arch x64

```

The packages are built into the `aspnetcore\artifacts\packages\Debug\Shipping` directory within the repo.

Within your test app, creating a `nuget.config` file if it doesn't exist already and add the following package source to the config.

```
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="MyBuildOfAspNetCore" value="C:\src\aspnet\AspNetCore\artifacts\packages\Debug\Shipping\" />
<add key="NuGet.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
```

In the project files for your repo, update the package versions to target the development version. For example, if you want to validate changes to the `Microsoft.AspNetCore.Components.WebAssembly` package. You can make the following changes to the PackageReference.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly, I don't think it's this easy for many projects in the repo.
a) we don't produce packages for many projects
b) you often need to reference other dlls (aspnet shared fx) and probably the same runtime shared fx that was used to build the repo

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed -- with this being in a separate doc we can expand on different ways to test under each scenarios.

If you were to add another set of instructions here, what would that be?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old docs mentioned:

Run the installers produced in artifacts/installers/{Debug, Release}/ for your platform.

I've never gotten that to work, and maybe it doesn't, but if we could have something "simple" like that it would be great.

Personally I've never had a clean experience using the locally built product in an external app, I've had to do things like modify a file in the bin folder of the built app etc.

Copy link
Member

@davidfowl davidfowl Oct 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can reference the dlls directly using <Reference Include="path to assembly" />

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never gotten that to work, and maybe it doesn't, but if we could have something "simple" like that it would be great.

I've been in the same situation so that's why I removed reference to the installers in this doc. I've never had it work. cc: @dougbu in case there is an issue to resolve here.

Personally I've never had a clean experience using the locally built product in an external app, I've had to do things like modify a file in the bin folder of the built app etc.

@davidfowl uses HintPath in the reference to help with some of this.

In any case, I think sorting out these types of integrated validation scenarios is another issue worth tracking.


```diff
- <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.0" />
+ <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0-dev" />
```

3 changes: 3 additions & 0 deletions src/Components/Web.JS/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,8 @@
"resolutions": {
"**/set-value": "^3.0.2",
"url-parse": ">=1.5.0"
},
"engines": {
"node": "16.x"
Comment on lines +46 to +48
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@captainsafia how do these additions fit in w/ the doc changes❔

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@
},
"dependencies": {
"@azure/msal-browser": "^2.16.1"
},
"engines": {
"node": "16.x"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@
},
"dependencies": {
"oidc-client": "^1.11.5"
},
"engines": {
"node": "16.x"
}
}
3 changes: 3 additions & 0 deletions src/Components/test/E2ETest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
"@types/node": "^13.1.7",
"ts-node": "^8.6.2",
"typescript": "^3.7.5"
},
"engines": {
"node": "16.x"
}
}
3 changes: 3 additions & 0 deletions src/JSInterop/Microsoft.JSInterop.JS/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@
"rimraf": "^3.0.2",
"tslint": "^6.1.3",
"typescript": "^4.2.2"
},
"engines": {
"node": "16.x"
}
}
3 changes: 3 additions & 0 deletions src/ProjectTemplates/BlazorTemplates.Tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@
"license": "MIT",
"dependencies": {
"selenium-standalone": "^7.1.0"
},
"engines": {
"node": "16.x"
}
}
3 changes: 3 additions & 0 deletions src/ProjectTemplates/test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@
"license": "MIT",
"dependencies": {
"selenium-standalone": "^7.1.0"
},
"engines": {
"node": "16.x"
}
}
5 changes: 4 additions & 1 deletion src/SignalR/clients/ts/FunctionalTests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,8 @@
"url-parse": ">=1.5.0"
},
"author": "",
"license": "MIT"
"license": "MIT",
"engines": {
"node": "16.x"
}
}
5 changes: 4 additions & 1 deletion src/SignalR/clients/ts/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@
"webpack": "^5.24.1",
"webpack-cli": "^4.5.0"
},
"dependencies": {}
"dependencies": {},
"engines": {
"node": "16.x"
}
}
5 changes: 4 additions & 1 deletion src/SignalR/clients/ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@
"coverage": "node ./common/node_modules/jest/bin/jest.js --config ./jest.config.js --coverage"
},
"author": "Microsoft",
"license": "MIT"
"license": "MIT",
"engines": {
"node": "16.x"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,8 @@
"devDependencies": {},
"resolutions": {
"url-parse": ">=1.5.0"
},
"engines": {
"node": "16.x"
}
}
3 changes: 3 additions & 0 deletions src/SignalR/clients/ts/signalr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,8 @@
"fetch-cookie": "^0.11.0",
"node-fetch": "^2.6.1",
"ws": "^7.4.5"
},
"engines": {
"node": "16.x"
}
}