Skip to content

Conversation

@HLCaptain
Copy link
Contributor

Changed some dependency settings to include all VS22 Community, Pro and Enterprise versions. Works as intended in VS22 Community build 17.0.4. Updated old dependencies to work properly with VS22.

@HLCaptain
Copy link
Contributor Author

@neikeq would be nice to review this one. Issue #19 would be solved.

@neikeq neikeq self-requested a review January 20, 2022 09:51
@neikeq
Copy link
Contributor

neikeq commented Jan 22, 2022

The extension is working as expected in VS2022, but it fails to load in VS2019. This is the error in the activity log:

CreateInstance failed for package [GodotPackage]Source: 'mscorlib' Description: Could not load file or assembly 'Microsoft.VisualStudio.Shell.15.0, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Shell.15.0, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.VisualStudio.Shell.15.0, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)
   at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
   at System.Activator.CreateInstanceFromInternal(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
   at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)

Looks like it's trying to load the VS2022 version of that assembly. Can it be made to work with both versions?

@HLCaptain
Copy link
Contributor Author

This comes from using Microsoft.VisualStudio.SDK 17.x instead of 16.x. If I use 17.x, I can modify and build the project in VS22, but not in 16.x. It simply throws an error, which says it cannot find the proper .dll. If I change it to 16.x, I can build the project with VS19 and slight modifications, but the extension will only install on VS19, not VS22 (not taking into consideration, that it is not capped to VS version 17.0). So we got to a crossroad. This is unfortunate, but 1.1.1 is out, and probably works with VS19. 1.1.2 would only be working with VS22. That means building and using the plugin with VS22. Should I change it to 2.0.0, and update the README.md?

@neikeq
Copy link
Contributor

neikeq commented Jan 23, 2022

I don't think we should drop VS19 support, as it's likely many people are still using that.

I tried changing back the versions for Microsoft.VisualStudio.SDK and Microsoft.VSSDK.BuildTools. I actually had to upgrade Microsoft.VSSDK.BuildTools to 16.9.1050 in order for it to build with VS22 (otherwise, I get a "CompareBuildTaskVersion task not found"). The extension seems to load correctly now, both with VS19 and VS22. I'm getting a MissingMethodException for the OnEnterDesignMode property here:

DebuggerEvents.OnEnterDesignMode -= DebuggerEvents_OnEnterDesignMode;

Not sure if something's messed up with the assembly versions, or if that property was just removed in VS22.

In the worst case, if we can't manage to solve this, I would prefer to have separated project and manifest files for the two versions and distribute two VSIXs.

var mainWindow = dte.MainWindow;
mainWindow.Activate();
SetForegroundWindow(new IntPtr(mainWindow.HWnd));
SetForegroundWindow(mainWindow.HWnd);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't compile when targeting VS19. The following should at least build with both versions:

Suggested change
SetForegroundWindow(mainWindow.HWnd);
SetForegroundWindow((IntPtr)mainWindow.HWnd);

Whether it works in VS22 at runtime when built from VS19, I don't know. If it doesn't, we could use reflection to do the proper conversion on both versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It builds, but the main problems is with installing the extension. This problem is changing with Microsoft.VSSDK.BuildTools or Microsoft.VisualStudio.SDK getting 17.x versions. I would recommend making a 1.1.2 version with VS19 support, which enables either Community, Pro and Enterprise versions to use the extension, and making a 2.0 version with VS22 support. I seperated the two versions locally, which is working right now.

<ProductArchitecture>x86</ProductArchitecture>
</InstallationTarget>
<InstallationTarget Version="[16.0,18.0)" Id="Microsoft.VisualStudio.Enterprise">
<ProductArchitecture>x86</ProductArchitecture>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ProductArchitecture nodes cause a build error on VS19. It's not recognized there. Do we need it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we don't need it. I am working on a solution, which just seperates the VS22 version as 2.x and VS19 version as 1.x, because it would be easier to work with short term. I don't know, how much attention this extension will get, so it would be a quick, not ideal, but practical fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. If I remove the cap, I can build with both VS19 and 22, but it still only installs on VS19 only, with Microsoft.VSSDK.BuildTools set to 16.11.35 and Microsoft.VisualStudio.SDK set to 16.10.31321.278 (kinda the last versions VS19 works with). I assume VS22 works with only Microsoft.VisualStudio.SDK 17.x and Microsoft.VSSDK.BuildTools 17.x.

@HLCaptain
Copy link
Contributor Author

I created a branch called 1.x on my fork, which contains the VS19 usable version of the extension.

@HLCaptain
Copy link
Contributor Author

Maybe I should not have updated the Test's dependencies, reverting these soon.

@neikeq
Copy link
Contributor

neikeq commented Jan 24, 2022

Makes sense if we can't support both versions with the same package. I created the 1.x for VS19.
There are some formatting rule errors that need to be fixed (probably related to BOM and newline at EOF) before merging.
Also, can you remove unnecessary merge commits? If that's too troublesome, I can do a squash merge.

@HLCaptain
Copy link
Contributor Author

Yeah, these merge commits are a bit difficult for me to handle, I don't feel experienced enough. Would be nice if you take care of this.

@neikeq neikeq merged commit 2eb0a05 into godotengine:master Jan 25, 2022
@neikeq
Copy link
Contributor

neikeq commented Jan 25, 2022

Thanks! I've created a release for v2.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants