AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / computer / 问题 / 1455084
Accepted
aziannomness
aziannomness
Asked: 2019-07-02 14:22:23 +0800 CST2019-07-02 14:22:23 +0800 CST 2019-07-02 14:22:23 +0800 CST

NuGet pack 命令不将文件复制到输出

  • 772

我目前正在将我公司的共享类库项目从项目引用移动到 NuGet 包引用。我已经成功地转换了所有项目,除了一个项目,这是一个针对 .NET v4.7.2 的旧 VB.NET 项目。我在构建或打包过程中没有遇到任何错误,并且包已成功创建,但是有一系列外部 DLL 和我需要复制到 NuGet 包中的 PDB 文件。

这是 .nuspec 文件:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
  <metadata>
    <id>Project.Core</id>
    <version>$version$</version>
    <title>$title$</title>
    <authors>Author Here</authors>
    <owners>Owner Here</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>$description$</description>
    <releaseNotes>Initial release.</releaseNotes>
    <copyright>Copyright © 2019</copyright>
  </metadata>

  <files>
    <file src="bin\$configuration$\Project.Core.pdb" target="lib\net472" />
    <file src="bin\$configuration$\FirstExternal.dll" target="lib\net472" />
    <file src="bin\$configuration$\SecondExternal.dll" target="lib\net472" />
    <file src="bin\$configuration$\ThirdExternal.dll" target="lib\net472" />
    <file src="bin\$configuration$\FourthExternal.dll" target="lib\net472" />
    <file src="bin\$configuration$\FifthExternal.dll" target="lib\net472" />
    <file src="bin\$configuration$\SixthExternal.dll" target="lib\net472" />
  </files>
</package>

这是项目文件:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}</ProjectGuid>
    <OutputType>Library</OutputType>
    <RootNamespace>
    </RootNamespace>
    <AssemblyName>Project.Core</AssemblyName>
    <Description>Core Class Library.</Description>
    <MyType>Windows</MyType>
    <SignAssembly>true</SignAssembly>
    <AssemblyOriginatorKeyFile>AssemblyKey.snk</AssemblyOriginatorKeyFile>
    <DelaySign>false</DelaySign>
    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
    <MapFileExtensions>true</MapFileExtensions>
    <UseApplicationTrust>false</UseApplicationTrust>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <DefineDebug>true</DefineDebug>
    <DefineTrace>true</DefineTrace>
    <OutputPath>bin\Debug\</OutputPath>
    <DocumentationFile>Project.Core.xml</DocumentationFile>
    <NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42353,42354,42355</NoWarn>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
    <CodeAnalysisRuleSet>..\StyleCop-Recommended.ruleset</CodeAnalysisRuleSet>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>none</DebugType>
    <DefineTrace>true</DefineTrace>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DocumentationFile>Project.Core.xml</DocumentationFile>
    <NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42353,42354,42355</NoWarn>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
    <CodeAnalysisRuleSet>..\..\StyleCop-Recommended.ruleset</CodeAnalysisRuleSet>
  </PropertyGroup>

