Update README.md (#18569)

Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
Co-authored-by: Přemek Vysoký <premek.vysoky@microsoft.com>
This commit is contained in:
Viktor Hofer 2024-02-08 17:42:26 +01:00 committed by GitHub
parent b368584e4a
commit 5003feccb9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 56 additions and 22 deletions

View file

@ -11,12 +11,19 @@
This Codespace can help you debug the source build of .NET. This build takes about
45 minutes and, after completion, produces an archived .NET SDK located in
`/workspaces/dotnet/artifacts/x64/Release`. In case you selected the `prebuilt-sdk`
Codespace, the SDK will already be there.
Codespace, the built-from-source SDK will already be there.
## Build the SDK
To build the VMR, run following:
To build the repository, run one of the following:
```bash
# Microsoft based build
./build.sh
```
or
```bash
# Building from source only
./prep.sh && ./build.sh -sb
```

View file

@ -71,51 +71,72 @@ For the latest information about Source-Build support, please watch for announce
### Prerequisites
The dependencies for building .NET from source can be found [here](https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/linux-requirements.md).
The dependencies for building can be found [here](https://github.com/dotnet/runtime/blob/main/docs/workflow/requirements/).
In case you don't want to / cannot prepare your environment per the requirements, consider [using Docker](#building-using-docker).
### Building (source-build configuration)
### Building
1. **Clone the VMR**
1. **Clone the repository**
```bash
git clone https://github.com/dotnet/dotnet dotnet-dotnet
cd dotnet-dotnet
```
2. **Prep the source to build on your distro**
This downloads a .NET SDK and a number of .NET packages needed to build .NET from source.
2. **Build the .NET SDK**
```bash
cd dotnet-dotnet
./prep.sh
```
Choose one of the following build modes:
- **Microsoft based build**
3. **Build the .NET SDK**
For Unix:
```bash
./build.sh --clean-while-building
```
```bash
./build.sh -sb --clean-while-building
```
For Windows:
```cmd
.\build.cmd -cleanWhileBuilding
```
This builds the entire .NET SDK from source.
The resulting SDK is placed at `artifacts/x64/Release/dotnet-sdk-9.0.100-your-RID.tar.gz`.
- **Building from source**
```bash
# Prep the source to build on your distro.
# This downloads a .NET SDK and a number of .NET packages needed to build .NET from source.
./prep.sh
Run `./build.sh --help` to see more information about supported build options.
# Build the .NET SDK
./build.sh -sb --clean-while-building
```
The resulting SDK is placed at `artifacts/[your-arch]/Release/dotnet-sdk-9.0.100-[your-RID].tar.gz` (for Unix) or `artifacts/[your-arch]/Release/dotnet-sdk-9.0.100-[your-RID].zip` (for Windows).
4. *(Optional)* **Unpack and install the .NET SDK**
For Unix:
```bash
mkdir -p $HOME/dotnet
tar zxf artifacts/[your-arch]/Release/dotnet-sdk-9.0.100-[your-RID].tar.gz -C $HOME/dotnet
ln -s $HOME/dotnet/dotnet /usr/bin/dotnet
```
For Windows:
```cmd
mkdir %userprofile%\dotnet
tar -xf artifacts/<arch>/Release/dotnet-sdk-9.0.100-[your RID].zip -C %userprofile%\dotnet
set "PATH=%userprofile%\dotnet;%PATH%"
```
To test your source-built SDK, run the following:
To test your built SDK, run the following:
```bash
dotnet --info
```
### Building using Docker (source-build configuration)
> [!NOTE]
> Run `./build.sh --help` (for Unix) or `.\build.cmd -help` (for Windows) to see more information about supported build options.
### Building using Docker
You can also build the repository using a Docker image which has the required prerequisites inside.
The example below creates a Docker volume named `vmr` and clones and builds the VMR there.
@ -123,7 +144,13 @@ The example below creates a Docker volume named `vmr` and clones and builds the
```sh
docker run --rm -it -v vmr:/vmr -w /vmr mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8
git clone https://github.com/dotnet/dotnet .
# - Microsoft based build
./build.sh --clean-while-building
# - Building from source
./prep.sh && ./build.sh -sb --clean-while-building
mkdir -p $HOME/.dotnet
tar -zxf artifacts/x64/Release/dotnet-sdk-9.0.100-centos.8-x64.tar.gz -C $HOME/.dotnet
ln -s $HOME/.dotnet/dotnet /usr/bin/dotnet
@ -146,7 +173,7 @@ Alternatively, you can also provide a manifest file where this information can b
Sometimes you want to make a change in a repository and test that change in the VMR. You could of course make the change in the VMR directly (locally, as the VMR is read-only for now) but in case it's already available in your repository, you can synchronize it into the VMR (again locally).
To do this, you can either start a [dotnet/dotnet](https://github.com/dotnet/dotnet) Codespace - you will see instructions right after it starts. Alternatively, you can clone the repository locally and use the [eng/vmr-sync.sh](../../eng/vmr-sync.sh) script to pull your changes in. Please refer to the documentation in the script for more details.
To do this, you can either start a [dotnet/dotnet](https://github.com/dotnet/dotnet) Codespace - you will see instructions right after it starts. Alternatively, you can clone the repository locally and use the [eng/vmr-sync.sh](../../eng/vmr-sync.sh) or [eng/vmr-sync.ps1](../../eng/vmr-sync.ps1) script to pull your changes in. Please refer to the documentation in the script for more details.
## List of components