Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

FileVersionInfo.GetVersionInfo gives file not found for Release

$
0
0

Hello Xamarin Guys and Girls.

I'm facing one strange problem, at least for me.

When I build my project in release, FileVersionInfo.GetVersionInfo throws FileNotFoundException. I need file version info to get the product version. Bellow is part of code.

...
Assembly asm = Assembly.GetExecutingAssembly();
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(asm.Location);
string productVersion = fvi.ProductVersion
....

Anyhow, I found workaround by using different approach
...
Assembly asm = Assembly.GetExecutingAssembly();
AssemblyName asmName = new AssemblyName(asm.FullName);

string productVersion = string.Format("{0}.{1}.{2}.{3}", asmName.Version.Major, asmName.Version.Minor, asmName.Version.Build, asmName.Version.Revision)
...

BUT, I would like to know what is going on here. Why do I get FileNotFoundException for release?

Regards,
Novak


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>