Conditional reference in Visual Studio Community 2017
If MsBuild is taking into account only your first <Choose/>
or condition then you'd want to do this:
<Choose>
<When Condition="'$(Configuration)'=='Debug'">
<ItemGroup>
<ProjectReference Include="..\path\to_your_project.csproj" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<PackageReference Include="Package-Name" Version="1.0.0"/>
</ItemGroup>
</Otherwise>
</Choose>
Visual Studio ignores the condition in these cases. Use a Choose/When
instead, that should be fully supported: https://msdn.microsoft.com/en-us/library/ms164282.aspx
<Choose>
<When Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<ItemGroup>
<PackageReference Include="CommandLine.DotNetStandard">
<Version>1.0.3</Version>
</PackageReference>
</ItemGroup>
</When>
<When Condition=" '$(TargetFramework)' == 'net45' ">
<ItemGroup>
<PackageReference Include="CommandLineParser">
<Version>1.9.71</Version>
</PackageReference>
</ItemGroup>
</When>
</Choose>