简体   繁体   English

无法生成 Nuget 包(.nupkg 文件)

[英]Cannot generate a Nuget package (.nupkg file)

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 :我的 .csproj 文件如下所示:

    <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我有版本 v6.2.0 的 nuget.exe

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.您可以在 .csproj 文件的<PropertyGroup>标记内添加<GeneratePackageOnBuild>false</GeneratePackageOnBuild> 在此处输入图像描述 Here is the test result:这是测试结果: 在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM