CS0006-ERROR引用图书馆项目(C#,MSBUILD,.NET,.CSPROJ,NETSDK1005)

问题描述 投票:0回答:1

程序.csproj看起来像这样:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFrameworks>net481-windows;net9.0-windows</TargetFrameworks>
    <LangVersion>latest</LangVersion>
  </PropertyGroup>
  <ItemGroup>
    <ProjectReference Include="..\TestProjLib\TestProjLib.csproj" />
  </ItemGroup>
</Project>

可以在我的github repository中找到使用此测试设定的完整解决方案:

https://github.com/joecare99/csharp/tree/master/teststatements


-testprojdep.sln

TestProjDep/**
  • TestProjlib/**
  • 对于.net9.0此系统可行,并且该程序编译的良好,但是对于.NET481,它在CS0009:Metafile中失败了:[...]找不到。 将文件复制到所需的位置时,我会得到:
  • netsdk1005:ressourcefile“ [...] \ testprojlib \ obj \ obj \ project.assets.json”没有“ net481-windows” [...]的目标 我已经尝试了以下解决方案:

library:net481-windows而不是net481起作用,但是库是平台依赖性的。
library:使用net481和net481-windows给出了错误:netsdk1005

  • 是Catch22还是有很好的稳定解决方案?
  • solution[program .csproj]:

<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>WinExe</OutputType> <TargetFrameworks>net481;net9.0-windows</TargetFrameworks> <UseWindowsForms>true</UseWindowsForms> <LangVersion>latest</LangVersion> </PropertyGroup> <ItemGroup> <ProjectReference Include="..\TestProjLib\TestProjLib.csproj" /> </ItemGroup> </Project>

c# msbuild .net-4.8 platform new-project
1个回答
0
投票

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.