-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Creating UWP AppxBundle works in VS Store Wizard but fails in msbuild #2445
Comments
@vitek-karas @MattWhilden how best to route this issue? It feel more related to UWP targets than to msbuild itself. |
I've sent this internally to a team in VS to take look... |
@diverdan92 and his team will look into this. |
Just to summarize, the goal is to have a possibility to build UWP .appxupload package from PowerShell in the exactly same way it is created in the VS Store Wizard, ideally just by providing the same data (project, configuration, platform). |
There's one more required parameter. For non-x86 builds the AppxBundlePlatforms value must be passed. In this case: AppxBundlePlatforms="ARM" (the quotes around ARM are important). What was happening here is that the main package would build with ARM, but dependent packages build using the default platform (this is by design). In the end, this will end up dropping Utils.lib in the x86 path while the main project continues to try to build for ARM and winds up searching for the dependency in the wrong place. My commandline looked like this: |
@mirkomuggli Hi, as you can see in the repro I provided above, I pass the proper AppxBundlePlatforms parameter and it still does not work:
Also note that the goal here is to build AppxBundle with both x86 and ARM package - this does not work. If I try to build AppxBundle with just ARM or just x86, it works as expected. |
Very curious. The commandline you shared successfully builds an Arm & x86 .appxUpload with the test app you've provided. If you can, please try this again in the latest VS Preview just to rule out any issues we've recently addressed. Also, please run the same commandline with the following at the end. |
Have you tried the actual sample in my first post? There is nothing wrong with the command, but it does not work with a specific project configuration we have, even thought this project configuration works in the Visual Studio Build for Store wizard. |
I've just tested the msbuild from latest Visual Studio Preview with my repro -> same results, same error. |
@mirkomuggli Hi Mirko, any update on this issue? Have you tried the minimal zip repro for this problem? |
@martinsuchan Hi Martin. I was finally able to track down the issue and am working on a fix. The plan is to roll it out with 15.6. I'll let you know when it's available - in a preview release or otherwise. |
@mirkomuggli Hi, thanks for the update! It's great to hear you were able to reproduce it and it will be fixed. |
Note I've created tracking ticket on the Visual Studio Developer Community web. |
encounter the same issue |
Updated to Visual Studio 2017 15.6 Preview 5 and this issue is still not fixed. cc @mirkomuggli |
There also seems to be an issue here that when I pass in |
For clarification, it appears that the Solution configuration passed in is ignored when building other platforms, and the project configuration is then used as the Solution configuration. E.g. When calling MSBuild with the arguments I worked around my issue for now by copying the project configuration ABC as XYZ for each platform in the UWP project and setting the solution configuration to XYZ|x86 -> XYZ|x86; unfortunately this causes some other unwanted behaviours because (in my case) the configuration is no longer |
The above is, essentially, correct. Because of the way we do multi-architecture builds from the command line the fix is proving exceedingly tricky. |
@mirkomuggli Would a (temporary) solution be to have a property such as SolutionConfiguration which would be set to Configuration if it is not set in Microsoft.AppxPackage.Targets and then use that variable instead of Configuration in the various MSBuild tasks and other places?
Would it be possible to use
to implement this at the solution level, although you would probably have to do something before build in order to add SolutionConfiguration to AdditionalProperties or modify CurrentSolutionConfigurationContents to add the configuration to the SolutionConfiguration XML |
@mirkomuggli You could then add something like
to Microsoft.AppxPackage.Targets and swap all references to |
Hm. that should work. I'll dive into this early next week and report my findings. |
Just a scheduling update, I'm afraid: had a hectic week followed by one spent mostly bedridden. I have an idea for a real fix here, just need to put out some fires first. |
I worked around this issue by passing in Then I added conditional Content tags in my UWP App project's csproj which compare
I have not submitted to the Store yet, but the created AppxBundle looks as expected and contains the native CPP assembly for each platform. |
Hi @mirkomuggli , have you found time to solve this issue? |
Potentially. The flag is: UseSubFolderForOutputDirDuringMultiPlatformBuild Can you give that a try on your end? |
I can confirm setting this flag to 'false' fixed the problem for us. |
I've left more details on the Developer Community ticket, available here: https://developercommunity.visualstudio.com/content/problem/164983/creating-uwp-appxbundle-works-in-vs-store-wizard-b.html |
In working to address issue #xxxx I found the following msbuild command sequence helped me build only what I wanted (x64 vs arm64) when launching mach build -r/-d --uwp. Without the /property:AppxBundle=Always;AppxBundlePlatforms=platform ("x64" | "arm64), the msbuild attempts to build every project (arm/x64/debug/release) within the solution. msbuild /m:4 /p:project=ServoApp .\support\hololens\servoapp.sln /p:SolutionDir=.\support\hololens /p:Configuration="Debug" /p:Platform="x64" /property:AppxBundle=Always;AppxBundlePlatforms="x64" |
Sorry to reference issue #xxxx. Issue I meant to reference is: servo/servo#23753 |
martinsuchan: I'm using your StoreBuildTest.sln from https://1drv.ms/u/s!AlURSa6JiyiVo5FJuYVe4v0k7FSjxQ. So some of the problem lies in the solution macros and the other 2 project's macros (utils and Mainlib). It appears that when you build with the .sln all the macros know where everything is located and you are able to build the utils.lib, followed by mainlib.dll and finally the main app. There are 2 issues/problems: Problem 2 if you build utils.lib using msbuild using: utils.lib is placed in: Resolution: _msbuild /m:4 .\utils\Utils.vcxproj /p:Configuration="release" /p:Platform="x86" /p:AppxBundle=Always;AppxBundlePlatforms="x86" /p:SolutionDir=%CD%\StoreBuildTest\StoreBuildTest\ msbuild /m:4 .\MainLib\MainLib.vcxproj /p:Configuration="release" /p:Platform="x86" /p:AppxBundle=Always;AppxBundlePlatforms="x86" /p:SolutionDir=%CD%\StoreBuildTest\StoreBuildTest_ *msbuild /m:4 mainapp.sln /p:Configuration="release" /p:Platform="x86" /p:AppxBundle=Always;AppxBundlePlatforms="x86" /p:SolutionDir=%CD%\StoreBuildTest\StoreBuildTest* |
@angelortiz1007 Hi, we've already fixed the issue some time ago using the |
We're developing UWP app - main app is built using C#/XAML plus it's referencing several our C++ libs.
Building this app for Store works when using the Store -> Create App Packages Wizard in Visual Studio 2017.
The problem is that we're unable to build our app into AppxBundle using just PowerShell and msbuild.
We'd like to be able to build our app automatically on our build/CI server. We've read thoroughly this article but with no success:
https://docs.microsoft.com/en-us/windows/uwp/packaging/auto-build-package-uwp-apps
The build fails because msbuild is ignoring custom OutDir properties when building the second 'arm' package part for the AppxBundle.
Here is a minimal zip repro for our problem: https://1drv.ms/u/s!AlURSa6JiyiVo5FJuYVe4v0k7FSjxQ
If you open it VS2017 and try to build it using the Store -> Create App Packages wizard, it works as expected.
If you try to run the build.ps1 script, it fails. Note that path to nuget.exe is expected in the PATH env var.
So our question is, how to replicate in PowerShell the identical build process that is used in Visual Studio Create App Packages Wizard? If the project can be build in VS, it should be possible to build it in PowerShell as well.
As far as I know the UapAppxPackageBuildMode=StoreUpload msbuild mode should work exactly like the VS Store Wizard, but it is behaving differently now.
The text was updated successfully, but these errors were encountered: