【发布时间】:2022-01-19 02:49:17
【问题描述】:
我有一个创建 nuget (RawDataConverter.nuget) 的项目。框架类型为 .NET Framework 4.5.2。
我有一个项目,我将 RawDataConverter.nuget 导入 (GeoApp)。 GeoApp 的框架类型是 .NET Core 2.1。我从来没有遇到过将 RawDataConverter.nuget 导入 GeoApp 的问题。
我最近向 RawDataConverter.nuget 添加了一个 .targets 文件,突然 GeoApp 抛出了与 nuget 相关的错误。我收到了几个 "The type or namespace name 'X' could not be found (are you missing a using directive or an assembly reference?" 错误,好像 nuget 根本没有导入一样。
这是 .targets 文件:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<NativeLibs Include="$(MSBuildThisFileDirectory)\..\runtimes\win10-x64\native\*.dll" />
<None Include="@(NativeLibs)">
<Link>%(FileName)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
以前有人见过这种行为吗?由于这个 .targets 文件,我猜 nuget 没有在 GeoApp 中正确导入,但我不知道为什么。
【问题讨论】: