It is hard to get project data (product, version) in case if project was build as Published Release (In VS: Build -> Publish Selection). This way not working
var assembly = Assembly.GetExecutingAssembly();
var version = FileVersionInfo.GetVersionInfo(assembly.Location);
because have no access to Assembly. I found solution
GetType().Assembly.GetName().Version.ToString();
but this way I can get just version not other project attributes (Company, Product). How can I get all project data? Maybe need to some configure publish?
Once again:
Assembly NOT worked (unavailable) in case of Published Release but all OK on debug or run from code
P.P.S. Try to run on "old" code
Push F10
Looks like it try to execute next line
var version = FileVersionInfo.GetVersionInfo(assembly.Location);
Looks like this is working
var version = FileVersionInfo.GetVersionInfo(Environment.GetCommandLineArgs()[0]);
or
var version = FileVersionInfo.GetVersionInfo(Environment.ProcessPath);
Found in this article https://learn.microsoft.com/en-us/dotnet/core/deploying/single-file/overview?tabs=vs#api-incompatibility