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