Skip to content

Commit d6796bd

Browse files
authored
Make it more clear that installation script use is optional (#18277)
Also address Markdown warnings in BuildFromSource.md - surround bare URLs with angle brackets - add languages to code blocks - fix missing blank lines and style inconsistencies
1 parent df712cc commit d6796bd

File tree

1 file changed

+52
-31
lines changed

1 file changed

+52
-31
lines changed

docs/BuildFromSource.md

Lines changed: 52 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
Build ASP.NET Core from Source
2-
==============================
1+
# Build ASP.NET Core from Source
32

43
Building ASP.NET Core from source allows you to tweak and customize ASP.NET Core, and to contribute your improvements back to the project.
54

6-
See https://github.com/dotnet/aspnetcore/labels/area-infrastructure for known issues and to track ongoing work.
5+
See <https://github.com/dotnet/aspnetcore/labels/area-infrastructure> for known issues and to track ongoing work.
76

87
## Install pre-requisites
98

@@ -14,20 +13,27 @@ Building ASP.NET Core on Windows requires:
1413
* Windows 10, version 1803 or newer
1514
* At least 10 GB of disk space and a good internet connection (our build scripts download a lot of tools and dependencies)
1615
* Visual Studio 2019. <https://visualstudio.com>
17-
* To install the exact required components, run [eng/scripts/InstallVisualStudio.ps1](/eng/scripts/InstallVisualStudio.ps1).
18-
```ps1
19-
PS> ./eng/scripts/InstallVisualStudio.ps1
20-
```
16+
* To install the exact required components, run [eng/scripts/InstallVisualStudio.ps1](/eng/scripts/InstallVisualStudio.ps1).
17+
18+
```ps1
19+
PS> ./eng/scripts/InstallVisualStudio.ps1
20+
```
21+
22+
However, any Visual Studio 2019 instance that meets the requirements should be fine. See [global.json](/global.json)
23+
and [eng/scripts/vs.json](/eng/scripts/vs.json) for those requirements.
2124
* Git. <https://git-scm.org>
2225
* NodeJS. LTS version of 10.14.2 or newer <https://nodejs.org>
2326
* Java Development Kit 11 or newer. Either:
24-
* OpenJDK <https://jdk.java.net/>
25-
* Oracle's JDK <https://www.oracle.com/technetwork/java/javase/downloads/index.html>
26-
* To install a version of the JDK that will only be used by this repo, run [eng/scripts/InstallJdk.ps1](/eng/scripts/InstallJdk.ps1)
27-
```ps1
28-
PS> ./eng/scripts/InstallJdk.ps1
29-
```
30-
* Chrome - Selenium-based tests require a version of Chrome to be installed. Download and install it from [https://www.google.com/chrome]
27+
* OpenJDK <https://jdk.java.net/>
28+
* Oracle's JDK <https://www.oracle.com/technetwork/java/javase/downloads/index.html>
29+
* To install a version of the JDK that will only be used by this repo, run [eng/scripts/InstallJdk.ps1](/eng/scripts/InstallJdk.ps1)
30+
31+
```ps1
32+
PS> ./eng/scripts/InstallJdk.ps1
33+
```
34+
35+
However, the build should find any JDK 11 or newer installation on the machine.
36+
* Chrome - Selenium-based tests require a version of Chrome to be installed. Download and install it from <https://www.google.com/chrome>
3137
3238
### macOS/Linux
3339
@@ -39,20 +45,22 @@ Building ASP.NET Core on macOS or Linux requires:
3945
* Git <https://git-scm.org>
4046
* NodeJS. LTS version of 10.14.2 or newer <https://nodejs.org>
4147
* Java Development Kit 11 or newer. Either:
42-
* OpenJDK <https://jdk.java.net/>
43-
* Oracle's JDK <https://www.oracle.com/technetwork/java/javase/downloads/index.html>
48+
* OpenJDK <https://jdk.java.net/>
49+
* Oracle's JDK <https://www.oracle.com/technetwork/java/javase/downloads/index.html>
4450
4551
## Clone the source code
4652
4753
ASP.NET Core uses git submodules to include the source from a few other projects.
4854
4955
For a new copy of the project, run:
50-
```
56+
57+
```ps1
5158
git clone --recursive https://github.com/dotnet/aspnetcore
5259
```
5360

5461
To update an existing copy, run:
55-
```
62+
63+
```ps1
5664
git submodule update --init --recursive
5765
```
5866

@@ -61,9 +69,11 @@ git submodule update --init --recursive
6169
Before opening our .sln files in Visual Studio or VS Code, you need to perform the following actions.
6270

6371
1. Executing the following on command-line:
64-
```
72+
73+
```ps1
6574
.\restore.cmd
6675
```
76+
6777
This will download the 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.
6878

6979
> :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.
@@ -74,7 +84,7 @@ Before opening our .sln files in Visual Studio or VS Code, you need to perform t
7484
### Solution files
7585

7686
We don't have a single .sln file for all of ASP.NET Core because Visual Studio doesn't currently handle projects of this scale.
77-
Instead, we have many .sln files which include a sub-set of projects. These principles guide how we create and manage .slns:
87+
Instead, we have many .sln files which include a sub-set of projects. These principles guide how we create and manage .sln files:
7888

7989
1. Solution files are not used by CI or command line build scripts. They are meant for use by developers only.
8090
2. Solution files group together projects which are frequently edited at the same time.
@@ -90,10 +100,12 @@ Opening solution files and building may produce an error code CS0006 with a mess
90100
91101
The cause of this problem is that the solution you are using does not include the project that produces this .dll. This most often occurs after we have added new projects to the repo, but failed to update our .sln files to include the new project. In some cases, it is sometimes the intended behavior of the .sln which has been crafted to only include a subset of projects.
92102

93-
**You can fix this in one of two ways**
103+
#### You can fix this in one of two ways
104+
94105
1. Build the project on command line. In most cases, running `build.cmd` on command line solves this problem.
95106
2. Update the solution to include the missing project. You can either do this one by one using `dotnet sln`
96-
```
107+
108+
```ps1
97109
dotnet sln add C:\src\AspNetCore\src\Hosting\Abstractions\src\Microsoft.AspNetCore.Hosting.Abstractions.csproj
98110
```
99111

@@ -112,6 +124,7 @@ Using Visual Studio Code with this repo requires setting environment variables o
112124
Use these command to launch VS Code with the right settings.
113125

114126
On Windows (requires PowerShell):
127+
115128
```ps1
116129
# The extra dot at the beginning is required to 'dot source' this file into the right scope.
117130
@@ -120,7 +133,8 @@ code .
120133
```
121134

122135
On macOS/Linux:
123-
```
136+
137+
```bash
124138
source activate.sh
125139
code .
126140
```
@@ -130,12 +144,14 @@ code .
130144
You can also build the entire project on command line with the `build.cmd`/`.sh` scripts.
131145

132146
On Windows:
133-
```
147+
148+
```ps1
134149
.\build.cmd
135150
```
136151

137152
On macOS/Linux:
138-
```
153+
154+
```bash
139155
./build.sh
140156
```
141157

@@ -155,6 +171,7 @@ On Windows (requires PowerShell):
155171
```
156172

157173
On macOS/Linux:
174+
158175
```bash
159176
source ./activate.sh
160177
```
@@ -164,12 +181,14 @@ source ./activate.sh
164181
Tests are not run by default. Use the `-test` option to run tests in addition to building.
165182

166183
On Windows:
167-
```
184+
185+
```ps1
168186
.\build.cmd -test
169187
```
170188

171189
On macOS/Linux:
172-
```
190+
191+
```bash
173192
./build.sh --test
174193
```
175194

@@ -182,7 +201,8 @@ Furthermore, you can use flags on `build.cmd`/`.sh` to build subsets based on la
182201
## Build properties
183202

184203
Additional properties can be added as an argument in the form `/property:$name=$value`, or `/p:$name=$value` for short. For example:
185-
```
204+
205+
```ps1
186206
.\build.cmd /p:Configuration=Release
187207
```
188208

@@ -199,8 +219,8 @@ TargetOsName | The base runtime identifier to build for (win, linux,
199219
After building ASP.NET Core from source, you will need to install and use your local version of ASP.NET Core.
200220
See ["Artifacts"](./Artifacts.md) for more explanation of the different folders produced by a build.
201221

202-
- Run the installers produced in `artifacts/installers/{Debug, Release}/` for your platform.
203-
- Add a NuGet.Config to your project directory with the following content:
222+
* Run the installers produced in `artifacts/installers/{Debug, Release}/` for your platform.
223+
* Add a NuGet.Config to your project directory with the following content:
204224

205225
```xml
206226
<?xml version="1.0" encoding="utf-8"?>
@@ -215,7 +235,8 @@ See ["Artifacts"](./Artifacts.md) for more explanation of the different folders
215235

216236
*NOTE: This NuGet.Config should be with your application unless you want nightly packages to potentially start being restored for other apps on the machine.*
217237

218-
- Update the versions on `PackageReference` items in your .csproj project file to point to the version from your local build.
238+
* Update the versions on `PackageReference` items in your .csproj project file to point to the version from your local build.
239+
219240
```xml
220241
<ItemGroup>
221242
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="3.0.0-dev" />

0 commit comments

Comments
 (0)