How to read the version of an installed VSPackage [duplicate] - c#

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);
}

Related

How to make an installable .Net console app [duplicate]

This question already has answers here:
C# set environment variable
(2 answers)
Ways to deploying console applications in C#
(5 answers)
Closed 4 years ago.
How can I make my console app installable so that when I open CMD I can run it from anywhere with a keyword. Like when I type in git in cmd for example. Thanks.
For this, you need to set up an environment variable called PATH. In Windows, it is in the registry. But for Mac or Linux you may want to update the .bash_profile file.
You can use the following function
SetEnvironmentVariable(String, String)
Here is the link for the MSDN .net core API
Then again I haven't tried this before. But hope this helps you out.

Is it possible to decomplie any exe to .net source code (Visual studio) [duplicate]

This question already has answers here:
How do I decompile a .NET EXE into readable C# source code?
(9 answers)
Closed 5 years ago.
I have an exe file which is written in .net language . I have no source code for same but I want to change some functionality in this so convert it to visual studio source code. is there any way to do this?
have a look on IL Spy-
https://www.gallery.expression.microsoft.com/8ef1d688-f80c-4380-8004-2ec7f814e7de
Also you can download it from here-
http://sourceforge.net/projects/sharpdevelop/files/ILSpy/2.0/ILSpy_Master_2.1.0.1603_RTW_Binaries.zip/download.
Just unzip the contents in a folder somewhere - no installer. Then run ILSpy.exe.

HttpUtility.HtmlDecode() [duplicate]

This question already has answers here:
HttpUtility does not exist in the current context
(10 answers)
Closed 5 years ago.
I'd like to use HttpUtility.HtmlDecode() to process some strings in my application, but for some reason Visual Studio doesn't seem to know where it's at.
I'm fairly new to C# so I'm just guessing I've missed something like importing a library, but I don't even know what to Google.
I've tried using System.Web but it only seems to contain AspNetHostingPermission and friends, no HttpUtility.
I'm using VS2015 Community Edition on a Windows 10 machine.
I've tried "using System.Web" but it only seems to contain "AspNetHostingPermission" and friends, no HttpUtility.
You simply need to reference the DLL System.Web, right click References > Add Reference > Assemblies > Framework > System.Web
Also check you're not targeting the Client Profile, in which System.Web.dll is not available. You can target the full framework in Project Properties.

How to detect a running MSI Installation [duplicate]

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

Get App Version Number [duplicate]

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;

Categories