Zeugwerk / Twinpack

Twinpack is a package manager for TwinCAT libraries with integration into the TwinCAT IDE. It enables the TwinCAT community to share their libraries and simplifies the continous integration of third-party components into TwinCAT projects.
https://twinpack.dev
GNU General Public License v3.0
52 stars 3 forks source link

Cannot install library from nuget repo #138

Closed dfreiberger closed 3 months ago

dfreiberger commented 3 months ago

I am currently getting the below error when trying to install a non-compiled library (*.library) from Azure Artifacts.

  INFO Restoring all packages
  INFO Downloaded CoreV1 0.1.2.0 (distributor: MyCompany) (from https://mycompany.pkgs.visualstudio.com/development/_packaging/twincat-feed/nuget/v3/index.json)
  INFO Installing CoreV1 0.1.2.0
 ERROR This type of library must have the extension ".library".
  WARN The solution doesn't have a package configuration
  INFO Finished

It appears that InstallPackageVersions uses the .Compiled flag to determine the file extension to look for in the cache. However the .Compiled extension is hard-coded to 1 in GetPackageVersionsAsync.

From a quick search, it appears you cannot have custom metadata fields in a nuspec file, to contain information such as the "compiled" flag. You can have file references, for example https://learn.microsoft.com/en-us/nuget/reference/nuspec#explicit-assembly-references. However for the time being I just changed the code to attempt to load either extension from cache.

See https://github.com/Zeugwerk/Twinpack/pull/139 for a possible fix/work-around

iadonkey commented 3 months ago

Should be fixed, for details see https://github.com/Zeugwerk/Twinpack/pull/139, https://github.com/Zeugwerk/Twinpack/commit/e9a243d02a7e4729f9734e96901db5b70bc00bdd