I created a build pipeline to build a Xamarin Forms app. I added the task:
Build Xamarin.iOS solution **/*.sln
The build is working fine for Xamarin.iOS but it also builds the Xamarin.Android project which is not required for me.
As you can see in this log, it tries to build the Android version which causes an error for me:
'PushNotification' could not be found (are you missing a using
directive or an assembly reference?)
[/PATH/NAME_OF_PROJECT/Droid/NAME_OF_PROJECT.Droid.csproj]
On the "Build Xamarin.iOS solution" step, click the "link settings" button. The following dialog will come up. Select "Solution" from the dropdown and "Unlink":
This will enable the "Solution" field to be editable. In there, you can update it to be **/*iOS*.csproj.
Rebuild, and you will notice it no longer builds the Android project, and only builds the iOS project.
It's building all of the projects in your solution. What we have done in the past to get around this is to make a copy of your .sln file, open, remove all projects that aren't related to iOS, and use that as the .sln for building iOS.
Related
I get this warning in Visual Studio when building an iOS project:
Incremental builds have been disabled because this version of Xamarin.iOS does not support incremental builds on projects that include more than one third-party binding libraries. (MT0127)
How can I address this warning?
In the solution, select the iOS project (double-click).
Go to Build Settings → Code Generation and Runtime → disable the Incremental builds checkbox for the offending configuration.
Alternatively, edit ...iOS.csproj while the project is closed and remove all instances of
<MtouchFastDev>true</MtouchFastDev>
Clean all. Rebuild all.
Some references:
Incremental builds is disabled on GitHub
Xamarin.iOS errors at Microsoft
Heyho,
I'm working my way through Xamarin.Forms right now and today I got the following error when I tried to Release compile the UWP project of my app (Debug is working):
Payload contains two or more files with the same destination path 'System.Runtime.CompilerServices.dll'. Source files:
C:\Users\[...]\.nuget\packages\runtime.win10-x64-aot.microsoft.netcore.universalwindowsplatform\6.2.0-preview1-26926-04\runtimes\win10-x64-aot\lib\uap10.0.15138\System.Runtime.CompilerServices.Unsafe.dll
C:\Users\[...]\.nuget\packages\system.runtime.compilerservices.unsafe\4.5.1\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll
The projects shared library compiles as netstandard2.0 and again includes a netstandard2.0 library itself, though I don't believe it should be a problem.
The UWP project references "Universal Windows" and the (self-compiled) SQLite.Net library. It also referenced the "Microsoft.NETCore.UniversalWindows" NuGet package, but I uninstalled it (attempting to solve the issue above).
I also tried Cleaning and recompiling the solution, removing and restoring the actual NuGet directories, adding and removing references, up- and downgrading of the UWP packages, changing the build order of my solutions projects...but nothing worked.
Does anyone have any idea what I could do here?
My main problem is that the error seems to come from .NET packages that I can't exchange/remove without crashing the whole project...
Thanks to this question I found a solution to my problem.
Though it wasn't the build target under (Project properties->Build->Build Target) for me I noticed the checkbox "Compile with .NET Native toolchain". I removed the tick and the project compiles fine for Release.
I added a Notification Service Extension project to my Xamarin project. Then I added a reference to it in the Xamarin main iOS project. When building i get this error:
Severity Code Description Project File Line Suppression State
Error Tool exited with code: 1. Output: ditto: can't get real path for source '../../NotifServiceExtension/ac83d35a0ee368097132b3463a52c5b0/bin/iPhone/Debug/NotifServiceExtension.appex' SARR1.iOS
Any ideas please?
Please check if the flag <DeviceSpecificBuild> is set to true in the extension project for the configuration you are trying to build. If it is, change the flag to false. Now the app build should succeed, with the extension included.
Try to remove Notification Service Extension and add it again
I figured it out.
Like #LucasZ said, remove the reference to the iOS app extension (in my case Notification Service Extension) from the host iOS project WHEN you want to build the project in DEBUG mode.
Add the iOS Extension reference to the host iOS Xamarin iOS project when you build in RELEASE mode.
For some reason you cant have the iOS project reference an iOS Extension project when you build in DEBUG mode. It will give the above error as of the current version of Visual Studio with Xamarin.
When in RELEASE mode, make sure you start the project with "without debugging".
In Visual Studio 2017, a fresh new Xamarin solution is created with Portable Class Library.
A initial build shows success. But a run gives an error message:
warnings like
Unable to add a reference to project 'App1'. The current project's target is not one of or compatible with the targets of Portable Library project 'App1'.
It is in both App1.iOS and App1.Android.
I have not yet upgrade the Xamarin NuGet package yet. The UWP project can run without any warning or exception.
Look into the project reference on the Android project, we see the broken reference to App1.
Trying to reference that PCL project again, I got
Look into the Property of the App1 PCL project,
What could be wrong? How can I fix the PCL project so it can be correctly referenced by Android and iOS projects?
I am trying to make a simple xamairn form apllication by folling steps
l
after creating project when compile it
This is not a compilation error. Your solution should contain multiple projects - a PCL and one or more platform specific (iOS, Android, Windows Phone) projects. The PCL is just a library - you cannot run it. Instead you need to right click on one of the platform projects and select "Set as Startup Project". Then when you run your solution Visual Studio will execute that project in the appropriate simulator/emulator.