How to fix a packaged WinUI3 app build, what makes trouble with ProcessorArchitecture? - azure-devops

Today i'm trying to build a .NET 6 WinUI3 App in AzureDevOps. My csproj contains:
<TargetFramework>net6.0-windows10.0.22000.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>MyApp</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;arm64</Platforms>
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<PublishProfile>Properties\PublishProfiles\win10-$(Platform).pubxml</PublishProfile>
<UseWinUI>true</UseWinUI>
<EnableMsixTooling>true</EnableMsixTooling>
<ApplicationIcon>Assets\2764a994e49c43a2932b6d7f465e99eb.ico</ApplicationIcon>
<PlatformTarget>x64</PlatformTarget>
As "Build Platform" i have defined in Pipelines variable "x64". As error i become:
[error]C:\Users\VssAdministrator.nuget\packages\microsoft.windowsappsdk\1.1.2\buildTransitive\Microsoft.Build.Msix.Packaging.targets(1016,5): Error : Packaged .NET applications with an app host exe cannot be ProcessorArchitecture neutral. Please specify a RuntimeIdentifier or a Platform other than AnyCPU.
I'm wondering why this happens and how to fix it?

I figured this out! In Visual Studio, right click on your solution and click properties. For me, a few of the projects didn't have a Platform selected. I changed them all to x64 and the build succeeded. Hope this helps.

Related

DLL functionality stops working in UWP app after being packaged into an appx package

I'm currently having a problem where the functionality of a dll fails to work in my UWP app after packing it into an appx package and sharing it, but it works in a deployment.
Details:
The project itself is built in Unity and is meant to be used on a HoloLens 2. I'm building the Unity project with ARM architecture and it builds as a Visual Studio Solution, and I currently use Visual Studio 2019.
This is where the problem gets confusing. I can deploy the application directly to the HoloLens 2 through VS and the project works with 100% functionality and the dll has no issues. But whenever I create an appx package for the project and send it to the other user, the app will work fine only up until the dll functionality is supposed to happen. And it doesn't cause any error or crash, it just doesn't do anything.
I know dll issues can be a mystery, but I was hoping someone else may have encountered this or can see where I'm going wrong. I made sure to resign the dll's certificate with the same one used for the Unity project and check if any dependencies could be missing, but they all seem to be inherent Windows libraries (which we've installed the respective Microsoft Visual c++ redistributable to make sure that wasn't the problem).
To add some more details that may raise alarms: I compress the folder that the appx package is in to share it, the other user is using a different HoloLens 2, and I share the zip through OneDrive.
Thanks for any help!
Solved the issue! Turns out it was not a dll specific problem. The other device did not have access to read a required file which we found out by looking at the logs on his device. We were able to change the functionality of reading this file and now it works. Thanks for all the help!

Error compiling MAUI project - missing MonoAOTCompiler.Task

I'm creating a MAUI application targeting iOS and Android. I have been using Visual Studio 2022 for Mac version 17.3. That version doesn't really support archiving the app, so I installed version 17.4 preview 2.1. When I try to compile my app I get the following error:
Unable to find Microsoft.NET.Runtime.MonoAOTCompiler.Task
I found a post that indicated I should run the command:
dotnet add package Microsoft.NET.Runtime.MonoAOTCompiler.Task --version 7.0.0-rc.2.22472.3
When I run that command in terminal I get the error:
error: Value cannot be null. (Parameter 'version')
Everything I have found indicated that the problem should have been fixed in Preview 2.1 of Visual Studio 2022 for Mac, but it is still occurring.
Can anyone help me resolve this? I need to publish my app to the stores and can't get it to compile in release mode or create the archive because of that.
You need to add the package to your project.
First, you should right click your project name and choose the Manage Nuget packages button.
Second, you can search the package Microsoft.NET.Runtime.MonoAOTCompiler.Task and install it.
Then you successfully add the package to your project.

What should I do if the tool package fails to run when I integrate the HUAWEI AppGallery Connect SDK to Eclipse?

