无法生成nuget软件包(.nupkg文件)

发布于 2025-02-04 11:25:42 字数 606 浏览 2 评论 0原文

我有一个班级图书馆项目,可以正确构建和重建该项目。当我尝试为项目创建包装时,我会发现一个错误说:

The file 'C:\Users\Test\..\Debug\netstandard2.0\MyApi\MyApi.dll' to be packed was not found on the disk.

我的.csproj文件看起来像这样:

    <Project Sdk = "Microsoft.NET.Sdk">
    
     <PropertyGroup>
       <TargetFramework>netstandard2.0</TargetFramework>
       <OutDir>$(DIstributionDir)</OutDir>
       <ProductReferenceAssemblyInOutDir>true</ProductReferenceAssemblyInOutDir>
     </PropertyGroup>
  </Project>

我有版本v6.2.0的nuget.exe

I have a class library project and I can build and rebuild the project properly. When I try to create a pack for my project, I get an error saying :

The file 'C:\Users\Test\..\Debug\netstandard2.0\MyApi\MyApi.dll' to be packed was not found on the disk.

My .csproj file looks like this :

    <Project Sdk = "Microsoft.NET.Sdk">
    
     <PropertyGroup>
       <TargetFramework>netstandard2.0</TargetFramework>
       <OutDir>$(DIstributionDir)</OutDir>
       <ProductReferenceAssemblyInOutDir>true</ProductReferenceAssemblyInOutDir>
     </PropertyGroup>
  </Project>

I have the nuget.exe of version v6.2.0

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

秉烛思 2025-02-11 11:25:42

根据您的描述,我进行了一些测试以重现问题。

您可以在您的.csproj文件中添加&lt; generatePackageOnBuild&gt; false&gt;/generatePackageOnBuild&gt; 标记。

这是测试结果:

According to your description I make some test to reproduce the problem.

You can add <GeneratePackageOnBuild>false</GeneratePackageOnBuild> inside the <PropertyGroup> tag in your .csproj file.
enter image description here
Here is the test result:
enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文