Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProjectReferences do not work for a NoTargets project that sets TargetFrameworks and NoTargetsDoNotReferenceOutputAssemblies #469

Open
ericstj opened this issue Aug 9, 2023 · 3 comments

Comments

@ericstj
Copy link
Member

ericstj commented Aug 9, 2023

It seems that the NoTargets project is getting confused if it's in an outer or inner build.

Try the attached repro:
noBuildCrossTargeting.zip

When building this you'll see:

C:\Program Files\dotnet\sdk\8.0.100-preview.7.23369.9\Microsoft.Common.CurrentVersion.targets(1842,5): error : Project
'..\lib\lib.csproj' targets 'net8.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.0'. [
C:\scratch\noBuildCrossTargeting\notargets\notargets.proj]

This is happening because common targets is setting TargetFrameworkIdentifier and TargetFrameworkVersion. Probably the fix here is to see what happens in outer build of a CSProj and try to match that.

cc @carlossanlop @ViktorHofer

@jeffkl
Copy link
Contributor

jeffkl commented Aug 10, 2023

For some reason, the .NET SDK doesn't have the built-in outer/inner build logic for anything project that's not a .csproj or '.vbproj.

If you rename your NoTargets project to notargets.csproj, it works just fine. The .proj extension only imports Microsoft.Common.targets.

@baronfel
Copy link
Member

@jeffkl mind dropping a link to what you're seeing that logic? I'd hope that fsproj at minimum were also considered there and I want to ensure parity.

@jeffkl
Copy link
Contributor

jeffkl commented Aug 10, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants