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

Conditional references in csproj files causes error when condition is false #2583

Closed
RezaJooyandeh opened this issue Jul 10, 2017 · 4 comments
Assignees
Labels
Area-External-CPS Owned by CPS and not this repo. Likely be closed in lieu of issue filed against VS platform.
Milestone

Comments

@RezaJooyandeh
Copy link

I am trying to have a solution with two projects and reference on in the other one only in Debug builds but referencing under conditions causes compile error on Release although it compiles just fine on Debug. It is very easy to reproduce:

1>------ Build started: Project: DebugTools, Configuration: Release Any CPU ------
1>DebugTools -> [Address of Solution]\DebugTools\bin\Release\netstandard1.4\DebugTools.dll
2>------ Build started: Project: MainLibrary, Configuration: Release Any CPU ------
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets(92,5): error : Cannot find project info for '[Address of Solution]\DebugTools\DebugTools.csproj'. This can indicate a missing project reference.
2>Done building project "MainLibrary.csproj" -- FAILED.
========== Build: 1 succeeded or up-to-date, 1 failed, 0 skipped ==========

Here is the content of the content of the csproj files. I am using VS 15.2 (26430.14)

DebugTools.csproj

<Project Sdk="Microsoft.NET.Sdk">
	<PropertyGroup>
		<TargetFramework>netstandard1.4</TargetFramework>
	</PropertyGroup>
</Project>

MainLibrary.csproj

<Project Sdk="Microsoft.NET.Sdk">
	<PropertyGroup>
		<TargetFramework>netstandard1.4</TargetFramework>
	</PropertyGroup>
	<ItemGroup Condition="'$(Configuration)' == 'Debug'">
		<ProjectReference Include="..\DebugTools\DebugTools.csproj" />
	</ItemGroup>
</Project>
@RezaJooyandeh RezaJooyandeh changed the title Conditional references causes error when condition is false Conditional references in csproj files causes error when condition is false Jul 13, 2017
@srivatsn
Copy link
Contributor

If the solution is closed and reopened after changing the configuration to Release (such that the config is Release when the solution is loaded) then it builds fine. It looks like switching configurations doesn't change the set of project references we track for a project.

@srivatsn srivatsn added the Bug label Jul 24, 2017
@srivatsn srivatsn modified the milestones: 15.5, 16.0 Preview1 Jul 24, 2017
@davkean davkean added the Area-External-CPS Owned by CPS and not this repo. Likely be closed in lieu of issue filed against VS platform. label Aug 29, 2017
@Pilchie
Copy link
Member

Pilchie commented Mar 30, 2018

Does this work on command line builds? @nguerrera or @lifengl - where should this be moved?

@nguerrera
Copy link
Contributor

This doesn't work on the command line either. I think it's a fundamental issue with the fact that nuget restore shares assets file between configurations. I don't think SDK nor CPS can fix this either. It's more of a nuget issue.

@Pilchie
Copy link
Member

Pilchie commented Mar 30, 2018

This issue was moved to NuGet/Home#6757

@Pilchie Pilchie closed this as completed Mar 30, 2018
@drewnoakes drewnoakes removed the Bug label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-External-CPS Owned by CPS and not this repo. Likely be closed in lieu of issue filed against VS platform.
Projects
None yet
Development

No branches or pull requests

6 participants