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

Refresh BuildFromSource docs #37362

wants to merge 3 commits into from

Conversation

captainsafia
Copy link
Member

@captainsafia captainsafia commented Oct 7, 2021

  • Clean up build from source docs
  • Add engine information to package.json files

@Pilchie Pilchie added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Oct 8, 2021

#### Java Development Kit on Windows
## Visual Studio Code on Windows, Linux, Mac
Copy link
Member

Choose a reason for hiding this comment

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

There isn't much here that's specific to VSCode... pretty much just the part where you open the folder using code? I'd argue that's not really important to call out, in which case this section can just become the terminal-oriented workflow (use the editor of your choice). The important things are the bits about using restore/activate/build.

@davidfowl
Copy link
Member

We also need a true .vsconfig file that works. InstallVS.ps1 is jank

@captainsafia captainsafia marked this pull request as ready for review October 19, 2021 03:44
> origin https://github.com/YOUR_USERNAME/aspnetcore (push)
> upstream https://github.com/dotnet/aspnetcore.git (fetch)
> upstream https://github.com/dotnet/aspnetcore.git (push)
./eng/scripts/InstallVisualStudio.ps1
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 believe the VS install will install web tools like Node by default?

Copy link
Member

Choose a reason for hiding this comment

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

If the web workload is installed than I think yes.

Copy link
Member

@Pilchie Pilchie left a comment

Choose a reason for hiding this comment

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

Looks good except for a few nits.

> origin https://github.com/YOUR_USERNAME/aspnetcore (push)
> upstream https://github.com/dotnet/aspnetcore.git (fetch)
> upstream https://github.com/dotnet/aspnetcore.git (push)
./eng/scripts/InstallVisualStudio.ps1
Copy link
Member

Choose a reason for hiding this comment

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

If the web workload is installed than I think yes.


## Step 5: Use the result of your build
![Screen Shot 2021-10-05 at 9 05 39 AM](https://user-images.githubusercontent.com/1857993/136060792-6b4c6158-0a2c-4dd6-8639-08d83da6d2d1.png)
Copy link
Member

Choose a reason for hiding this comment

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

Suggest a better alt-text for this.


| 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.

| ------------------------------------------------------------ | ------------------------------------------------------------ |
| [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. |
| [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

</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.

Co-authored-by: Kevin Pilch <kevinpi@microsoft.com>
Copy link
Member

@Tratcher Tratcher left a comment

Choose a reason for hiding this comment

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

Overall this is a cleaner approach. It needs a little more detail on the "things I need to install" section.

| 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.

| [.NET](https://dotnet.microsoft.com/) | A preview version of the .NET SDK is used for building projects within the repo. |
| [NodeJS]() | Used for building JavaScript assets in the repo. |
| [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?

@@ -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.

Copy link
Contributor

@dougbu dougbu left a comment

Choose a reason for hiding this comment

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

I have a nagging feeling we've lost useful text while things moved around. Is that valid❔

ASP.NET Core uses git submodules to include the source from a few other projects. In order to pull the sources of the these submodules when cloning the repo, be sure to pass the `--recursive` flag to the `git clone` command.

```powershell
```
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid Markdown lint warnings about leaving code blocks without a type. Use bash if you don't like powershell. This is a general problem throughout this PR.


Development is done in your own repo, not directly against the official `dotnet/aspnetcore` repo. To create your own fork, click the __Fork__ button from our GitHub repo as a signed-in user and your own fork will be created.

> :bulb: All other steps below will be against your fork of the aspnetcore repo (e.g. `YOUR_USERNAME/aspnetcore`), not the official `dotnet/aspnetcore` repo.
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure but this note seems useful

| [NodeJS]() | Used for building JavaScript assets in the repo. |
| [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. |
| [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.

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


- Update the versions on `PackageReference` items in your .csproj project file to point to the version from your local build.
The `build.cmd` and `build.sh` scripts contain multiple flags that can be used control the behavior of the build script. See [BuildScript](./BuildScript.md) for information about the flags available on the script and helpful invocation patterns.
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
The `build.cmd` and `build.sh` scripts contain multiple flags that can be used control the behavior of the build script. See [BuildScript](./BuildScript.md) for information about the flags available on the script and helpful invocation patterns.
The `eng\build.cmd` and `eng/build.sh` scripts contain multiple flags that can be used control the behavior of the build script. See [BuildScript](./BuildScript.md) for information about the flags available on the script and helpful invocation patterns.

| ------------------------------------------------------------ | ------------------------------------------------------------ |
| `.\eng\build.cmd -all -pack -arch x64` | Build development packages for all the shipping projects in 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. |

```

On macOS/Linux, you can run the shell script:
4. Once you've opened the project in VS Code, you can build and test changes by running the `./build.sh` command in the terminal.
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
4. Once you've opened the project in VS Code, you can build and test changes by running the `./build.sh` command in the terminal.
4. Once you've opened the project in VS Code, you can build and test changes by running the `./eng/build.sh` command in the terminal.

Comment on lines 100 to +101
./build.sh
./build.sh -test
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.sh
./build.sh -test
./eng/build.sh
./eng/build.sh -test

Comment on lines +46 to +48
},
"engines": {
"node": "16.x"
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❔

@@ -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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants