This question already has answers here:
How to get app version in Windows Phone?
(11 answers)
Closed 8 years ago.
How do you get the app version number? It's clear how to get OS version number etc, but nothing seems to be documented on getting the app version from the manifest?
Getting OS Version number works as such:
var VersionNumber = Environment.OSVersion.Version;
btn.Content = VersionNumber;
You can get the Version from the manifest by loading the .xml like this:
string Version = XDocument.Load("WMAppManifest.xml")
.Root.Element("App").Attribute("Version").Value;
Related
This question already has answers here:
Maximum filename length in NTFS (Windows XP and Windows Vista)?
(15 answers)
Closed 5 years ago.
I have ASP.NET Core MVC project (targeting .NET 4.62) and I'm trying to save files. Everything works while the length of the path is under 260 (or 248 I'm not sure), but when it's longer I get a System.IO.DirectoryNotFoundException. Previously when I was targeting .NET 4.61 I was getting Path too long exception, I've read that the problem is fixed in .NET 4.62 but not for me.
Here's exception that I'm getting while path is too long
File.Copy(file, Path.Combine(path, dbFile.Id.ToString()));
I'm pretty sure that directory exists.
I refer you to this answer on why the ~255 limit filename|folder. Probabaly a probleme because you are on Windows on NTFS. Nothing to do with .NET framework
This question already has answers here:
Getting Windows OS version programmatically
(6 answers)
Closed 5 years ago.
Using C#, how can I get the Windows build number or OS Build number as shown in the About window? This is different from the version number: for Windows 10 Creator Update, the Build Number would be 1703 and the OS Build would be 15063.296.
I can't find anything relevant in Environment.OSVersion and this linked question (Getting Windows OS version programmatically) is only about getting the version number (10 in this case)
The following gets the Build number:
Environment.OSVersion.Version.Build
This question already has answers here:
How do I test if another installation is already in progress?
(3 answers)
Closed 7 years ago.
I'm looking for a way to detect if a Windows Installer installation is already in progress. What I've found out so far is:
Checking the Registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\InProgress
Using the Windows Installer API function MSIInstallProduct with a dummy file which then would return the specific error code.
Does anybody know a smarter solution?
Same as this:
check for windows installer mutex availability
and this:
http://blogs.msdn.com/b/heaths/archive/2006/01/23/516454.aspx
Question 1:
http://blogs.msdn.com/b/windows_installer_team/archive/2005/11/09/487559.aspx
This question already has answers here:
Detect current VSIX package's version from code
(3 answers)
Closed 7 years ago.
I want to check the version of the currently installed VSPackage to notify the users if his version is outdated. I don't want to upload my extension (yet), so I can't use the built-in update feature.
How can I read the version of my extension that is specified in the vsixmanifest file?
You could use a function like this:
public static Version GetExecutingAssemblyVersion()
{
var ver = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
// read what's defined in [assembly: AssemblyFileVersion("1.2.3.4")]
return new Version(ver.ProductMajorPart, ver.ProductMinorPart, ver.ProductBuildPart, ver.ProductPrivatePart);
}
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
How to detect Windows 64 bit platform with .net?
How do you know if the operating system is x64 or x86 from a c# .net 2.0 windows applicaiton?
Also the applicaiton is 32bit.
Thanks
Use GetEnvironmentVariable to look for the PROCESSOR_ARCHITEW6432 variable. If it doesn't exist, you must be running 32bit:
bool is64bit = !string.IsNullOrEmpty(
Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432"));
EDIT:
Thanks to Hans Passant for pointing out the error in using the PROCESSOR_ARCHITECTURE variable.