On Bowen .Net core program Nuget package be kept separate (a) are described in the operating environment, how to put nuget inventory, there is a problem is not solved: how to concentrate separated from the pack nuget publish the program . This article will introduce how to solve this problem:
First, dotnet store command, nuget package export, at the same time and generate a list of goals.
dotnet store -m test.csproj -r win-x64 --skip-optimization --skip-symbols -o r:\packages
This command can also be used for the solution file, the output results are as follows:
test.csproj reduction completed in 488.63 ms.
Were the Composed in r Files: \ Packages Standard Package \ x64 \ netcoreapp3.1 \
at The List of IS in the Stored Packages Standard Package r: \ Packages Standard Package \ x64 \ netcoreapp3.1 \ artifact.xml
Which shows storage path nuget package, and manifest file.
Then, when released, designated nuget target list, it will cut the corresponding package.
dotnet publish --manifest r:\packages\x64\netcoreapp3.1\artifact.xml
Together with the above settings, modify xxx.runtimeconfig.json file search path specified , the package can be realized nuget isolated storage.
{
"runtimeOptions": {
"tfm": "netcoreapp3.1",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "3.1.0"
},
"additionalProbingPaths": [
"R:\\packages\\x64\\netcoreapp3.1"
]
}
}
The path adaptive manner can also be written:
"R:\\packages\\|arch|\\|tfm|"
Problems encountered
Actual use, you will find, for slightly larger projects, there will be an assembly interdependent situation, this time dotnet store directory is very easy to make mistakes. I tried a variety of parameters, but could not find a solution. Just as I was ready to give up and find another way.
-
With dotnet list package command, enumerate all the package solution or project dependencies
-
Create a simple project into these packages include, as an example:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<OutputType>Library</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Interactive" Version="4.0.0" />
<PackageReference Include="StackExchange.Redis" Version="2.0.601" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="RabbitMQ.Client" Version="5.1.2" />
</ItemGroup>
</Project>
My approach is to put all Nuget program solutions for inclusion into a project file duplicates removed, then this works dotnet store command, it is very easy to export nuget the library.