{Some more configuration definitions.}

  <PropertyGroup>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
  </PropertyGroup>
  <ItemGroup>

    {Bunch of NuGet references.}

    <Reference Include="FirstExternal">
      <HintPath>..\Lib\FirstExternal\FirstExternal.dll</HintPath>
    </Reference>
    <Reference Include="SecondExternal, Version=1.2.2389.14294, Culture=neutral, PublicKeyToken=60064b713d9de8f4, processorArchitecture=MSIL">
      <HintPath>..\Lib\SecondExternal\1.2\SecondExternal.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <Private>True</Private>
    </Reference>
    <Reference Include="ThirdExternal, Version=11.1.0.0, Culture=neutral, PublicKeyToken=6d02be8724ca751c, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\Lib\ThirdExternal\6.5\ThirdExternal.dll</HintPath>
    </Reference>
    <Reference Include="FourthExternal, Version=6.4.0.0, Culture=neutral, PublicKeyToken=6d02be8724ca751c, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\Lib\FourthExternal\6.5\FourthExternal.dll</HintPath>
    </Reference>
    <Reference Include="FifthExternal, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\Lib\FifthExternal\2.0.5\FifthExternal.dll</HintPath>
    </Reference>
    <Reference Include="SixthExternal">
      <HintPath>..\Lib\SixthExternal\0.3.5_projectCustom\SixthExternal.dll</HintPath>
    </Reference>


    <Reference Include="System" />
    <Reference Include="System.ComponentModel.DataAnnotations" />
    <Reference Include="System.configuration" />
    <Reference Include="System.Core">
      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    </Reference>
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.EnterpriseServices" />
    <Reference Include="System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
    <Reference Include="System.Runtime.Serialization">
      <RequiredTargetFramework>3.0</RequiredTargetFramework>
    </Reference>
    <Reference Include="System.ServiceModel">
      <RequiredTargetFramework>3.0</RequiredTargetFramework>
    </Reference>
    <Reference Include="System.Transactions" />
    <Reference Include="System.Web" />
    <Reference Include="System.Web.ApplicationServices" />
    <Reference Include="System.Web.Extensions" />
    <Reference Include="System.Web.Services" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Xml.Linq" />
  </ItemGroup>
  <ItemGroup>
    <Import Include="Microsoft.VisualBasic" />
    <Import Include="System" />
    <Import Include="System.Collections" />
    <Import Include="System.Collections.Generic" />
    <Import Include="System.Data" />
    <Import Include="System.Diagnostics" />
    <Import Include="System.Linq" />
    <Import Include="System.Windows.Forms.ComponentModel.Com2Interop" />
  </ItemGroup>
  <ItemGroup Label="CodeFiles">
    {Lots and lots of compile elements.}
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="My Project\Resources.resx">
      <Generator>VbMyResourcesResXFileCodeGenerator</Generator>
      <CustomToolNamespace>My.Resources</CustomToolNamespace>
      <SubType>Designer</SubType>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <LastGenOutput>Resources.Designer.vb</LastGenOutput>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\Messages.resx">
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="packages.config" />
    <None Include="My Project\Application.myapp">
      <Generator>MyApplicationCodeGenerator</Generator>
      <LastGenOutput>Application.Designer.vb</LastGenOutput>
    </None>
    <None Include="My Project\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <CustomToolNamespace>My</CustomToolNamespace>
      <LastGenOutput>Settings.Designer.vb</LastGenOutput>
    </None>
  </ItemGroup>
  <ItemGroup>
    <WebReferences Include="Web References\" />
  </ItemGroup>
  <ItemGroup>
    <WCFMetadata Include="Service References\" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Folder\SubFolder\" />
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
</Project>

我运行以下命令:nuget pack .\Path\To\Project\Project.vbproj -Properties Configuration=Debug -OutputDirectory E:\Local\Nuget-Repo -Verbosity detailed但只有项目的 DLL 和文档 XML 文件被放入 nupkg 的 lib\net472 文件夹中。

请记住,这个项目比我在公司的时间早了很长时间。所以项目文件中可能有我不熟悉的非常古老的元素。

NuGet Version: 5.0.2.5988
Microsoft (R) Build Engine version 16.1.76+g14b0a930a7 for .NET Framework

如果需要任何额外信息,请告诉我。

package-management vb.net
  • 1 1 个回答
  • 1032 Views

1 个回答

  • Voted
  1. Best Answer
    aziannomness
    2019-07-04T04:31:53+08:002019-07-04T04:31:53+08:00

    我设置了一个全新的 VB.NET 项目并使用基本相同的 .nuspec 文件测试了 pack 命令,它工作得很好。

    经过进一步调查,我发现项目文件名必须与 .nuspec 文件名完全匹配。我重命名了我的 .nuspec 文件以匹配我的项目文件的名称,它现在可以工作了。

    • 0

相关问题

  • 网站和包管理器上的不同版本

  • 为什么我的本地包版本比 Arch 存储库中的版本旧,但仍显示为最新

  • 如何在 freeBSD 发行版上安装包管理器 (PKG)

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    Windows 10 服务称为 AarSvc_70f961。它是什么,我该如何禁用它?

    • 2 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Marko Smith

    ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败:无法获取本地颁发者证书 (_ssl.c:1056)

    • 4 个回答
  • Marko Smith

    我如何知道 Windows 安装在哪个驱动器上?

    • 6 个回答
  • Martin Hope
    Albin 支持结束后如何激活 WindowsXP? 2019-11-18 03:50:17 +0800 CST
  • Martin Hope
    fixer1234 “HTTPS Everywhere”仍然相关吗? 2019-10-27 18:06:25 +0800 CST
  • Martin Hope
    Kagaratsch Windows 10 删除大量小文件的速度非常慢。有什么办法可以加快速度吗? 2019-09-23 06:05:43 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    Inter Sys Ctrl+C 和 Ctrl+V 是如何工作的? 2019-05-15 02:51:21 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve