Visual Studio 2017 and .NET Core support on MyGet
With MyGet build services, we can link a GitHub or BitBucket repository to MyGet and create packages automatically. Today, we're happy to release support for the new project format that was introduced with Visual Studio 2017 last week. With this support also came the latest SDK's, F# 4.1 support, a new NPM version and many more enhancements to our build services.
Building .NET Core NuGet pacages
Ever since the first release of "project K", we have supported building what became .NET Core projects. Some scripting was required to build a NuGet package from a project.json
file though. With the introduction of Visual Studio 2017 and NuGet 4.0, building NuGet packages for .NET Core projects has become very easy.
NuGet has become a part of the MSBuild pipeline, which means just building a project with the correct flags enabled will result in a NuGet package being created. Let's see how
From any .NET Core project (in the new .csproj format)'s settings, we can navigate to the Package tab and enable Generate NuGet package on build. That's... it! We can add some package metadata, publish our source code to GitHub, and have MyGet build it for us.
By default, no debugger symbols package will be generated that can help consumers of our NuGet package to step into our source code. It's simple enough to enable this feature though. From the solution explorer, use the Edit ProjectName.csproj context menu and add two MSBuild properties: IncludeSymbols
and IncludeSource
.
<Project SDK="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
<Authors>Maarten Balliauw</Authors>
<Company>MyGet</Company>
<Description>Hello World for .NET Core.</Description>
<Copyright>Maarten Balliauw</Copyright>
<PackageTags>hello world core</PackageTags>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IncludeSymbols>True</IncludeSymbols>
<IncludeSource>True</IncludeSource>
</PropertyGroup>
</Project
>
Commit, push, and let MyGet handle the build and serve up debugger symbols.
Happy packaging! (and building)