premake / premake-core

Premake
https://premake.github.io/
BSD 3-Clause "New" or "Revised" License
3.24k stars 617 forks source link

NuGet target file missing #1497

Closed amuTBKT closed 1 year ago

amuTBKT commented 4 years ago

Hello, I am trying to add a NuGet package to my project and for some reason its trying to import the "*.targets" file from the wrong directory.

I noticed that in vs2010_vcxproj.lua line#1987 we are explicitly appending "native" to the path, is there a way to configure that?

Please let me know if I am doing something wrong :)

Regards!

samsinsane commented 4 years ago

I don't know that much about the Nuget support, you can probably extend the support to detect that "native" path. It looks like it's possible to get the path of the targets file instead of assuming it's location. The current code uses the PackageDisplayMetadataUriTemplate link, another code path could be created which uses the PackageVersionDisplayMetadataUriTemplate link which replaces {id-lower} and {version-lower} instead of just {id-lower}. When you load that, you can get the catalogEntry link from that file, which for WinPixEventRuntime is https://api.nuget.org/v3/catalog0/data/2020.01.27.23.45.33/winpixeventruntime.1.0.200127001.json in here, you can see this layout:

{
  ...,
  "packageEntries": [
    ...,
    {
      "@id": "https://api.nuget.org/v3/catalog0/data/2018.10.13.03.48.16/winpixeventruntime.1.0.161021003.json#build/WinPixEventRuntime.targets",
      "@type": "PackageEntry",
      "compressedLength": 525,
      "fullName": "build/WinPixEventRuntime.targets",
      "length": 1906,
      "name": "WinPixEventRuntime.targets"
    },
    ...
  ],
  ...
}

You can then find the fullName that ends with .targets and use that in the function you mentioned.

amuTBKT commented 4 years ago

Thanks @samsinsane I was hoping there would be a way that doesn't involve modify the source for Premake xD Anyways, for now I took the quicker route and removed the hard-coded "native" extension from the path :^) I'll revisit the proper way to handle it if in future I find myself using some package that needs to be handled differently :p

Regards!

englercj commented 3 years ago

I'm hitting the same issue with the same package. Can we reopen this since it is a bug with the premake nuget support?