This document provides the steps necessary to consume a nightly build of .NET runtime and SDK. Example below is for 7.0 but similar steps should work for other versions as well.
If you are only looking to get fixes for an individual NuGet package, and don't need a preview version of the entire runtime, you can add the nightly build package feed to your NuGet.config
file. The easiest way to do this is by using the dotnet CLI:
(Recommended) Create a local NuGet.Config file for your solution, if don't already have one. Using a local NuGet.Config file will enable the nightly feed as a package source for projects in the current directory only.
dotnet new nugetconfig
Next, add the package source to NuGet.Config with the dotnet nuget add source command:
dotnet nuget add source -n dotnet7 https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet7/nuget/v3/index.json
Then, you will be able to add the latest prerelease version of the desired package to your project.
Example: To add version 7.0.100-preview.5.22226.4 of the System.Data.OleDb package, use the dotnet add package command:
dotnet add package System.Data.OleDb -v 7.0.100-preview.5.22226.4
To use nightly builds of the entire runtime, follow the steps given in the rest of this document instead.
-
Acquire the latest nightly .NET SDK by downloading and extracting a zip/tarball or using an installer from the installers and binaries table in dotnet/installer (for example, https://aka.ms/dotnet/7.0/daily/dotnet-sdk-win-x64.zip).
-
By default, the dotnet CLI will use the globally installed SDK if it matches the major/minor version you request and has a higher revision. To force it to use a locally installed SDK, you must set an environment variable
DOTNET_MULTILEVEL_LOOKUP=0
in your shell. You can usedotnet --info
to verify what version of the Shared Framework it is using. -
Reminder: if you are using a local copy of the dotnet CLI, take care that when you type
dotnet
you do not inadvertently pick up a different copy that you may have in your path. On Windows, for example, if you use a Command Prompt, a global copy may be in the path, so use the fully qualified path to your localdotnet
(e.g.C:\dotnet\dotnet.exe
). If you receive an error "error NETSDK1045: The current .NET SDK does not support targeting .NET 7.0." then you may be executing an olderdotnet
.
After setting up dotnet you can verify you are using the dogfooding version by executing dotnet --info
. Here is an example output at the time of writing:
>dotnet --info
.NET SDK:
Version: 7.0.100-preview.5.22226.4
Commit: fc127ac5a4
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22616
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\7.0.100-preview.5.22226.4\
global.json file:
Not found
Host:
Version: 7.0.0-preview.5.22224.3
Architecture: x64
Commit: 47d9c43ab1
.NET SDKs installed:
7.0.100-preview.5.22226.4 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.NETCore.App 7.0.0-preview.5.22224.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Download .NET:
https://aka.ms/dotnet-download
Learn about .NET Runtimes and SDKs:
https://aka.ms/dotnet/runtimes-sdk-info
- Our nightly builds are uploaded to dotnet-blob feeds, not NuGet - so ensure the .NET Core blob feed is in your nuget configuration in case you need other packages from .NET Core that aren't included in the download. For example, on Windows you could edit
%userprofile%\appdata\roaming\nuget\nuget.config
or on Linux edit~/.nuget/NuGet/NuGet.Config
to add these lines:
<packageSources>
<add key="dotnet6" value="https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet6/nuget/v3/index.json" />
<add key="gRPC repository" value="https://grpc.jfrog.io/grpc/api/nuget/v3/grpc-nuget-dev" />
...
</packageSources>
(Documentation for configuring feeds is here.)
-
Create a new project
- Create a new folder for your app and change to that folder
- Create project file by running
dotnet new console
-
Restore packages so that you're ready to play:
$ dotnet restore
$ dotnet run
Rinse and repeat!
When using the above instructions, your application will run against the same .NET runtime that comes with the SDK. That works fine to get up and running quickly. However, there are times when you need to use a nightly build of Microsoft.NETCore.App which hasn't made its way into the SDK yet. To enable this, there are two options you can take.
This is the default case for applications - running against an installed .NET runtime.
- You still need to install the prerequisite .NET SDK from above.
- Optionally, install the specific .NET runtime you require globally or download get the latest one available from the nightly build table
- Modify your .csproj to reference the nightly build of Microsoft.NETCore.App
<PropertyGroup>
<OutputType>Exe</OutputType>
<!-- Ensure that the target framework is correct e.g. 'net7.0' -->
<TargetFramework>net7.0</TargetFramework>
<!-- modify version in this line with one reported by `dotnet --info` under ".NET runtimes installed" -> Microsoft.NETCore.App -->
<RuntimeFrameworkVersion>7.0.0-preview.5.22224.3</RuntimeFrameworkVersion>
</PropertyGroup>
$ dotnet restore
$ dotnet run
In this case, the .NET runtime will be published along with your application.
- You still need to install the prerequisite .NET SDK from above.
- Modify your .csproj to reference the nightly build of Microsoft.NETCore.App and make it self-contained by adding a RuntimeIdentifier (RID).
<PropertyGroup>
<OutputType>Exe</OutputType>
<!-- Ensure that the target framework is correct e.g. 'net7.0' -->
<TargetFramework>net7.0</TargetFramework>
<!-- modify build in this line with version reported by `dotnet --info` as above under ".NET runtimes installed" -> Microsoft.NETCore.App -->
<!-- moreover, this can be any valid Microsoft.NETCore.App package version from https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json -->
<RuntimeFrameworkVersion>7.0.0-preview.5.22224.3</RuntimeFrameworkVersion>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <!-- RID to make it self-contained -->
</PropertyGroup>
$ dotnet restore
$ dotnet publish
$ bin\Debug\net7.0\win-x64\publish\App.exe
Note: Our Linux packages (.deb and .rpm) are put together slightly differently than the Windows and Mac specific installers. Instead of combining everything, we have separate component packages that depend on each other. If you're installing these directly from the installer files (via dpkg or similar), then you'll need to install them in the order presented above.