C#C
C#17mo ago
Byron

Mixed Project References

Hey Folks,

I often run into the case where I have one project that needs the output from another. For example i have ProjectA which is net8.0 and it needs the binaries from ProjectB which is compiled using net48. I can't add a project reference because they are different runtimes. I have tried to do
<ItemGroup>
  <ProjectReference Include="ProjectB">
    <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
  </ProjectReference>
</ItemGroup>

However you get the error This project may not be fully compatible with your project. which is weird because it's not a reference. So I add

<ItemGroup>
  <ProjectReference Include="ProjectB">
    <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
    <SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties> <!--- Add this -->
  </ProjectReference>
</ItemGroup>


However the explodes with doesn't have a target for 'net8.0' which is true because it's a net48 project.

Is there a clean way to set this up without having to do a bunch of MSBuild targets?
Was this page helpful?