You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Paths to the package folder(GeneratePathProperty feature) should be generated for all libraries in the project graph #7851
When Visual Studio 2019 RC came out, I switched over to using it full time, so I'm now using a version of VS that actually works correctly with the new GeneratePathProperty feature in NuGet/NuGet.Client#2271.
Now that I can properly see it in action, I think it's current behavior is confusing and too difficult to use. Sometimes you have to opt-in to having the property with GeneratePathProperty="true" on your package reference and sometimes you don't. Based on NuGet/NuGet.Client#2271 (comment) it turns out this is controlled by whether or not the package has a tools folder in it.
This means I have to know the internal package structure of the package I'm consuming to know whether I need to add GeneratePathProperty="true" or not. I could just always add it, but then what's the benefit of it sometimes automatically happening?
This feature should either be completely opt-in or completely opt-out. Having it sometimes be opt-in and sometimes opt-out means I can never really trust it, and always have to explicitly opt-in to it even if it might be redundant.
Why is this tied to the tools folder anyway? I have several places where I'd find having the package path helpful, but none of them are related to the tools folder. They are primarily around advanced packaging scenarios, where I need to be able to reference items inside packages to include them in other packages.
changed the title [-]GeneratePathProperty feature shouldn't rely on tools folder[/-][+]GeneratePathProperty feature shouldn't rely on tools folder to determine behavior[/+]on Mar 4, 2019
changed the title [-]GeneratePathProperty feature shouldn't rely on tools folder to determine behavior[/-][+]Paths to the package folder(GeneratePathProperty feature) should be generated for all libraries in the project graph[/+]on Mar 6, 2019
Some historical context around the current design:
We hoped that this feature would rarely be used and would only be useful for two reasons:
You are consuming a package with a command-line tool in your build. The package has no build\packageid.props that declares a property to the package path so you need to know the path.
You are consuming a package that has a non-supported layout. This includes putting files at the root of the package or using folder names that don't follow conventions like build, lib, or ref.
Both scenarios worked okay with packages.config because the path to the package was relative to the project. Users could manually consume the package by guessing the path. However, updating the package in Visual Studio required updating the version in the relative path manually. Since PackageReference uses the global package folder, the paths are harder to derive. You can use something like $(NuGetPackageRoot)\packageid\version\tools\mytool.exe but its not very discoverable.
Internally at Microsoft we are migrating large codebases that consume a handful of non-conformant packages and we are using an internal-only solution to generate these properties. In order to move away from the internal-only tool we needed this feature as an escape hatch to consume packages that were poorly put together and could not be updated.
Generating a property for each package could potentially slow down MSBuild evaluations in large repositories since the properties are for each project. So we didn't want it on by default. After a discussion, we decided that if a package had a tools folder then there was a high likelihood that the user would want to run the tool during a build so it was made automatic.
Activity
[-]GeneratePathProperty feature shouldn't rely on tools folder[/-][+]GeneratePathProperty feature shouldn't rely on tools folder to determine behavior[/+]nkolev92 commentedon Mar 5, 2019
//cc @rrelyea @anangaur
[-]GeneratePathProperty feature shouldn't rely on tools folder to determine behavior[/-][+]Paths to the package folder(GeneratePathProperty feature) should be generated for all libraries in the project graph[/+]jeffkl commentedon Mar 8, 2019
Some historical context around the current design:
We hoped that this feature would rarely be used and would only be useful for two reasons:
build\packageid.propsthat declares a property to the package path so you need to know the path.build,lib, orref.Both scenarios worked okay with
packages.configbecause the path to the package was relative to the project. Users could manually consume the package by guessing the path. However, updating the package in Visual Studio required updating the version in the relative path manually. SincePackageReferenceuses the global package folder, the paths are harder to derive. You can use something like$(NuGetPackageRoot)\packageid\version\tools\mytool.exebut its not very discoverable.Internally at Microsoft we are migrating large codebases that consume a handful of non-conformant packages and we are using an internal-only solution to generate these properties. In order to move away from the internal-only tool we needed this feature as an escape hatch to consume packages that were poorly put together and could not be updated.
Generating a property for each package could potentially slow down MSBuild evaluations in large repositories since the properties are for each project. So we didn't want it on by default. After a discussion, we decided that if a package had a
toolsfolder then there was a high likelihood that the user would want to run the tool during a build so it was made automatic.Added XSD schemas for MDLP v1.34 and generated C# classes.