Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VS 2022 VSIX support #960

Closed
sylveon opened this issue Jun 18, 2021 · 54 comments · Fixed by #968, #989 or #1045
Closed

VS 2022 VSIX support #960

sylveon opened this issue Jun 18, 2021 · 54 comments · Fixed by #968, #989 or #1045
Assignees

Comments

@sylveon
Copy link
Contributor

sylveon commented Jun 18, 2021

Now that VS 2022 is out in preview, the cppwinrt extension won't install on it since it explicitly excludes version 17.0.

The manifest should be updated and we also need to update the project to use the NuGet package for the Visual Studio SDK since it isn't included directly in VS anymore.

#918 already uses a NuGet package for the SDK, and if somebody has to spend the time to make a new version compatible with VS 2022, we might as well merge enhancements like that PR and #924.

@kennykerr
Copy link
Collaborator

FYI @BenJKuhn

@DefaultRyan DefaultRyan self-assigned this Jun 18, 2021
@DefaultRyan
Copy link
Member

I'm taking a look at this.

@walbourn
Copy link
Member

walbourn commented Jun 18, 2021

Note that with the transition to a 64-bit only IDE, there a few potential issues here you should be aware of. See Microsoft Docs for details.

@asklar
Copy link
Member

asklar commented Jul 6, 2021

@DefaultRyan you fixed this already right?

@rpavlik
Copy link

rpavlik commented Jul 6, 2021

I couldn't get this to work at the end of last week, not even just placing the natvis file and dll in the appropriate directories, so I'm guessing it's not fixed, or at least not released.

@DefaultRyan
Copy link
Member

I've made the needed code changes, but an updated VSIX hasn't been pushed yet.

@DefaultRyan DefaultRyan linked a pull request Jul 6, 2021 that will close this issue
@rpavlik
Copy link

rpavlik commented Jul 8, 2021

I've downloaded and tried to install it, but the latest vsix never finishes installing successfully into 17 preview:

