Skip to content

Commit 5b07b2b

Browse files
amcaseyeerhardt
andauthored
Add some basic instructions for building the BasicMinimalApi project locally (#1799)
* Add some basic instructions for building the BasicMinimalApi project locally * Fix typo Co-authored-by: Eric Erhardt <[email protected]> * Don't consider warnings as failures Co-authored-by: Eric Erhardt <[email protected]> * Make argument instructions more explicit Co-authored-by: Eric Erhardt <[email protected]> --------- Co-authored-by: Eric Erhardt <[email protected]>
1 parent 0406878 commit 5b07b2b

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Building Locally
2+
3+
When experimenting with possible improvements, it can be useful to be able to build this project locally.
4+
5+
## Setup
6+
7+
You're going to need a fairly recent version of dotnet (for both basic functionality and accurate baselining).
8+
One way to set that up is to download a [nightly build](https://github.com/dotnet/installer#table) and extract it into a local folder.
9+
(You can also install it, since dotnet handles side-by-side installation, but this can get cluttered if you install a lot of nightlies.)
10+
To use the nightly build you've extracted, you'll want to add the folder where you extracted it to the `PATH` and also set it as the `DOTNET_ROOT`.
11+
On Windows, a batch file for setting these variables might look like
12+
13+
```
14+
@echo off
15+
set PATH=c:\dotnet;%PATH%
16+
set DOTNET_ROOT=c:\dotnet\
17+
```
18+
19+
In order to avoid interfering with your other uses of dotnet, it's probably preferable to set those variables only in the prompt where you're building this project.
20+
21+
Confirm that things are working by running `dotnet --version` - the output should match the build that you downloaded.
22+
Tools like `which` and `where` can also help confirm that you're running the version you expect.
23+
24+
## Building
25+
26+
In a prompt with `PATH` and `DOTNET_ROOT` set appropriately, run the following command
27+
```
28+
dotnet publish /p:PublishAot=true /p:StripSymbols=true /p:EnableRequestDelegateGenerator=true
29+
```
30+
The properties and their values come from the `basicminimalapipublishaot` scenario in [goldilocks.benchmarks.yml](../../../scenarios/goldilocks.benchmarks.yml).
31+
32+
The build should complete without errors.
33+
34+
## Validating
35+
36+
Run `BasicMinimalApi` from the `publish` directory - something like `bin\Release\net8.0\win-x64\publish`.
37+
You should be able to connect to the server at http://localhost:5000/todos.
38+
(It will return a JSON blob.)
39+
40+
## Experimenting
41+
42+
As you make changes to your local `aspnetcore` build, you can pull those changes into the benchmark project by adding explicit references to the [csproj file](./BasicMinimalApi.csproj).
43+
```xml
44+
<ItemGroup>
45+
<Reference Include="e:\aspnetcore\artifacts\bin\Microsoft.AspNetCore\Release\net8.0\Microsoft.AspNetCore.dll" />
46+
</ItemGroup>
47+
```

0 commit comments

Comments
 (0)