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

Fix app packaging in UWP #6804

Merged
merged 17 commits into from
Mar 4, 2021
Merged

Fix app packaging in UWP #6804

merged 17 commits into from
Mar 4, 2021

Conversation

tiagoshibata
Copy link
Contributor

Description: Workaround for #6249

Motivation and Context
Nuget supports multi-plarform/multi-architecture packages and Nuget/msbuild picks the correct DLLs from runtimes\ if you follow their naming conventions (available here). But at some point it started copying files from native into UAP builds, causing #6249. I'm not sure if this is a bug in msbuild or our understanding of "native" is incorrect (maybe "native" means supported everywhere, and we should use another moniker for non-UWP? The reference of existing monikers is here).

Anyways, csharp/src/Microsoft.AI.MachineLearning/Microsoft.AI.MachineLearning.targets already handles the logic to choose which DLLs to copy so we should do fine if Nuget doesn't interfere. This PR stops Nuget from messing with our packaging. There isn't a straightforward way to tell Nuget to stop doing it (see discussion and discussion - the supported way is adding some tags to PackageReference, which means the consumers of the Nuget package would have to add a couple of lines to their project), so my proposed workaround is simply renaming the native folder so Nuget doesn't attempt to copy DLLs automatically.

Not following the folder naming convention and doing the copying through msbuild targets is also done in other projects (e.g. see Microsoft's WebView2 and I don't expect it to cause issues.


I tested my changes by locally editing a Nuget package and they fix UWP. I seem to have recently lost permission to queue jobs at aiinfra, so I couldn't do a clean run of the YAML job to see if it's actually producing a valid package. Before merging we should run the Nuget packaging pipeline and test if both UWP and Desktop are fine. I'll be out of office for the next few days, so @smk2007 will likely be the one driving this PR.

@tiagoshibata tiagoshibata requested a review from a team as a code owner February 25, 2021 11:15
ryanlai2
ryanlai2 previously approved these changes Mar 2, 2021
ryanlai2
ryanlai2 previously approved these changes Mar 2, 2021
@smk2007 smk2007 merged commit fa8d1b4 into master Mar 4, 2021
@smk2007 smk2007 deleted the user/ticastro/nuget-uap branch March 4, 2021 19:16
smk2007 pushed a commit that referenced this pull request Mar 24, 2021
* Change msbuild condition for UAP

* update .netcore target as well

* create nuget packages with _native path

* validate path under _native directory for windowsai package

* pep8

* add diagnostic error message

* pep8

* use baseame

* lib\uap10.0

* uap10

* build\\uap10.0

* Manually binplace winmds into appx when PackageReference is used.

* always binplace winmd regardless of packagereference since c# should work with packages.config also

* resolve all paths to full paths to avoid some reference warnings

* move winmds out of lib folder to prevent automatic component registration

Co-authored-by: Sheil Kumar <[email protected]>
smk2007 added a commit that referenced this pull request Mar 29, 2021
…rning Package (#7129)

* Fix app packaging in UWP (#6804)

* Change msbuild condition for UAP

* update .netcore target as well

* create nuget packages with _native path

* validate path under _native directory for windowsai package

* pep8

* add diagnostic error message

* pep8

* use baseame

* lib\uap10.0

* uap10

* build\\uap10.0

* Manually binplace winmds into appx when PackageReference is used.

* always binplace winmd regardless of packagereference since c# should work with packages.config also

* resolve all paths to full paths to avoid some reference warnings

* move winmds out of lib folder to prevent automatic component registration

Co-authored-by: Sheil Kumar <[email protected]>

* Only set _native folder for Microsoft.AI.MachineLearning package (#6939)

* only set _native folder for Microsoft.AI.MachineLearning package

Co-authored-by: Sheil Kumar <[email protected]>

Co-authored-by: Tiago Koji Castro Shibata <[email protected]>
Co-authored-by: Sheil Kumar <[email protected]>
Co-authored-by: Changming Sun <[email protected]>
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.

5 participants