C# uwp application not building in release mode - c#

I'm trying to build my application in release mode but it's not working. Debug works fine. The error I get is:
STDERR: ERROR: The asynchronous operation was failed: The package could not be installed because a higher version of this package is already installed (hresult_error:80073D06)[location] = c:\buildagent\work\bfdcd5891b5bc64\resharperautomationtools\native\solution\winrt_launcher\src\utility.hpp(41)[function] = void __cdecl jbrs::wait_for_finished(const struct winrt::com_ptr<struct IAsyncInfo> &)[package name] = Microsoft.NET.Native.Runtime.1.7[uri] = C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.6\tools\Runtime\x64\Microsoft.NET.Native.Runtime.1.7.appx
These are the windows sdks
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.18362.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.15063.0</TargetPlatformMinVersion>
This is the uwp version
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.10</Version>
</PackageReference>
I'm unable to figure out how to fix it and was unable to find anything else on the internet. Would appreciate it if someone could help.
Update (Fixed it)
I was able to fix it by downgrading uwp to 5.2.8. (Using Rider) I did it by going to the NuGet Tab and then selecting the second item in the context menu.
After that I also had to downgrade the project by clicking on the button next to the button with the red line.

Update (Fixed it)
I was able to fix it by downgrading uwp to 5.2.8. (Using Rider) I did it by doing going to the NuGet Tab and then selecting the second item in the context menu.
After that I also had to downgrade the project by clicking on the button next to the button with the red line.

Related

"CreateAssetPack" task failed when building MAUI application for iOS

I am creating a new application on MAUI from scratch. The application is successfully built for Android. But when I try to build for iOS, an error occurs, the reasons for which I can not find:
1>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.4.414\tools\msbuild\iOS\Xamarin.iOS.Common.targets(580,3): error MSB4044: The "CreateAssetPack" task was not given a value for the required parameter "Source".
1>Done building project "Clicker.Mobile.App.csproj" -- FAILED.
Installed all the latest updates on Macbook as well as Visual Studio (installed on Windows). The issue is reproducible on multiple computers. Most likely I'm missing something in setting up for iOS, but the error message does not give anything more informative.
CreateAssetPack task:
<CreateAssetPack
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true' And '$(EmbedOnDemandResources)' == 'false'"
ToolExe="$(ZipExe)"
ToolPath="$(ZipPath)"
Source="%(_AssetPack.Identity)"
OutputFile="$(IpaPackageDir)OnDemandResources\%(_AssetPack.DirectoryName)"
/>
I assume, judging by the compiler logs, that the _AssetPack.Identity property is empty.
I find the description of this element:
<!-- Look for the *.assetpack folders in the ODR folder -->
<CollectAssetPacks
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true' And Exists('$(_IntermediateODRDir)')"
OnDemandResourcesPath="$(_IntermediateODRDir)"
>
<Output TaskParameter="AssetPacks" ItemName="_AssetPack"/>
</CollectAssetPacks>
<ItemGroup>
<_AssetPack>
<_DirectoryName>$([System.IO.Path]::GetDirectoryName('%(Identity)'))</_DirectoryName>
</_AssetPack>
<_AssetPack>
<DirectoryName>$([System.IO.Path]::GetFileName('%(_AssetPack._DirectoryName)'))</DirectoryName>
</_AssetPack>
<_AssetPack>
<CodesignStampFile>$(DeviceSpecificOutputPath)OnDemandResources-codesign\%(DirectoryName)</CodesignStampFile>
</_AssetPack>
</ItemGroup>
But further it is not clear what needs to be specified in the project in order for this object to be initialized.
Which way to look?

Xamarin.UITesting NU1201 Error: Android 8.1 Is incompatible with .NETFramework 4.6.1

Have been having a little issue for the last couple of days now where I will create a new Xamarin Forms project on Visual Studio 2017 and add a Xamarin.UITest Cross-Platform Test Project for unit testing I recieve a series of NU1201 Errors when I reference the .Android App in the UITest Project.
Here is the exact error i get:
Error NU1201 Project App1.Android is not compatible with net461 (.NETFramework,Version=v4.6.1) / win-x64. Project App1.Android supports: monoandroid81 (MonoAndroid,Version=v8.1)
I have played around with the Android version numbers to see if the UITesting package doesnt support the latest android but no matter what version of android i target the problem remains the same.
Here is a screenshot of the project.
All the code is unchanged from the default project and runs in the simulator fine but only produces these errors when the Android app is referenced to the UITest project.
Solved it after many more hours of testing and trialling. Instead of adding the Android project to the references, Within the AppInitializer I added another method to the StartApp() call like so:
public class AppInitializer
{
public static IApp StartApp(Platform platform)
{
if (platform == Platform.Android)
{
return ConfigureApp.Android.InstalledApp("com.companyname.App1").StartApp();
}
return ConfigureApp.iOS.StartApp();
}
}
Therefore once I had already run the app via the emulator for the first time and installed on the device, the UITest simply uses the installed APK on the emulator instead of the project.
For those who ran into error NU1201, you might have come to the right place. This may not apply to the question asked but I ran into error NU1201 the other day and the reason for that is the nuproj configuration file for our nuget project has target configuration wrong. It should have been
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
instead of
<TargetFramework>net462</TargetFramework>
because the project is not of "SDK-style."
References: https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-target-framework-and-target-platform?view=vs-2019

