Fix Microsoft.AI.MachineLearning .NET5 publishing and C# Store Release build#7373
Merged
Conversation
smk2007
requested review from
martinb35,
orilevari,
ryanlai2,
tiagoshibata and
zhangxiang1993
April 19, 2021 17:07
ryanlai2
approved these changes
Apr 19, 2021
ryanlai2
reviewed
Apr 19, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are 2 fixes in this change.
Issue #1: The Microsoft.AI.MachineLearning package does not publish native binaries to the package output directory automatically.
Reason: This regressed when all of the nuget payload was moved into folders with non-canonical names. This was done to prevent nuget from performing automatic copies, as its logic was getting confused when multiple binaries are produced for the same TFM (static, dynamic crt for native binaries). After moving the files to non-canonical names, all project configuration is now performed by the package itself by including its own targets/props files in the build directory. The copy that was added into the targets file only copied out to the bin directory and not the publish directory, causing the regression.
Fix: The Fix is to call ReferenceCopyLocalPaths on the intended binaries, and that will configure the project to binplace and publish the native binaries.
Issue #2: C# UWP Applications cannot build release because Microsoft.AI.MachineLearning.Experimental.winmd references Windows.AI.MachineLearning.winmd.
Reason: This happened because the core Windows AI API is implemented in a single file Windows.AI.MachineLEarning.idl, and shared between the Inbox implementation and the Redist. However, dependent idls fail to work when referencing Windows.AI.MachineLearning.idl, as import statements are interpretted as winmd references. This causes Release builds to fail, as there is no Windows.AI.MachineLearning.winmd packaged in the redist package.
Fix: The fix is to copy the idls into a separate folder at build, and rename them to Microsoft.* files so that midlrt does not add erroneous winmd references.