首页 > 解决方案 > 将 nuget 包的内容文件复制到输出目录

问题描述

所以最近我更改了我的项目的 .csproj 以移动到包引用,而不是使用 app.config。

以前,在 app.config 中有对 IronPython nuget 包的引用,在 csproj 中有以下引用。

> <Content
> Include="..\packages\IronPython.StdLib.2.7.8.1\contentFiles\any\any\Lib\**\*.*">
> <Link>pythonlib\%(RecursiveDir)%(Filename)%(Extension)</Link>  
> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content>

它工作正常并将文件复制到输出目录。

现在转到包参考,我添加了以下行并从 app.config 中删除了 IronPython。

<ItemGroup>
     <PackageReference Include="IronPython.StdLib">
      <Version>2.7.8.1</Version>
    </PackageReference>
</ItemGroup>

但是“..\packages\IronPython.StdLib.2.7.8.1”中的内容文件不再复制到输出目录。我该如何纠正这个问题?有任何想法吗。谢谢

标签: nugetcsprojpackagereference

解决方案


推荐阅读