6bdd276d05
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
2.9 KiB
2.9 KiB
How to patch dotnet CLI with latest CoreFX
This document provides the steps necessary to consume a nightly build of CoreFX and CoreCLR.
Please note that these steps aren't necessary for official builds -- these steps are specific to consuming nightlies and thus unsupported builds. Also note that these steps are likely to change as we're simplifying this experience. Make sure to consult this document often.
Install prerequisites
- Install CLI 2.0.0-alpha SDK
Setup the project
-
Create a new project
- Creat a new folder for your app
- Create project file by running
dotnet new
-
Add the CoreFX MyGet feed to your NuGet configuration.
- You can do this globally but we recommend not doing this as this might affect other projects on your machine and you probably don't want that.
- Instead, add a
nuget.config
that is local to your project. You can just put it next to the.csproj
file. See the NuGet docs for details.
<configuration> <packageSources> <add key="CoreFX" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" /> </packageSources> </configuration>
-
Select the nightly build from our feed
- https://dotnet.myget.org/feed/dotnet-core/package/nuget/Microsoft.NETCore.App
- Presumably you want the latest version.
In order to consume the latest build, you'll need to update your .csproj
as follows:
- Update
TargetFramework
, addRuntimeIdentifier
as below (ideallydotnet.exe
would infer your current architecture but it currently doesn't) - Update package reference to match version selected above, as below
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
</PropertyGroup>
<!-- Make sure to use Update, not Include! -->
<ItemGroup>
<PackageReference Update="Microsoft.NETCore.App" Version="2.0.0-beta-001386-00" />
</ItemGroup>
</Project>
Restore packages so that you're ready to play:
$ dotnet restore
Consume the new build
Edit your Program.cs
to consume the new APIs, for example:
using System;
using System.Net;
class Program
{
static void Main(string[] args)
{
WebUtility.HtmlDecode("&", Console.Out);
Console.WriteLine();
Console.WriteLine("Hello World!");
}
}
Run the bits:
$ dotnet run
Rinse and repeat!