mis*_*cos 5 c# dependencies package nuget
在我的项目中,我引用了一些这样的包PackageReference
:
但是,如果我运行 pack 命令,除非我手动将它们添加到.nuspec
文件中,否则它不会包含它们。
我想将PackageReference
C# 项目中的包自动添加到 NuGet 包。
我使用nuget pack ProjectFile
on Build 或手动打包我的项目。
当前具有依赖项的 nuspec:
PS AFAIK 引用来自packages.config
自动添加,但我不想使用此文件。我想用PackageReferences
。
实际上,您不再需要 .nuspec 文件。您可以在 csproj 文件中指定的所有信息,例如:
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<PackageId>BinaryTree</PackageId>
<Version>5.1.0.0</Version>
<Authors>RMarusyk</Authors>
<Description>Simple Binary Tree implementation</Description>
<PackageProjectUrl>https://github.com/Marusyk/BinaryTree</PackageProjectUrl>
<PackageTags>binarytree</PackageTags>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)
然后我将此行添加到 csproj 中。
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
Run Code Online (Sandbox Code Playgroud)
为了构建它,我使用:
dotnet build -c Release src/Solution.sln
dotnet pack -c Release src/Solution.sln
dotnet nuget push ..
Run Code Online (Sandbox Code Playgroud)
它适用于我的情况,无需定义任何依赖项
归档时间: |
|
查看次数: |
1172 次 |
最近记录: |