Build issue in VSTS build agent on Mac (Xamarin) - xamarin.ios

Introduction
Basically, I'm not able to setup continuous integration for a Xamarin.iOS project using VSTS and xbuild on macOS.
Current Setup
I've set up a VSTS build definition to build a very simple project (template actually) on a Mac Mini with the latest Apple macOS 10. Xamarin is installed and I was able to build and deploy a sample project onto my iPad. The same applies for XCode as well. Below is my whole continuous integration chain:
Upload code to Bitbucket
VSTS build definition gets notified about new change
VSTS build definition connects to the build agent on macOS
build agent builds the project
Problem
The build always fails with the following message:
[error]XamariniOS task failed with error Error: Failed which: Not found xbuild: null.
Unfortunately, I'm not able to find out what exactly failed. The source code is under ~/myagent/_work/1/s. The solution file to be built is also there and I'm certain that this is found.
The build agent on macOS just reports:
Job build completed with result: Failed
Actual Question
What is missing in my setup? Where can I get more info to track down that issue?

The error message actually says that xbuild was not found on the build system. The solution is to provide the path to xbuild in the build task settings. There is an extra input field for that in the Advanced section.

Related

Azures Visual Studio Team Services (VSTS) Build & Release process fetches more projects than just the project I am wanting to build

My VSTS Repository contains 50+ Visual Studio projects of Azure Web Apps and I was requested to get an automated build and release process in place for one of them. I went thru and selected a Visual Studio template and on the build solution I selected only the one project I wanted to do a build and release on but when I queue the build to run it starts doing a get latest on every project in the repository. This is unacceptable because it would take hours to get latest on all the projects just to compile and publish one website. This makes no sense to me. Is there a way to limit what the build does a get latest on?
Depends on the repository type you're using. In case you're using TFVC, you can go to the Repositories tab and configure your workspace mappings to match exactly what you need for your project.
If you're using Git, then you're out of luck, the way git repositories are synced, the whole repository is always fetched when a build is initiated.
If you're using your own build agent, you can configure it to retain the sources directory, in which case only the differences are synced when a build runs.

Android Studio with Jenkins Integration

I guess many of you have performed here continuous integration of Jenkins with Android Studio.
I have performed the following steps:
Created a project from Android Studio.
Created a repository in GitHub.
Pushed the code base into the Github.
Configured Jenkins.
Now, my target is that whenever I perform some checkin operation of the Android code into the Github, then automatically Jenkins will create a build on the latest codebase.
I already have downloaded the necessary plugins that are required for Jenkins.
Can anybody tell me step by step how can I achieve the same, since I am not sure, how Jenkins will get the apk file that is getting created once Jenkins performs the build operation on the new codebase?
It is an old question, and may of no use for questioner, but it may help others looking for solution.
If you are looking for apk file then it is available in build path of workspace.
It looks like you are interested in CD part, then you can use "Google Play Android Publisher". It enables Jenkins to manage and upload Android app files (AAB or APK) to Google Play. please refer to following doc help from Jenkins:
https://plugins.jenkins.io/google-play-android-publisher/

Web Deploy to Server with MSBuild

I have a publish profile set up in a VS 2012 project. When I right click on the project in VS, select Publish and click on the [Publish] button, it publishes the project to the server using the settings provided in the Publish Profile.
When I use msbuild and the command line, with the following syntax:
msbuild.exe .\mvc.csproj /p:PublishProfile=DevServer
/p:DeployOnBuild=True /p:Password=MyPassword /p:AllowUntrustedCertificate=true
Then it builds the project, and gives me a message:
Package "mvc.zip" is successfully created as a single file at the following location: file:///c:/code/mvcsite/obj/Debug/Package
And then provides info on how to deploy the package.
How can I deploy from the command line? My ultimate goal is to run the deployment through TeamCity, and am right now trying to get my command line properties correct. However, the most that I can do from the command line right now is to create the deployment package, but not to run the actual deployment. How can I do both (preferably with one statement, to duplicate what happens in VS2012 when I deploy from there)?
Since you are building the .csproj you missed one important property
/p:VisualStudioVersion=11.0
This property was introduced in MSBuild 4.5 to facilitate project sharing between VS 2010 and VS 2012. A drawback; when building the .csproj you need to specify the value for this property. When building the solution file the value can be derived from the solution file version. Read more at my blog http://sedodream.com/2013/01/06/CommandLineWebProjectPublishing.aspx.

Do I need to install AzureSdk on the build server to create azure packages?

We use TeamCity as our CI server (but I imagine this applies to any build server).
We have not installed the azure SDK on the build server and are able to build the projects which use the SDK using the workaround described here.
I now want the server to produce the packages for deployment to Azure, but when I run an MSBuild task to create the packages (as directed here) I get a strange error
error MSB4057: The target "WatGetTargetFrameworkDirectories" does not exist in the project.
which yields few useful google results.
Do I need to install the SDK? Or is this error related to something else?
WatGetTargetFrameworkDirectories is a target from AzureSDKs .targets file. Looks like your error related to Azure SDK.
Except it could be more subtle error related to not very good msbuild Azure Targets. For our own azure packaging we did need to call 2 targets "Clean;CorePublish", not just "Publish". Maybe this will also help you.
Side note: why you don't want to install AzureSDK on TeamCity BuildAgent? Build agents made exactly for that - to have frameworks you need for build. Also 1.6 and 1.7 AzureSDKs can be installed side-by-side.

create azure package with build

I was just upgrading my project from sdk 1.3 to 1.7 and I noticed that now when I build the application the package(cspkg) is not created with the build. I have go click on publish to create a package. Is there a way to tell VS to create a package everytime a build is triggered.
Also using msbuild is there a way to do the same thing. I have multiple projects under a solution, Most of which are just libraries and then there is this azure app. Is there a way to specify a single msbuild statement with params to tell the azure app to create the package as well as build the other projects. Also when I specify debug the debug package should be created and when I specify release switch the release package should be created.
How could I do the same thing on my build server as well where I have a .proj file which specifies the sln to build. How could I mention a switch to build the package there.
Thanks,
Kunal
You can configure CSPACK command (Be sure to have CSPACK.exe launched from SDK 1.7 Path otherwise you will get some schema related errors with SDK 1.6 project) as Post Build event in your Windows Azure Application Build settings. This way when you will build, after successful build CSPACK command will run and package your application. Same way you can configure your MSBuild configuration. I just tested and it worked for me.
Visit this MSDN article on packaging a cloud service to learn more.
You can do this using msbuild as well. See the Resolution section of this question.

Resources