I had recently planned on integrating the Crash SDK to my app. However, my app was developed through Eclipse and the integration process was different from that in Android Studio.
By referring to the official materials, I downloaded the tool package and used it to generate an Eclipse project package.
However, when the build.bat file in the aar2eclipse/aar directory was executed according to the procedures in the document, an error was reported in the command line. The error information was as follows:
FAILURE: Build failed with an exception.
What went wrong:
Task ' assembleRelease ' not found in root project ' aar '.
[![enter image description here][1]][1]
I first thought that the problem might be caused by my company's intranet. But when I connected to the Internet, the problem remained unsolved.
Then I guessed that it might have something to do with the Android development environment.
I borrowed a colleague's PC to execute the build.bat file, and it that did the trick. Therefore, I was able to conclude that the problem was caused by incorrect configurations in the Android development environment. I compared the configurations on the two PCs and found that the environment variables were different. ANDROID_HOME was missing from the environment variables on my PC.
Cause
Huawei's Eclipse tool package is unable to run properly and reports an error without the ANDROID_HOME variable.
Solution: Right-click This PC and choose Properties from the shortcut menu. In the displayed dialog box, click the Advanced System Settings tab and then click Environment Variables. In the System Variables dialog box, create a new ANDROID_HOME parameter.
Set the value to the installation path of the local Android SDK, and the problem will be resolved, as shown below.
Reference:
https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-get-started#h2-1587519820720

I'm not getting an .exe for my game after building?

I am new to Unity3D and have been building a zombie survival game for my university course. My issue is after building my game I am not given a .exe file.
Some of the things I have already tried:
Reinstalling Unity
Spoke to my tutor who said I had missed out on some components needed when installing Unity - UWP Build Support (.NET) & UWP Build Support (IL2CPP). Reinstalled Unity with these components, still no .exe file.
Posted this question on the Unity Community - still waiting for an answer.
Try to reinstall unity with a different version or to change machine probably there are problems with your set up
Try to build without checking the Create Visual Studio Solution checkbox
File > Build Settings… is the menu item to access the Build Settings window
It’s simply a matter of choosing the build target in the build settings dialog, and hitting the ‘Build’ button. When building standalone players, the resulting files will vary depending on the build target. For the Windows build target, an executable file (.exe) will be built, along with a Data folder which contains all the resources for your application. For the Mac build target, an app bundle will be built which contains the file needed to run the application as well as the resources.
(you may have to complete your options in player settings or probably you missed to select platform)

error CS0234: The type or namespace name `iOS' does not exist in the namespace `UnityEditor'. Are you missing an assembly reference?

I have installed the latest versions of Unity (2017.3.1), Daydream SDKs (GVR SDK for Unity v1.130.0) and followed the steps here: https://developers.google.com/vr/develop/unity/get-started#configure_build_settings_and_player_settings
However when I press Play I get the following error, ideas on what is the reason & how to fix it?
Assets/GoogleVR/Editor/GvrBuildProcessor.cs(20,19): error CS0234: The type or namespace name 'iOS' does not exist in the namespace 'UnityEditor'. Are you missing an assembly reference?
Edit: Issue fixed after a few hours of submission on GitHub with the release of GVR SDK for Unity v1.130.1
If you're facing with this problem there are 2 steps to solve it:
Make sure that "iOS Build Support" is checked in Unity Hub -> Installs as Adam mentioned (if U're developing for iOS platform then this option most definitely is already checked).
Place your script in Assets -> Editor folder. UnityEditor.iOS.Xcode namespace cannot be used in your main project. It works only in special Assembly-CSharp-Editor project intended to modify native Xcode project. (That's the option that worked for me after searching a ton of forums).
The Official Solution:
https://forum.unity.com/threads/unityeditor-ios-xcode-ios-namespace-doesnt-exist.365381/
Step by step I did:
Figure 1 shows the Unity Download Assistent installation file that should be run.
Figure 2 shows the "iOS Build Support" option that should be checked for installation.
I went ahead and changed the "Current Platform" to "iOS" in Unity Hub, This is a quick fix and it works now.
Change "Current Platform" to iOS Image:
If you have installed IOS build through unity hub while the project is open, try restarting Unity Hub and Unity Editor. This solved my issue.
I met this issue When useing unity-arkit-plugin to develop something, i did nothing but import this plugin it throw this error .
And after i installed UnitySetup-IOS-Support-for-Editor-2017.3.0f3.pkg ,the issue fixed.
This usually happens when iOS Build Support is not installed in Unity Hub