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
ExcludeRestorePackageImports=true should not exclude package path properties #8840
Comments
This issue in VS 15.9 means those paths aren't generated in VS2017 (which IMO should be fixed/backported): #8374 - but even from the CLI msbuild this is a problem. The package has targets that I must not have included in the project, but doing so means I cannot get the path definitions because the same condition excludes those properties.. |
Why do you need to set ExcludeRestorePackageImports? This is meant to be used for restore purposes so that packages' props/targets do not affect restore and potentially create a behavior that's not repeatable. I get that this is not in the same breath as props/targets coming from packages, but the motivation is equivalent. |
Many packages include targets that inject behavior into the build and/or have not updated their packages to be packagereference-friendly. This is both a compliance nightmare as well as a headache to track down when something isn't working right. I need to exclude the targets that actually mess up my build, but I need to reference, copy, or transform files that are in the path. The property should exclude the imports - that's what it says it does. Instead, it's excluding generated properties that I have explicitly opted into creating and intend to use. I want to use it for reliable/repeatable restore purposes, but the current design prevents that. |
You should use Include/Exclude assets for those purposes.
I get the name is not perfect, but this is really a NuGet internal that basically means packages' targets cannot not affect restore. |
Closing this as by design per the above comments. |
Details about Problem
Visual Studio 15.9.17 and msbuild cli
NuGet version: 5.3.1.6268
OS version (i.e. win10 v1607 (14393.321)):
Win10 v1909 (18363.476)
Detailed repro steps so we can see the same problem
<PackageReference Include="Test.PathProperty" Version="x.x.x" GeneratePathProperty="true" />
Expected behavior:
$(PkgTest_PathProperty) is defined, but no targets or props are imported from it.
Actual behavior:
$(PkgTest_PathProperty) is not avaiable because of the propertygroup condition
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
The text was updated successfully, but these errors were encountered: