NuGet packaged class libraries and references in the. NET Core Console Project

Source: Internet
Author: User
Tags dotnet

Because the Mac version of Vscode is used, it is all done through the dotnet command.

1, dotnet new Lib to create the class library project;

2. Edit the. csproj file in the project root directory, add the version number (recommended);

1 <ProjectSDK= "MICROSOFT.NET.SDK">2 3   <PropertyGroup>4     <targetframework>netstandard1.4</targetframework>5     <Version>1.0.1</Version>6   </PropertyGroup>7 8 </Project>

3, after the completion of the code, Dotnet Pack packaging, success can see the path of the NuGet package and version number;

4. In the. csproj file of the console project, add the reference information to the Appclass project;

1 <ProjectSDK= "MICROSOFT.NET.SDK">2 3   <PropertyGroup>4     <OutputType>Exe</OutputType>5     <targetframework>netcoreapp1.1</targetframework>6   </PropertyGroup>7   <ItemGroup>8     <packagereferenceInclude= "Appclass"Version= "1.0.1"/>9   </ItemGroup>Ten </Project>

5, dotnet restore-s nuget package storage directory;

6, to the project to call the class library project classes and methods and run;

NuGet packaged class libraries and references in the. NET Core Console Project

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.