Skip to content

To support local servers, use .exe files from dependent projects as Implementation in Microsoft.Windows.CppWinRT.targets - #860

Merged
Chris Guzak (ChrisGuzak) merged 1 commit into
microsoft:user/chrisg/targetfrom
ChrisGuzak:user/chrisg/local_server_dependency
Mar 12, 2021
Merged

To support local servers, use .exe files from dependent projects as Implementation in Microsoft.Windows.CppWinRT.targets#860
Chris Guzak (ChrisGuzak) merged 1 commit into
microsoft:user/chrisg/targetfrom
ChrisGuzak:user/chrisg/local_server_dependency

Conversation

@ChrisGuzak

Copy link
Copy Markdown
Member

I found that if I create a WinRT local server project, a dependent app project won't build due to a missing file referenced in the .appxmanifest (the WinRT local server registration information that I added). The error lead me to this line in the build system that supports .dll dependents, but not .exes. Adding the .exe test fixes this problem and seems appropriate (experts please advise).

With this change a warning is still produced, it seems to to missing support in the .appxmanifest generation support.

warning APPX1708: The executable 'WinRtLocalServer.exe' is specified as the implementation for the .winmd file 'C:\Users\chris\source\repos\ChrisGuzakWork\WinRtLocalServerClient\Debug\WinRtLocalServer.winmd'. 
Only in-process servers are supported for generating registration information in the app manifest. You must specify the out-of-process server registration information in the app manifest.

This can be ignored.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Kenny has indicated that he wants build changes to be validated on the OS, WinUI and Terminal before taking them.

<TargetPath>$([System.IO.Path]::GetFileName('$(CppWinRTProjectWinMD)'))</TargetPath>
<Primary>true</Primary>
<Implementation Condition="'$(TargetExt)' == '.dll'">$(WinMDImplementationPath)$(TargetName)$(TargetExt)</Implementation>
<Implementation Condition="'$(TargetExt)' == '.dll' or '$(TargetExt)' == '.exe'">$(WinMDImplementationPath)$(TargetName)$(TargetExt)</Implementation>

@jlaanstra Johan Laanstra (jlaanstra) Feb 25, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

VS never supported this for CX and so when support for WinRT was added we added the same limitation. We could possibly remove the TargetExt check alltogether. Not sure if you would run into any other roadblocks with that. If this should be a supported scenario, we can add support. A reference to an exe seems weird though.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

local servers are commonly implemented as a .exe (Win32 service is the other option).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Johan Laanstra (@jlaanstra) and Kenny Kerr (@kennykerr) do you have advice on doing an OS and terminal build? Given this did not work before perhaps this is safe enough to not require that (me trying to shirk this work), let me know if you think so.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

😉 I do like the fact that it is a small and targeted change. We've just had a lot of problems with seemingly innocuous changes to the msbuild support that have had surprising compatibility issues in different environments. Johan Laanstra (@jlaanstra) has done this validation a few times - he may have some tips to quickly smoke out any issues.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Chris Guzak (@ChrisGuzak) the way I generally go about this is to replace the CppWinRT props/targets used by a project and then do a full build. For the OS this means replacing the files under tools\cppwinrt (I can share a script I use to build a few known WinRT directories) and for terminal it means replacing the files in the expanded NuGet package under the packages folder and building terminal per instructions in their repo.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Terminal has been validated. working on os.2020 next.

@DHowett

Copy link
Copy Markdown
Member

Terminal confirms success.

@ChrisGuzak
Chris Guzak (ChrisGuzak) changed the base branch from master to user/chrisg/target March 12, 2021 22:47

@ChrisGuzak Chris Guzak (ChrisGuzak) left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

merging into this branch so I can create a C++ WinRT package for testing

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.

4 participants