I'm currently trying to properly set our CI configuration to build multiplatform Xamarin.Forms projects for iOS and Android. For that purpose, I divided the build stages on a pipeline. When trying to isolate the IPA build (to do it on a macOS server I have lying around the office - different than the one used for Android projects) I had an initial problem when running xbuild
from the CI CLI I described in: https://stackoverflow.com/questions/44797913/use-xbuild-to-build-just-one-project-from-a-multi-project-solution
As suggested by user radical there:
You could disable the Android project from being built for your Platform=iPhone case via the Configuration manager (see Solution Configurations section).
I did so for my project from Xamarin Studio and that worked out to build the IPA for distribution flawlessly.
However, I hit another stone after including some UI & unit tests in the project. Now the beginning of my Project.sln
looks like this:
Project("{[...]}") = "Project", "Project\Project\Project.csproj", "{[...]}"
EndProject
Project("{[...]}") = "Project.Droid", "Project\Project.Droid\Project.Droid.csproj", "{[...]}"
EndProject
Project("{[...]}") = "Project.iOS", "Project\Project.iOS\Project.iOS.csproj", "{[...]}"
EndProject
Project("{[...]}") = "Tests", "Tests\Tests.csproj", "{[...]}"
EndProject
Project("{[...]}") = "UITests", "UITests\UITests.csproj", "{[...]}"
EndProject
Running my old IPA-generation script: xbuild /p:Configuration="Ad-Hoc" /p:Platform="iPhone" /p:IpaPackageDir="./Builds" /t:Build Project.sln
that used to succeed now returns the following error output:
/user/project/Project.sln (Build) ->
(Build target) ->
/user/project/Tests/Tests.csproj (default targets) ->
/Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/xbuild/14.0/bin/Microsoft.Common.targets (ResolveAssemblyReferences target) ->
/Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/xbuild/14.0/bin/Microsoft.Common.targets: warning : Reference 'Microsoft.VisualStudio.QualityTools.UnitTestFramework' not resolved
Errors:
/user/project/Project.sln (Build) ->
(Build target) ->
/user/project/Tests/Tests.csproj (default targets) ->
/Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/xbuild/14.0/bin/Microsoft.CSharp.targets (CoreCompile target) ->
RestServiceTests.cs(1,17): error CS0234: The type or namespace name `VisualStudio' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
I'm a bit lost after looking here and there for a solution; I tried to do the same for the test stages as I did for Android (disabling it on the Configuration Manager) but tests don't appear there. Are the tests not meant to run on macOS?
Any ideas about what I'm not doing right? Or problems I might have in my project's config?