在新的csproj中将自定义DLL文件添加到NuGet包中

5

.nuspec文件有<files>部分,对于新的csproj文件,包含本地化资源的替代方法是什么?如何添加自定义DLL文件?


1个回答

1
这个技巧的第一步是将第三方DLL添加到nupkg中。下面是实现方法:
      <ItemGroup>
    <Reference Include="ThirdParty">
      <HintPath>..\DLLs\ThirdParty.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Content Include="$(OutputPath)\ThirdParty.dll">
      <Pack>true</Pack>
      <PackagePath>lib\$(TargetFramework)</PackagePath>
    </Content>
  </ItemGroup>

如果您将此包安装到旧式 csproj 中,那么将添加对 ThirdParty.dll 的引用。
但是,如果您将此包安装到新式 csproj 中,则对 ThirdParty.dll 的引用不会作为引用添加,这非常令人恼火。正在进行中...

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接