C
C#6mo 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>
<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>
<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?
3 Replies
becquerel
becquerel6mo ago
the cleanest way is to have the projects talk over some framework-agnostic interface, i.e. a HTTP call or whatever
This project may not be fully compatible with your project
isn't this a warning by default, though? .net core has a 'compatability shim' by default where it will try its best to work with .net framework assemblies (it just doesn't promise it won't explode if the framework assembly does something unsupported) i know this because my work solution used to be in this situation
Unknown User
Unknown User6mo ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiX6mo ago
If you have no further questions, please use /close to mark the forum thread as answered

Did you find this page helpful?