.NUSPEC不适用于.NET 6项目
我有以下三个项目,所有项目都是使用VS2022和Targinaling .NET 6。
- 外部Project(.dll)
- InternalProject(.dll)
- testProject(.exe)
ExternalProject包含对InternalSproject的引用,我也正在使用Nuget Offection Proke of ExternalProject使用The ExternalProject的参考。下面命令
dotnet pack externalProject.csproj /p:nuspecfile=
externalClass.nuspec externalClass.nuspec文件的内容低于
<?xml version="1.0"?>
<package >
<metadata>
<id>ExternalProject</id>
<version>1.0.10</version>
<title>ExternalProject</title>
<authors>Ustad</authors>
<owners>Ustad</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
</metadata>
<files>
<file src="..\InternalProject\bin\Debug\net6.0\*.*" target="lib\net6.0" />
</files>
</package>
问题,是,InternalProject DLL未添加到外部Prothignt Nuget软件包中。不知道我在这里缺少什么。
I have below three projects, all are created using VS2022 and targeting .net 6.
- ExternalProject (.dll)
- InternalProject (.dll)
- TestProject (.exe)
ExternalProject contains a reference to the InternalProject, also I am creating NuGet package of ExternalProject using the below command
dotnet pack ExternalProject.csproj /p:NuspecFile=ExternalClass.nuspec
The content of ExternalClass.nuspec file is below
<?xml version="1.0"?>
<package >
<metadata>
<id>ExternalProject</id>
<version>1.0.10</version>
<title>ExternalProject</title>
<authors>Ustad</authors>
<owners>Ustad</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
</metadata>
<files>
<file src="..\InternalProject\bin\Debug\net6.0\*.*" target="lib\net6.0" />
</files>
</package>
The problem is, that InternalProject dll is not being added to the ExternalProject NuGet package. Not sure what I am missing here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我得到了解决方案,应该编辑externalProject.csproj文件,然后在XML下添加。还将在ProjectReference元素中添加privateasetss =“ all”。
I got the solution, one should edit ExternalProject.csproj file and add below xml. Also add PrivateAssets="all" in the ProjectReference element.
由于我的评论中的答案比当前 Documentation 我在这里包括。
根据文档:
即,就像链接的答案所说的那样,除了发布每个项目的包裹外,别无其他方法。如果不是一个选择,则可以使用其中描述的工作。
Since the answer in my comment is one year older than the current documentation I'll include here.
According to the docs:
I.e. just like the linked answer says, there's no official way to do it other than publishing a package per project. If that's not an option, you can use the work arounds described there.