-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Legacy project format doesn't respect conditions in Directory.Build.props and targets for PackageReference #3874
Labels
Comments
Can you clarify what you mean by "the package is still included in the project"? |
I tried this: diff --git a/LegacyBased/LegacyBased.csproj b/LegacyBased/LegacyBased.csproj
index 5305a2f..573af30 100644
--- a/LegacyBased/LegacyBased.csproj
+++ b/LegacyBased/LegacyBased.csproj
@@ -12,6 +12,7 @@
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
+ <RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> And it appears to be working as expected from the command line but still fails in VS. I think this is related to NuGet's in-VS handling of the restore operation, so I'm going to move the issue to the NuGet repo. |
This issue was moved to NuGet/Home#7433 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
When having a Directory.Build.props and/or Directory.Build.targets file, where you include a
<PackageReference />
these files are also included (by MSBuild, also Visual Studio) for legacy based project files (non-sdk format project files). This is great, except that when you set a condition on the<PackageReference />
or it's<ItemGroup>
, even if the condition would evaluate tofalse
(and thus it should be skipped), the package is still included in the project. This doesn't happen for an SDK based project.Reproducable sample repository
https://github.com/Styxxy/Issue-BuildPropsTargets
Environment details
msbuild /version
dotnet --info
Visual Studio 2017
Microsoft Visual Studio Community 2017
Version 15.8.7
VisualStudio.15.Release/15.8.7+28010.2046
Microsoft .NET Framework
Version 4.7.03056
Installed Version: Community
The text was updated successfully, but these errors were encountered: