malware-dev / MDK-SE

Malware's Development Kit for SE
MIT License
1.02k stars 123 forks source link

The extension can't warn about too old VS version #67

Closed malware-dev closed 5 years ago

malware-dev commented 6 years ago

I have tried lots of things, but I can't get the visual studio package installer to correctly warn when the user has a too old minor Visual Studio version. At least 15.6 is required. My google-fu has not availed me. If you know how to bend the installer's will to ours, please let me know.

Skimt commented 6 years ago

This was the only topic I found on the subject so you might already have come across it. I haven't done any testing myself as I can't get the MDK-SE solution to work without struggling with various Visual Studio settings and packages that I'm unfamiliar with, but try to have a look at Daniel's response here.

If FileInfo().Directory on line 115 in MDKPackage.cs leads to C:\Users\MyUserName\AppData\Local\Microsoft\VisualStudio\15.0_8fec9514\Extensions then you can maybe go back to the 15.0_8fec9514 folder and grab the version from DotNetVersionCompatibility.json. Alternatively, instead of warning the user when installing the extension, you could maybe look for the version from inside visual studio with AppDomain.CurrentDomain.BaseDirectory which I'm guessing should be where the analyzer is running.

malware-dev commented 6 years ago

The thing is, it's the installer that needs to be configured right. I can't run any code there.

Gwindalmir commented 5 years ago

According to https://msdn.microsoft.com/en-us/magazine/mt493251.aspx you can specify a full build number in the InstallationTarget manifest field, to target an update, so maybe try something like [15.8.28010.0, 16.0). I've never tried that myself, as the only extension I've written works on all versions from 2012-2019.

malware-dev commented 5 years ago

I've tried that, I'm afraid. It doesn't work.

VMSBigot commented 5 years ago

What version does it require? I was looking at this and the odd part is that when you install Visual Studio 2017 RTM(ish) :

VS-Odd

So. its both 15.0 and 15.6? In the About dialog it just shows 15.0 so I'm not really sure what its trying to tell me.

I'd take a stab at it but I just want to verify what exactly the version block needs to be on. When you say 15.6 are you saying RTM, or the sixth release of 2017?

malware-dev commented 5 years ago

The 6th release. The number after 2017.

VMSBigot commented 5 years ago

So, did some poking around. I think the way it works is that you need the build number appended to 15.0. Looking at the build number on https://docs.microsoft.com/en-us/visualstudio/install/visual-studio-build-numbers-and-release-dates?view=vs-2017 I see that 15.6 is build 15.6.27428.1

Appending the build to 15.0 the version tag is "[15.0.27428,16.0)" (e.g, min of 15.6 and block on 16/2019. I am testing this now, and on first pass its now only showing me the 15.9.1 version I have installed but not the 15.0 version. I am going to update my other instance to 15.5 and make sure it doesn't show and then try updating to 15.6 and validate it shows up. I'll submit a PR if the testing works out.

VMSBigot commented 5 years ago

So, forgot how much of a pain it is to try to update VS to anything but "latest".

Reviewing the link @Gwindalmir posted above, the important part is: A square bracket means the value is included. A parenthesis would mean that the value is excluded, so you can also set [11.0,16.0). You can also target a minor version (like 15.3) using the build number (such as 15.0.26208.1).

That does confirm what I kinda figured out by looking at other VSIX packages, that its a odd combonation of "15.0" and the specific build number.

I'll go ahead and do a PR with this change to see if anyone else can test it while I am figuring out how to download a specific VS version. I have validated that 15.0 does not allow it to be installed while 15.9.11 does.

malware-dev commented 5 years ago

I'm sorry, but I have tried the build version.

VMSBigot commented 5 years ago

I found an old VM with 15.4 on it and it also didn't allow the install with that as the targetversion. What did you try for it in the past?

malware-dev commented 5 years ago

I have tried pretty much everything when it comes to numbers

VMSBigot commented 5 years ago

I've submitted https://github.com/malware-dev/MDK-SE/pull/118

I think I've done a fair bit of testing on it and am pretty confident it's the right answer. I validated by using the [ vs ( syntax to key on 15.6.7, and extrapolating from other VSIX's like RedGates and MSFT's Data Tools how it works.

I included the link to get the 15.6.7. Feel free to add me on steam @ vmsbigot. to chat about it if you like.

malware-dev commented 5 years ago

I have not tried your fix yet, but I find it strange that you got this to work since I've tried those numbers. I wonder what I did wrong.

VMSBigot commented 5 years ago

It's Visual Studio. Sometimes there's no right answer ;)

malware-dev commented 5 years ago

Well, whether it works or not - thank you very much for your effort.

VMSBigot commented 5 years ago

I did also validate 15.4.5 never showed up with [ or ( and 2019 also is blocked.

malware-dev commented 5 years ago

@VMSBigot Where did you find this version number? I might have to up the minimum requirement as I'm struggling with the DLL hell Microsoft said wouldn't exist with .NET... :P

malware-dev commented 5 years ago

@VMSBigot I finally figured it out. Apparently - and stupidly - you need to take the disclosed build numbers and 0 out the minor version. 🙄

Thank you so much for your help on this. Thanks to you I've finally gotten this to work.