With U1 separate downloads of Nuget are no longer required. I also changed the project file changes from a screenshot to an image, so it's easy to copy/paste the blobs of XML. Other minor formatting cleanups. Commit migrated from https://github.com/dotnet/corefx/commit/6b5e341ddc643270f5e60fc61f17144c6fac7e86
4.3 KiB
Getting Started Writing a .NET Core app and Class Library
These instructions are basic and a work in progress. They will be improving a lot over time. These instructions are current for Visual Studio 2015 Update 1.
Once you've followed the steps in this document, use the following sample to see the changes you need to make to your project: https://github.com/dotnet/corefxlab/tree/master/samples/NetCoreSample.
Installing the tools
- Install Visual Studio 2015 - https://www.visualstudio.com/downloads/download-visual-studio-vs
Ensure you're running Visual Studio 2015 Update 1 (in Help->About in Visual Studio, you should see version 14.0.24020.00 or higher. If not, update in Tools->Extensions and Updates.) - Check "Universal Windows App Development Tools" in the initial install or modify the install to include it.
Create a New Class Library
- File > New
- Select ".NET Framework 4.6" and "ASP.NET Core 5.0"
- At this point the project should compile
Add support for the Platform Standard
Currently to enable leveraging packages that target the Platform Standard you need do to some manual steps
- Manually edit your csproj file by right clicking on the project and select unload and then right click and select edit. Remove this line:
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
And replace it with this:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
Add this at the end of the file, before the closing Project tag:
<PropertyGroup>
<NuGetTargetMoniker>.NETPlatform,Version=v5.4</NuGetTargetMoniker>
</PropertyGroup>
-
Save and close your project file and then reload it.
-
Open project.json file and change "dotnet" to "dotnet5.4".
- Save it.
- At this point your project should be in a buildable state and targeting generation 5.4.
Update your packages to the latest
To update to the RC1 packages, adjust your project.json as follows:
"dependencies": {
"Microsoft.NETCore": "5.0.1-beta-23516",
"Microsoft.NETCore.Portable.Compatibility": "1.0.1-beta-23516"
},
To trigger the update to the latest version of the meta-packages right click on references and chose "Manage Nuget Packages":
- Click "Updates" tab
- Check the "Include prerelease" check-box
- Click the checkboxes for the packages, and click "Update"
Advanced: Updating and using nuget.exe
Future changes to the CoreCLR/CoreFX packages may require newer versions of Nuget than are currently in Visual Studio. In that case, you will need to follow these directions:
- Download the latest nuget.exe commandline client. This is required until a new NuGet Visual Studio extension is available. Browse to https://www.myget.org/gallery/nugetbuild and download the
NuGet.Commandlinepackage. Rename the extension from.nupkgto.zipand extract nuget.exe from the tools folder. - Disable NuGet's built-in package restore since that won't be using the latest nuget.exe we just downloaded. Goto Tools | NuGet Package Manager | Package Manager Settings | General.

- Setup ".NET Core Dev Feed" package source -> "http://myget.org/F/dotnet-core". Goto Tools | NuGet Package Manager | Package Manager Settings | Package Sources.

- In the Nuget Package Manager, above, follow the same steps, choosing '.NET Core Dev Feed' instead of the normal Nuget.org feed.
- Run 'nuget.exe restore project.lock.json'




