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

Nuget package for C++/WinRT 2.0? #25

Closed
johanlindfors opened this issue May 16, 2019 · 15 comments
Closed

Nuget package for C++/WinRT 2.0? #25

johanlindfors opened this issue May 16, 2019 · 15 comments
Labels

Comments

@johanlindfors
Copy link

The latest version of C++/WinRT should have the Nuget package integrated. Is that something we can help with?

@walbourn
Copy link
Owner

This site just hosts a few templates for C++/WinRT related to my GitHub projects. It's not for the official NuGet or [VSIX](https://marketplace.visualstudio.com/items?itemName =CppWinRTTeam.cppwinrt101804264) packages.

What issue are you trying to report?

@johanlindfors
Copy link
Author

Well, since 2.0 of C++/WinRT we are supposed to reference that NuGet package to instead of leveraging the winrt headers included in the Windows SDK, let the cppwinrt compiler generate the headers for each projects.

Mentioned here: https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/news

@johanlindfors
Copy link
Author

I created a small PR draft #26 to demonstrate the suggestion.

@walbourn
Copy link
Owner

You can create an instance of one of the UWP C++/WinRT projects in this GitHub's VSIX and they build fine with the Windows 10 SDK (17763 or later) even if you are not using any NuGet packages.

If you want to use the new C++/WinRT 2.0 generator solution, you can add the Microsoft.Windows.CppWinRT NuGet package to your project and it will use that instead.

That said, you need a fix to Main.cpp from this commit. I'll do a new VSIX tomorrow to include the most recent fixes.

@walbourn
Copy link
Owner

The Microsoft.VisualStudio.WinRT.TemplateWizards issue you mention sounds like a possible return of an old problem in VC that was missing the remaps for older versions of the VSIX components. Do you have the "UWP" workload for VS 2019 installed?

@johanlindfors
Copy link
Author

I though I had, since I pretty much ONLY do UWP development with VS2019...

Will investigate further. Thx!

@walbourn
Copy link
Owner

walbourn commented May 17, 2019

I had an issue with VS 2017 that was fixed in 15.3 that provided redirect bindings for my VS 2015 compatible VSIX:

        <!-- Redirects for Universal app template wizard assemblies -->
        <!-- This is to allow VS 2015 project templates to work correctly in VS 2017 -->
        <dependentAssembly>
          <assemblyIdentity name="Microsoft.VisualStudio.Universal.TemplateWizards" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
          <bindingRedirect oldVersion="14.0.0.0" newVersion="<#= VSGeneralAssemblyVersion #>"/>
        </dependentAssembly>
        <dependentAssembly>
          <assemblyIdentity name="Microsoft.VisualStudio.WinRT.TemplateWizards" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
          <bindingRedirect oldVersion="14.0.0.0" newVersion="<#= VSGeneralAssemblyVersion #>"/>
        </dependentAssembly>

It sounds like these redirects are missing from VS 2019.

@walbourn
Copy link
Owner

Do you have VS 2017 and VS 2019 on the machine that's failing, or just VS 2019?

@johanlindfors
Copy link
Author

Both...

@walbourn
Copy link
Owner

walbourn commented May 17, 2019

Hmmm. It works for me, but I have VS 2015 installed too... Can you file an issue with the VS "File a problem..." feature for the "14.0.0.0" warning? I can then point the PM to that bug.

In order to support VS 2015, VS 2017, and VS 2019 with my VSIX, -and- to leverage the UI for selecting which version of the Windows 10 SDK to use I use that particular built-in template wizard. For VS 2017, they added a rebinding so that my 14.0 ref worked by using the 15.0 version. They appear to need a 14.0 and 15.0 ref for VS 2019 to the 16.0 version of the same wizard.

@walbourn
Copy link
Owner

I released the updated VSIX with the Main.cpp compatible with C++/WinRT 2.0.

@walbourn
Copy link
Owner

So the redirects are already present, so that's not the issue in devenv.exe.config:

        <!-- Redirects for Universal app template wizard assemblies -->
        <!-- This is to allow VS 2015 and VS 2017 project templates to work correctly in VS 2019 -->
        <dependentAssembly>
          <assemblyIdentity name="Microsoft.VisualStudio.Universal.TemplateWizards" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
          <bindingRedirect oldVersion="14.0.0.0" newVersion="16.0.0.0"/>
          <bindingRedirect oldVersion="15.0.0.0" newVersion="16.0.0.0"/>
        </dependentAssembly>
        <dependentAssembly>
          <assemblyIdentity name="Microsoft.VisualStudio.WinRT.TemplateWizards" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
          <bindingRedirect oldVersion="14.0.0.0" newVersion="16.0.0.0"/>
          <bindingRedirect oldVersion="15.0.0.0" newVersion="16.0.0.0"/>
        </dependentAssembly>

@walbourn
Copy link
Owner

Can you find the file Microsoft.VisualStudio.WinRT.TemplateWizards.dll on the impacted system? Mine is located here: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\PrivateAssemblies

Microsoft.VisualStudio.WinRT.TemplateWizards.dll

@walbourn
Copy link
Owner

walbourn commented May 17, 2019

And thanks a lot for the VS bug and help in digging in. Good catch for sure. I never noticed it because I had VS 2015 installed in most cases, but I was able to repro it on my laptop with just VS 2017 + VS 2019.

@walbourn
Copy link
Owner

walbourn commented May 17, 2019

The workaround is to edit devenv.exe.config

        <!-- Redirects for Universal app template wizard assemblies -->
        <!-- This is to allow VS 2015 and VS 2017 project templates to work correctly in VS 2019 -->
        <dependentAssembly>
          <assemblyIdentity name="Microsoft.VisualStudio.Universal.TemplateWizards" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
          <bindingRedirect oldVersion="14.0.0.0-15.0.0.0" newVersion="16.0.0.0"/>
        </dependentAssembly>
        <dependentAssembly>
          <assemblyIdentity name="Microsoft.VisualStudio.WinRT.TemplateWizards" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
          <bindingRedirect oldVersion="14.0.0.0-15.0.0.0" newVersion="16.0.0.0"/>
        </dependentAssembly>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants