Skip to content

Conversation

@jlaanstra
Copy link
Contributor

@jlaanstra jlaanstra commented Nov 26, 2019

Since the project templates no longer set the flags that enable the MSBuild logic to tell MSBuild about the CX generated WinMD, we have to override the GetResolvedWinMD target to ensure that VS and MSBuild pick up the correct WinMD project output. Unfortunately the target is not very extensible, so we have to override it.

VS uses this to resolve project output and without this change the PrimaryWinMDFullPath itemgroup is empty resulting in VS being unable to add project references to C++/WinRT projects.

TODO:

  • Verified NuGetTest.sln in VS and using MSBuild.
  • Verified that a C# app can reference and activate types from RuntimeComponent.
  • Verified Razzle builds.

Fixes #425

…nMD. VS uses this to resolve project output.
@jlaanstra jlaanstra requested a review from Scottj1s November 26, 2019 05:57
@Scottj1s
Copy link
Member

I'm a bit nervous about overriding all these internal CX targets. That has the potential to make our nuget brittle (or at least specific to VS versions). What's wrong with the alternative of just setting GenerateWindowsMetadata back to true for the RC project template? You describe that as a "workaround" - how so?

@jlaanstra
Copy link
Contributor Author

These are standard OutputGroup targets, meant to be overriden.

@jlaanstra
Copy link
Contributor Author

@Scottj1s the other option is for us to override the GetResolvedWinMD target, to make it aware of the C++/WInRT WinMD. Thoughts?

@jlaanstra jlaanstra changed the title Fix the WinMDArtifactsOutputGroup to return the C++/WinRT generated WinMD. Override GetResolvedWinMD to make sure all native build targets are aware of the C++/WinRT produced WinMD. Nov 26, 2019
Copy link
Collaborator

@kennykerr kennykerr left a comment

Choose a reason for hiding this comment

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

Have we confirmed that:

  • this allows both C#->C++ project references and
  • activation works in that scenario automatically and
  • a basic Razzle project builds successfully?

@jlaanstra
Copy link
Contributor Author

jlaanstra commented Nov 26, 2019

@kennykerr Added todo's, so you can see what I have verified.

Condition="'$(CppWinRTGenerateWindowsMetadata)' == 'true'"
<!-- This target overrides the GetResolvedWinMD target used to resolve the WinMD for native projects
so it is aware of the C++/WinRT generated WinMD.
Since not every project that consumesd C++/WinRT uses it to generate a WinMD,
Copy link
Member

Choose a reason for hiding this comment

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

typo

@Scottj1s
Copy link
Member

ok, let's give it a spin with vsix/razzle

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.

Unable to add C++/WinRT Runtime Component to UWP C# Application

3 participants