7/8/2021 1:25:17 PM - Beginning to install extension to Visual Studio Professional 2022 Preview...
7/8/2021 1:25:17 PM - Upgrading 'C++/WinRT', version 2.0.210505.3 to version 2.0.210707.1.
7/8/2021 1:25:19 PM - Skipping non-applicable package Microsoft.VisualStudio.Debugger.DbgHelp.Win8: The current OS Version '10.0.19042.0' is not in the supported version range '[6.1,6.3]'.
7/8/2021 1:25:19 PM - Skipping non-applicable package Microsoft.VisualStudio.Debugger.Remote.DbgHelp.Win8: The current OS Version '10.0.19042.0' is not in the supported version range '[6.1,6.3]'.
7/8/2021 1:25:19 PM - Skipping non-applicable package Microsoft.VisualStudio.Debugger.Remote.DbgHelp.Win8: The current OS Version '10.0.19042.0' is not in the supported version range '[6.1,6.3]'.
7/8/2021 1:25:20 PM - Skipping non-applicable package Microsoft.Windows.UniversalCRT.Msu.8: The current OS Version '10.0.19042.0' is not in the supported version range '[6.2,6.3)'.
7/8/2021 1:25:20 PM - Skipping non-applicable package Microsoft.Windows.UniversalCRT.Msu.81: The current OS Version '10.0.19042.0' is not in the supported version range '[6.3,6.4)'.
7/8/2021 1:25:20 PM - Skipping non-applicable package Microsoft.Net.4.8.FullRedist: The current OS Version '10.0.19042.0' is not in the supported version range '[6.1.1,10.0.17763]'.
7/8/2021 1:25:20 PM - Skipping non-applicable package Microsoft.Net.4.8.KB5003306: The current OS Version '10.0.19042.0' is not in the supported version range '[10.0.18362,10.0.18363]'.
7/8/2021 1:25:20 PM - Skipping non-applicable package Microsoft.Net.4.8.KB5003793: The current OS Version '10.0.19042.0' is not in the supported version range '[10.0.20279,10.0.20348]'.
7/8/2021 1:25:20 PM - Skipping non-applicable package Microsoft.Net.4.8.KB5003792: The current OS Version '10.0.19042.0' is not in the supported version range '10.0.21290'.
7/8/2021 1:25:20 PM - Skipping non-applicable package Microsoft.VisualStudio.NuGet.PowershellBindingRedirect: The current OS Version '10.0.19042.0' is not in the supported version range '[6.1,6.2)'.
7/8/2021 1:25:20 PM - Skipping non-applicable package Microsoft.Windows.UniversalCRT.Msu.7: The current OS Version '10.0.19042.0' is not in the supported version range '[6.1,6.2)'.
7/8/2021 1:25:21 PM - Skipping non-applicable package Microsoft.DiagnosticsHub.KB2882822.Win7: The current OS Version '10.0.19042.0' is not in the supported version range '[6.1,6.2)'.
7/8/2021 1:25:21 PM - Skipping non-applicable package Microsoft.Ancm.IIS.Msi: Required conditions are not satisfied: IISCoreWebEngineInstalledx64 And IISW3SvcInstalledx64
7/8/2021 1:25:21 PM - Skipping non-applicable package Microsoft.Ancmv2.IIS.Msi: Required conditions are not satisfied: IISCoreWebEngineInstalledx64 And IISW3SvcInstalledx64
7/8/2021 1:25:21 PM - Skipping non-applicable package Microsoft.Azure.PowerShell: Required conditions are not satisfied: Not Powershell5
7/8/2021 1:25:22 PM - Skipping non-applicable package Microsoft.VisualStudio.OfficeDeveloperTools.WindowsIdentityFoundation.Msu: The current OS Version '10.0.19042.0' is not in the supported version range '(,6.2)'.
7/8/2021 1:25:46 PM - pkgCatalogPath is 'C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PREVIEW\COMMON7\IDE\EXTENSIONS\PHEUPZIY.IIL\catalog.json'.
7/8/2021 1:25:48 PM - vsPkg.Version is '2.0.210505.3'.  extension.Header.Version is '2.0.210505.3'
7/8/2021 1:25:49 PM - Unable to find component in product catalog with this ID: Component.Microsoft.Windows.CppWinRT,version=2.0.210505.3
7/8/2021 1:25:49 PM - Install Error : System.InvalidOperationException: A value for 'Component' needs to be specified in the catalog.
   at Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.PerformSetupEngineUnInstall(IInstalledExtension extension, InstallFlags installFlags, Boolean downgrade)
   at Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.UninstallInternal(IInstalledExtension extension, Boolean forceDelete, Version targetedVSVersion, InstallFlags installFlags, Boolean downgrade)
   at Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.CommitInstalledAndUninstalledExtensions(IEnumerable`1 installedExtensions, IEnumerable`1 uninstalledExtensions, IEnumerable`1 packComponentChanges, Version targetedVSVersion, InstallFlags installFlags)
   at Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.BeginInstall(IInstallableExtension installableExtension, InstallFlags installFlags, AsyncOperation asyncOp, Version targetedVsVersion)
   at Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.InstallWorker(IInstallableExtension extension, InstallFlags installFlags, AsyncOperation asyncOp)

For some reason, it also doesn't even notice the VS2019 Community that's also installed.

I have tried doing a "repair" of both VS installs, but the error persists.

@kennykerr
Copy link
Collaborator

I've made the needed code changes, but an updated VSIX hasn't been pushed yet.

@DefaultRyan we've since shipped VSIX updates. Is there still a problem here?

@JuanMejiaVelez
Copy link
Member

This continue to fail to install for Dev17 P3.
Latest vsix version package is 2.0.210714.1, either, trying to install from within VS or downloading the VSIX package from the VS Gallery fails.

dd_VSIXInstaller_20210720215732_2c34.log

@DefaultRyan
Copy link
Member

I haven't been able to reproduce this problem on my end. I'll ask the Visual Studio folks about this.

@raffaeler
Copy link

Don't know if this is related.
My versions:

  • cppwinrt: 2.0.210714.1
  • VS2022 Preview 2.0

@aloneguid
Copy link

Same issue, attaching install log
dd_VSIXInstaller_20210723162943_3b70.log.

Relevant section:

23/07/2021 16:29:52 - A cycle was detected in the dependency graph: 
  Microsoft.VisualStudio.ComponentGroup.UWP.VC
  ---> Microsoft.VisualStudio.ComponentGroup.UWP.VC
23/07/2021 16:29:52 - Install Error : Microsoft.VisualStudio.Setup.Dependencies.DependencyGraphConstructionException: A cycle was detected in the dependency graph: 
  Microsoft.VisualStudio.ComponentGroup.UWP.VC
  ---> Microsoft.VisualStudio.ComponentGroup.UWP.VC
   at Microsoft.VisualStudio.Setup.Engine.GetProductDependencyGraph(Product product, Boolean overwrite)
   at Microsoft.VisualStudio.ExtensionManager.SetupEngineService.get_GetProductDependencyGraph()
   at Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.PerformSetupEngineInstall(InstallableExtensionImpl extension, Boolean installPerMachine, Boolean isPackComponent, IDictionary`2 extensionsInstalledSoFar, List`1 extensionsUninstalledSoFar, IInstalledExtensionList modifiedInstalledExtensionsList, IProgress`1 progress, InstallFlags installFlags, AsyncOperation asyncOp, Version targetedVsVersion, IInstalledExtension& newExtension)
   at Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.InstallInternal(InstallableExtensionImpl extension, InstallFlags installFlags, IDictionary`2 extensionsInstalledSoFar, List`1 extensionsUninstalledSoFar, IInstalledExtensionList modifiedInstalledExtensionsList, AsyncOperation asyncOp, IProgress`1 progress, Version targetedVsVersion)
   at Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.BeginInstall(IInstallableExtension installableExtension, InstallFlags installFlags, AsyncOperation asyncOp, Version targetedVsVersion)
   at Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl.InstallWorker(IInstallableExtension extension, InstallFlags installFlags, AsyncOperation asyncOp)
```

@DefaultRyan
Copy link
Member

The cyclic dependency issue is being tracked here and somebody on the VS team is testing the fix. We'll also make a tweak to the cppwinrt VSIX in conjunction with their fix.

For @rpavlik's issue, had you already updated the VSIX to version 210505 previously? Have you tried uninstalling and reinstalling the extension?

@rpavlik
Copy link

rpavlik commented Jul 23, 2021

I hadn't ever successfully installed the vsix, I thought, but apparently I had gotten it installed somehow well enough to have updates suggested. Since I first chimed in, I (semi-accidetnally) ran the setup cleanpu program and have thus re-installed all my visual studios (thinking I had broken something that was preventing the upgrade to Preview 2.0), and now I can try to install the vsix thru extension manager at which point I get the cyclic dependency error now. So, the other one may have been from a weird slightly mangled install.

@DefaultRyan
Copy link
Member

Thanks for letting us know. The cyclic dependency fix will be in some future update of Visual Studio 2022. I'll be making a related fix to our VSIX to help prevent this going forward.

@kennykerr
Copy link
Collaborator

Many developers are hitting this issue and Visual Studio seems to think its not their issue. I've closed a few other issues as duplicates of this one.

@kennykerr
Copy link
Collaborator

It looks like the new Windows App SDK / WinUI projects have their own VSIX with similar project templates:

https://marketplace.visualstudio.com/items?itemName=ProjectReunion.MicrosoftProjectReunion

I expect those to be well supported. The cppwinrt repo will likely remain focused on the C++/WinRT library and code generator (that WinUI depends on) while the C++/WinRT VSIX will eventually be removed. I don't see any value in maintaining redundant project templates and we clearly don't have the resources to maintain the C++/WinRT VSIX support.

Thoughts? Is there anything that would be missing with a switch to the Windows App SDK VSIX?

@asklar
Copy link
Member

asklar commented Aug 13, 2021

@kennykerr the Windows App SDK VSIX does not enable devs to write apps against system xaml, the C++/WinRT VSIX is the only option, so we should keep both.
One idea would be for the C++/WinRT VSIX to move to the xaml repo and be renamed "UWP XAML VSIX".

@kennykerr
Copy link
Collaborator

Sounds good. Why doesn't the WinUI / WindowsAppSDK VSIX just provide a template for that? Then it can be the one-stop-shop for Windows app development.

@asklar
Copy link
Member

asklar commented Aug 13, 2021

with WindowsAppSDK, you'd normally use WinUI 3 instead of system xaml. The two are incompatible.

@kennykerr
Copy link
Collaborator

Sure, hence different project templates. 😉

@dmgoodridge
Copy link

This problem was not resolved in Preview 4.0 for my VS 2022 install.

@shelllet
Copy link

This problem was not resolved in Preview 4.0 for my VS 2022 install.

I couldn't agree more!

@shelllet
Copy link

when I type #include <winrt/ , vs 2022 preview 4.0 will crush. Upgrading to preview 4.0 made me burst into tears.

@ghost
Copy link

ghost commented Sep 15, 2021

I was eagerly waiting for preview 4, installed it, BOOM! Disappointment ;-(

@BenJKuhn
Copy link
Member

BenJKuhn commented Sep 15, 2021

We'll continue to investigate and work with VS on the issue. I'm not sure this is a C++ /WinRT issue though, per se. I was able to repro the crash, and it happens when VS is suggesting files for auto-completion when you type "#include <winr"

Specifically, typing the "r" in that line triggers the crash. "#include <wina" will trigger the same crash but "#include <wind" will not. If I paste in "#include <winrt/" and start typing from there, I can get file suggestions, complete the include line, and start using the types that were included without issue. It also only repro's with <>, not with "". There are various other ways to "dodge" the crash. I tried playing with a few Intellisense settings in options to try to isolate further, but wasn't getting anywhere.

In any case, that's a horrible workaround to have to live with, but hopefully it's enough to get you all unblocked from going a bit further in exploring 2022 preview 4 while we continue to work the issue.

Ben

@BenJKuhn
Copy link
Member

Thanks @ByronAP, @DefaultRyan and I talked this morning. I'd lost track of the fact that there are now two separate issues, one with Intellisense and one with a dependency graph issue in updating from marketplace. Ryan will communicate the Intellisense issue to VS, and we'll continue to use this issue to track the dependency graph problems.

@DefaultRyan
Copy link
Member

I made a test build of the VSIX by removing the prerequisite on Microsoft.VisualStudio.ComponentGroup.UWP.VC (commit here).

Instead of the cyclic dependency error, I hit a new error. I've uploaded the log, and here are some of the relevant snippets:

9/16/2021 10:52:29 AM - Beginning to install extension to Visual Studio Enterprise 2022 Preview...
9/16/2021 10:52:29 AM - Upgrading 'C++/WinRT', version 2.0.210806.1 to version 2.0.210914.3.
9/16/2021 10:52:37 AM - Package 'Microsoft.Windows.CppWinRT,version=2.0.210914.3' failed to install. System.IO.IOException: The file 'C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Application Type\Windows Store\10.0\Platforms\ARM\ImportAfter\Microsoft.Cpp.CppWinRT.props' already exists.
   at Microsoft.VisualStudio.Setup.Installer.VsixInstaller.<InstallCoreInternal>g__install|31_1(PackagePart part, Boolean saveExtensionManifest, <>c__DisplayClass31_0& , <>c__DisplayClass31_1& , <>c__DisplayClass31_2& , <>c__DisplayClass31_3& , <>c__DisplayClass31_4& )
   at Microsoft.VisualStudio.Setup.Installer.VsixInstaller.InstallCoreInternal(String localPath, String installDir, InstallablePackage pkg)
   at Microsoft.VisualStudio.Setup.Installer.FileInstaller.<>c__DisplayClass7_0.<InstallCore>b__0()
   at Microsoft.VisualStudio.Setup.Installer.FileInstaller.DoAction(Func`1 action)
   at Microsoft.VisualStudio.Setup.Installer.FileInstaller.InstallCore(String localPath, String installDir, InstallablePackage pkg)
   at Microsoft.VisualStudio.Setup.Installer.InstallerBase.InstallHelper(InstallData installData)
9/16/2021 10:52:37 AM - Skipping cache of package 'Microsoft.VisualStudio.Component.VC.CoreBuildTools,version=17.0.31709.181' since the package or a parent package had a vital failure.
9/16/2021 10:52:37 AM - Skipping cache of package 'Component.Microsoft.Windows.CppWinRT,version=2.0.210914.3' since the package or a parent package had a vital failure.
9/16/2021 10:52:56 AM - Install Error : System.AggregateException: One or more errors occurred. ---> Microsoft.VisualStudio.Setup.PackageFailureException: Package 'Microsoft.Windows.CppWinRT' failed to install

dd_VSIXInstaller_20210916105151_3458.log

@tim-weis
Copy link

The issue is still there for me on Visual Studio 2022 Preview 4.1.

@lufog
Copy link

lufog commented Sep 22, 2021

Same

@DefaultRyan
Copy link
Member

For the intellisense issue, it's clearly a Visual Studio bug, and I filed a feedback item at https://developercommunity.visualstudio.com/t/ideintellisense-crash-when-including-cwinrt-header/1532185. Feel free to upvote that issue.

Their system recently closed it as a duplicate of https://developercommunity.visualstudio.com/t/VS-Crashes-when-adding-include-tcharh-f/1519874, but I believe that's incorrect. Our issue appeared in Preview 4, while the duplicate says it was fixed in Preview 4.

@raffaeler
Copy link

As far as I understand you should ask to reopen the issue as author.
All the others can't even upvote.

@DefaultRyan
Copy link
Member

On the "closed as duplicate" comment, I was able to react "No: This is a different issue". I was unable to directly reopen as the author. Is it possible for people to vote on that reaction?

I'm also going to follow up directly with the folks that currently own the feedback item.

@raffaeler
Copy link

I tried to but my comment does not appear. Don't know if this is a glitch in the reporting system or it does not accept that.
The feedback system is not very smart, I had a lot of (other) issues in the past.

@DefaultRyan
Copy link
Member

Update: I just upgraded from VS2022 Preview 4 to VS2022 Preview 4.1. The Intellisense bug appears to be resolved in 4.1. Does that track with others experience?

@tim-weis
Copy link

@DefaultRyan The scenario described by Ben in an earlier comment does not crash the IDE for me with Preview 4.1.

@JuanMejiaVelez
Copy link
Member

Still failing to install, version 2.0.210922.5 on Dev 17 Preview 5

@ghost
Copy link

ghost commented Sep 24, 2021

latest VSIX won't install, preview 4.1
Screenshot 2021-09-24 185725

@Jisu-Woniu
Copy link

Feel like the component in the dialog is the source of this problem.

@microsoft microsoft deleted a comment from ByronAP Oct 1, 2021
@DefaultRyan
Copy link
Member

Couple of updates, and a clarification. First, the clarification:

The bulk of C++/WinRT's functionality is provided by the CppWinRT NuGet package. This includes the cppwinrt compiler and the MSBuild logic to wire things up.

The only functionality provided by the VSIX is the project templates and the debug visualizer. Those project templates create a project with a reference to the CppWinRT NuGet package. Both the project templates and debug visualizer are largely stable, rarely receiving updates. So even when using an older VSIX, you can easily upgrade to the latest and greatest C++/WinRT support by simply upgrading your project(s) NuGet references to the latest version.

In fact, the long term intention is for developers to migrate from the C++/WinRT project templates, to the C++ project templates in the Windows App SDK.

@DefaultRyan
Copy link
Member

DefaultRyan commented Oct 5, 2021

Regarding the current state of the VSIX:

We'll continue to support the C++/WinRT marketplace extension for now, but just for VS2019. For VS2022, you get the same functionality right out of the box from the Visual Studio Installer. If/when we update the project templates or visualizer in the future, we'll ensure those updates appear in the next Visual Studio update.

So there's no need to download and install the marketplace extension for VS2022.

I'm still working with the Visual Studio folks to root cause the source of the errors we're seeing when trying to install the marketplace VSIX to a VS2022 instance. I performed an experiment with the VSIX to remove some prerequisites, and hit another roadblock with the VSIX installer not able to reconcile the C++/WinRT files included by Visual Studio with the C++/WinRT files coming from the marketplace VSIX. I've been told that this can be worked around by downloading the VSIX, opening an admin command prompt, and using the -force option to bypass some of the errors ([VS Install Dir]\Common7\IDE\VSIXInstaller.exe -force Microsoft.Windows.CppWinRT.vsix).

Once we solve those issues, and if the need arises for a VS2022-compatible standalone VSIX in the marketplace, I'll get one uploaded.

But in the meantime, VS2022 users should continue using the C++/WinRT extension supplied by the VS Installer, and update their NuGet references as needed. I'll also be updating the marketplace VSIX to target only VS2019, to help prevent further confusion.

@sylveon
Copy link
Contributor Author

sylveon commented Oct 5, 2021

I've had issues with the built-in templates of VS 2022 using a version of cppwinrt that didn't exist on NuGet, but apparently existed locally.

This prevented even upgrading the NuGet without going in the vcxproj and packages.config file.

@DefaultRyan
Copy link
Member

I've had issues with the built-in templates of VS 2022 using a version of cppwinrt that didn't exist on NuGet, but apparently existed locally.

This prevented even upgrading the NuGet without going in the vcxproj and packages.config file.

That was a problem in the initial attempt at VS integration, where the inbox VSIX mistakenly didn't have a matching public release, so the NuGet restore failed in weird ways. That's no longer the case, and I'm ensuring that every update to the VS-integrated C++/WinRT will use a publicly available release.

In fact, just now, I successfully updated a project from the 2.0.210806.1 NuGet included in VS2022 Preview 4 to the latest public available 2.0.210930.14.

@asklar
Copy link
Member

asklar commented Oct 6, 2021

one thing to note is that the winappsdk templates will bind the app or component to winappsdk and therefore to winui3. I think it is reasonable to assume that a dev should be able to use VS 2022 to write apps and runtime components that use system xaml / WinUI 2.x.
@DefaultRyan agree?

@DefaultRyan
Copy link
Member

Yes, I think that's a good point. I'll reiterate that I'm not aware of any plans to remove the existing C++/WinRT templates. I was speaking more of the long-term aspirations that devs would gradually migrate to winappsdk (ideally because it becomes the new hotness).

@malkia
Copy link

malkia commented Oct 15, 2021

I'm hitting the same issue with VS2022,

C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Microsoft\VC\v160\Platforms\Win32\ImportBefore\Microsoft.Cpp.CppWinRT.props(9,5): error MSB4019: The imported project "C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Microsoft\VC\v170\Microsoft.Cpp.CppWinRT.props"
 was not found. Confirm that the expression in the Import declaration "C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Microsoft\VC\v170\\Microsoft.Cpp.CppWinRT.props" is correct, and that the file exists on disk. [D:\p\dotnet\wpf\src\Microsoft.DotNet.Wpf\src\WpfGfx\core\dll\
wpfgfx.vcxproj]

looking through it, this is what I have there: ```

<Import Project="$(VCTargetsPath)\Microsoft.Cpp.CppWinRT.props" />

```

so I did something terrible, and commented the import out :) - it... works now...

@DefaultRyan DefaultRyan linked a pull request Oct 21, 2021 that will close this issue
@DefaultRyan
Copy link
Member

I now have pull request #1045 up, which splits the VSIX into VS2019 and VS2022 specific flavors. We'll continue updating the marketplace extension for VS2019 in the same way as before. For VS2022, we'll update the extension via Visual Studio updates.

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