NuGet / Home

Repo for NuGet Client issues
Other
1.49k stars 249 forks source link

Feature: control MSBuild property name generated by GeneratePathProperty for a package #9776

Open safern opened 3 years ago

safern commented 3 years ago

There are some cases where people calculate a package reference depending on the HostArch/HostOS with something like:

<PackageReference Include="runtime.$(HostOS)-$(HostArch).PackageName" ... />

The propety generated for that package will be something like, Pkgruntime_osx_10_12_packagename, which is impossible to reference on MSBuild dynamically based on the hostarch/os. You would need to check which property is set for all the possible combinations of host and arch.

It would be nice to support metadata like, GeneratedPropertyName where I could specify the property name I want for a package reference.

cc: @nkolev92 @ericstj @ViktorHofer

ericstj commented 3 years ago

Here's a very hacky way I made this work before: https://github.com/dotnet/corefx/blob/985334c90d6b181cd47cd42c4c958d9dd34ab90b/external/optimizationData/optimizationData.depproj#L23-L28

Agreed there should be a feature for this.