How to use iOS simulator/Android simulator from visual studio for Mac with xamarian.forms

I made mobile app at azure and quickstarted it as xamarian.forms and (after failing to publish downloaded table api application and deciding to edit it in browser) downloaded the client application they provided. Then when I tried to launch it with on (Debug>IPhone 8 Plus iOS 11.2) simulator, it (simulator) started but no application is visible (and nothing unusual is installed).
It shows warnings (could it be relevant?):
Warning MSB3276: Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190. (MSB3276)
(For Android simulator it gives some error like:
/Library/Frameworks/Mono.framework/Versions/5.4.1/lib/mono/xbuild/Microsoft/NuGet/Microsoft.NuGet.targets(5,5): Error: Your project is not referencing the "MonoAndroid,Version=v8.0" framework. Add a reference to "MonoAndroid,Version=v8.0" in the "frameworks" section of your project.json, and then re-run NuGet restore.
)
How can I see the ****** application?
Thank you. =)
Open the project.json file in your xxx.Droid project. Change the MonoAndroid version from:
"frameworks": {
"MonoAndroid,Version=v7.1": {}
}
to:
"frameworks": {
"MonoAndroid,Version=v8.0": {}
}
Now, Restore Nuget Packages for your solution.

Xamarin App not compiling after Xamarin Update

We have a Xamarin app running smoothly, but after latest update to Xamarin and Android Packages, we started receiving this error, the update changed Android Support version from 25.1.0 to 25.1.1:
Error: package android.support.v7.media.RemotePlaybackClient does not exist
check detail of error :
/Users/abd/Programming/Gits/Rental/Rental/Rental/Rental.Droid/obj/Debug/android/src/mono/android/support/v7/media/RemotePlaybackClient_OnMessageReceivedListenerImplementor.java(48,48): Error: error: package android.support.v7.media.RemotePlaybackClient does not exist
android.support.v7.media.RemotePlaybackClient.OnMessageReceivedListener
warning: unknown enum constant Scope.LIBRARY_GROUP
reason: class file for android.support.annotation.RestrictTo$Scope not found
Adding Xamarin.Android.Support.v7.MediaRouter and Xamarin.Android.Support.Media.Compat didn't solve the problem.
For these sort of errors the safest option is to do the following:-
1) Gather a list of all the installed packages with their versions.
2) Remove all packages. Some packages will require removing other packages first.
3) Install all packages again.
check dependencies for both packages.packageandroid.support.v7.media.RemotePlaybackClient,Xamarin.Android.Support.v7.MediaRouter because most of time dependecies should be updated.
go to the nuget package manager and select all the package and push the Update butron in top of the page
Point: There are two update button

MdilXapCompile.exe failed with error code 2001

Release/Debug ARM deploy to device isn't possible. But the build succeeds.
I get following exception:
Severity Code Description Project File Line Error Error : DEP6810 :
MdilXapCompile.exe failed with error code 2001. See log file
'C:\Users..\obj\ARM\Debug\MDIL\MDILXapCompileLog.txt' for more
details.
MDILXapCompileLog.txt:
CrossGen failed Error processing assembly
C:\Users...\obj\ARM\Debug\MSIL\Microsoft.Band.dll Raw error code:
2148733978
Google lead me to following solution:
Close Visual Studio
Navigate to YourSolution/Packages/
Delete everything except packages.config
Reopen the solution in Visual Studio
Right click on solution and select "Manage Nuget Packages"
Click the "Restore" button that appears at the top of the dialog
window
Doesn't work for me. Any other suggestions?
Thanks in advance
If WP 8.1, uninstall the app and run deploy, it worked for me.
When you deploy the Device make sure to select Debug instead of Release. If you set to Release the app will not be deployed and the above error will occur.
Select Debug and set the deployment destination as Device. Unlock the phone and run. It will work.

Categories