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

MSBuild thinks a sln dependency is a reference #3418

Closed
lcsondes opened this issue Jun 18, 2018 · 1 comment
Closed

MSBuild thinks a sln dependency is a reference #3418

lcsondes opened this issue Jun 18, 2018 · 1 comment
Labels

Comments

@lcsondes
Copy link

Steps to reproduce

I have a .NET 4.7 project which, as part of its build, runs a .NET Core CLI program to generate one of its source files using the BeforeBuild target and <Exec>. Because of this I want the generator to build before my project, so the .sln file has a dependency in the form of ProjectSection(ProjectDependencies) = postProject.

Expected behavior

The build works from within VS. I expect it to work from a command line MSBuild, because I in fact don't reference the .NET Core project, just call it as any other CLI tool. The fact that it's .NET Core is irrelevant, it could be C++.

Actual behavior

[GetReferenceNearestTargetFrameworkTask] C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin\amd64\Microsoft.Common.CurrentVersion.targets(1656, 5): Project 'C:\[snip...]\csharp_gen.csproj' targets 'netcoreapp2.1'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.7'.

Environment data

msbuild /version output:

Microsoft (R) Build Engine version 15.7.179.6572 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

15.7.179.6572

OS info: Win7 x64, latest updates as of today

If applicable, version of the tool that invokes MSBuild (Visual Studio, dotnet CLI, etc):
msbuild.exe is being run standalone

@rainersigwald
Copy link
Member

Duplicate of #1915. This should be fixed for 15.8 by #3315, and #2661 (comment) includes a workaround you can use today.

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

No branches or pull requests

3 participants