0

I'm developing an endpoint to provide some app info. One of the requirements is to get version of one specific nuget package we use.

I've tried to do so thru Assembly.GetAssembly(typeof()).GetName().Version.ToString()but this package's version differs from it's assembly version, so it's no use to me.

Pavel_K
  • 21
  • 1
  • 6
  • 1
    prolly you can't ... assembly is not aware of their nuget package ... – Selvin Jun 17 '22 at 11:51
  • if you are using MSBuild you can: use build time variable and use it as nuget package version and use `WriteLinesToFile` to write this version to the file ... then you can embed this file to your assebly and read this value – Selvin Jun 17 '22 at 11:57
  • The info is in your project.assets.json file, if you make sure that's bundled with your release artifact you could read it from there. Not sure if there's a better way – rbennett485 Jun 17 '22 at 11:57
  • [...like this](https://gist.github.com/SelvinPL/2e64ff23ffd188bd528733d019ce4275) – Selvin Jun 17 '22 at 12:29

0 Answers0