Visual Studio for Mac as VSTS build agent for iOS? - xamarin

Visual Studio is the recommended tool (superseding Xamarin Studio) on both Windows and Mac. However, the VSTS page Build your Xamarin app says to use "Xamarin". Presumably that means Xamarin Studio, even though the the "Install Xamarin" link on the page points to Visual Studio. That ambiguity and the March 6 date on the page indicate that it was overlooked during the rollout of Visual Studio 7 for Mac, leaving us to wonder what is the right approach for setting up an agent.
What is the best way to create an iOS build agent these days? Do you install Visual Studio for Mac or Xamarin Studio?

Sounds like a bit of confusion here in the terminology. The IDE is now Visual Studio for Mac, but the underlying framework is still Xamarin. That is to say, Xamarin.iOS/Xamarin.Android/Xamarin Forms are "integrated" into Visual Studio for Mac; they are the tools that will compile and package your mobile app. This is what the VSTS build task page is saying when it asks you to "Install Xamarin".
As for setting up a VSTS build agent, here's a checklist that will hopefully get you going:
Download and install Visual Studio for Mac on a computer running OS X/macOS. Confirm that Visual Studio for Mac can indeed build and sign the IPA's.
If necessary, install all the certificates and provisioning profiles, and confirm that the IPA is correctly signed.
Create a build project in VSTS.
Install the VSTS build agent for OS X/macOS and connect/register the build agent to the VSTS project. Please be aware that the Xamarin license task/utility is deprecated and no longer needed. If that does appear as a step in your VSTS build project, delete it.
Go back to VSTS, and configure the VSTS project to build the Xamarin.iOS project via the OSX/macOS build agent. Once the build agent is connected to the VSTS project.
I'll admit, there is a lot of moving parts and things to do here. I hope this high level overview is enough to point you in the right direction.

Per starain's advice, I tried installing VS for Mac. It started up, but failed with an 'Unable to parse condition "!(Exists($(SharedVersionOutputDirectory)))"' error. I've encountered several bugs in the Xamarin tool chain, so this may have nothing to do with VS vs. XS, but just be part of the current duct-tape-and-bailing-twine experience. OTOH, there's still a top-level Xamarin page saying VS Mac is still preview, so who knows how baked it really is?
So even though the Mac build agent does find and run the VS Mac build tooling, I gave up and used my Windows build agent instead, and had MSBuild on Windows connect to the Mac for the iOS build.

Related

Cannot deploy .sln to Hololens 2

What I have done
I looked up a few tutorials and did all their steps. MRTK is successfully installed. I created a simple world in Unity 3D (latest version), with 2 moveable (using the hand interface) objects. In game mode, everything works fine.
Now I wanted to deploy it to my Hololens 2.
So I build the project with the following settings:
After that I connected my Hololense to the PC and want to deploy it via Visual Studio 2022.
It is set to "Release" "ARM 64" "Device".
After pressing on "start without debugging" i will get the following error Codes (as an image because it is better structured):
I already tried installing different SDK packages and creating 5 new Unity projects but it doesnt work. Hope you can help me!
Greetings!
Apart from the suggestions from derHugo, you may also check the following configurations of your project.
Make sure Unity is 2020.3 LTS, and you have used Mixed Reality Feature tools to import/update to the latest package.
Select a specific “Target SDK Version” and “Visual Studio Version” instead of “Latest installed”
In visual studio, make sure the Platform Toolset consists with Unity selection (v143 for vs 2022)
Reinstall “Universal Windows Platform development” component in VS installer and ensure any related to v143 ARM64 build tools are installed (because you are using vs 2022)
LNK1136 error is caused by corrupt or invalid files. Because to deploy a unity project to HoloLens, you need to build a Unity project first. If cleaning VS build then rebuilding is not working, try to remove Unity build then rebuild.
VS installer Screenshot added:

Debugging Xamarin Android apps if I'm using VSTS hosted builds / HockeyApp

I have been developing a Xamarin Android app using Visual Studio Community 2015. So far, everything has been working well for debugging, as I simply build my app in VS, and connect my phone to my laptop and debug it using F5.
Recently, I started using HockeyApp for crash reporting, so that as I'm using my app (during the day when I'm not programming), if it crashes, I can send crash reports. This works OK, but the crash reports don't include line numbers, and also I don't have good references to what build of the app crashed, as the app itself isn't actually getting uploaded to HockeyApp, nor are the debugging symbols.
To help with this, I'm trying to get more organized using Visual Studio Team Services, doing hosted builds upon checkin of my source code, and automatically uploading the app and debugging symbols to HockeyApp.
Now I'm trying to reconcile in my mind how this is supposed to all work for me. If I'm coding in VS and debugging through VS, the app is getting deployed to my phone. But now, I check in the source code, and VSTS does a CI build and uploads everything to HockeyApp. But now, the CI build that VSTS did isn't really the same build that's on my phone, since that build came from the Visual Studio build.
So, when I'm done coding then later in the day, I run my app and it crashes, I'm concerned that the crash report from HockeyApp isn't actually going to relate to what Hockeyapp has. For one, I may not have done a check-in to the source control, in which case, my phone will have a newer version than HockeyApp has. But even if I had remembered to check it in, it's really not the same "build" (since my phone has the APK that was built by Visual Studio and HockeyApp has the APK that was built by VSTS).
Questions:
1) Is there a way to upload my app and debug symbols directly from Visual Studio, without going through a VSTS build? (preferrably automatically upon every build, so that I don't have to remember to do an extra step)?
2) If not, what are the best practices to resolve the issues that I mentioned above?
Ideally, I don't want to have to do any extra steps when I'm done coding for the day. I want to be able to always know that the last version that I built and deployed to my phone will have been uploaded to HockeyApp, so that if it crashes, the crash repo that HockeyApp sends will match with the correct source code and debug symbols.
For your first question, This depends on the project you working on. If you are working on a UWP project, there is an "Enable Crash Analytics" option and "Distribute With Hockey App" option allow you to do this when you right click on the project. But if you are working on a Xamarin.Android project, there is no option to do this. You need to upload them to Hockey App manually. However, you can create a power-shell script to upload these files to Hockey App and configure this power-shell script as post-build event. You can check the power-shell script here for reference: upload_file.ps.
And for the Visual Studio Team Services(VSTS) build, you just need to make sure that the app version and build configuration is totally the same as you debugging through VS from your local machine. Hockey App will detect the version automatically and send the data to the related build version.

IOS Simulator or Run device visual studio 2015 apache cordova

Hello searched various sources on how to run my application on an iOS simulator or run the application on an iOS device by visual studio , but from what I understand I need to have a Mac.
main source:
VISUAL DOCS
Yes - that's correct. To build for iOS devices from Visual Studio, you do need to setup a Mac build server. You can either follow the instructions on the page that you linked to, or take a look at the steps on the same site to use a Cloud-hosted service, MacInCloud

Xamarin.Android version numbers seem inconsistent

To keep build tool version consistency, I want to manually upgrade Xamarin on my desktop as well as my CI build server (not to be confused with a Xamarin mac build host). Running auto-update only works if I upgrade all machines at the same time.
So I go to download, and I thin I need to download Xamarin.Android - latest version is 4.0.1. No revision number is given here.
The thing is, I did run an update from Visual Studio the other day, and according to the about dialog, I'm now running "Xamarin.Android 6.0.1.10":
Xamarin 4.0.1.89 (413372c)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin.Android 6.0.1.10 (e98e962)
Visual Studio plugin to enable development for Xamarin.Android.
I've heard that the v4.0.1 relates to the Visual Studio plugin (I use VS on my desktop).
IN addition, I don't use Visual Studio on my CI build server; instead I have Xamarin Studio. When I look at pending updates for that, it's offering "Xamarin 4.0.1.93" - presumably not a Visual Studio plugin for Android Studio?
Is Xamarin telling me I'm downloading "Xamrin.Android 4.0.1" when really I'm downloading "Xamarin v4.0.1.?" which contains "Xamarin.Android v6.x.x.x".
My end-game is that I would like to be sure of what versions of Xamarin components are involved when building using MSBuild.
If I need to do a legacy build, I would like the legacy build tool to be used.
Update: I have started tracking versions myself here
Xamarin support got back to me. My understanding is:
The version number in the dropdown seems to be that of the installer that bundles both Xamarin.Android and Xamarin.iOS. It is not the version of Xamarin.Android.
Build tool version: "Xamarin.Android performs the build, so this is what you are looking for."
You can find out roughly what version of "Xamarin.Android" is bundled with "Xamarin" from the "Xamarin" Release Notes. The top line says something like Xamarin 4.0 updates Xamarin.iOS 9.4 and Xamarin.Android 6.0 releases.
More info from Xamarin:
On Windows you cannot download separate installers for Xamarin.iOS and
Xamarin.Android.
The Xamarin.VisualStudio package (also referred to as just "Xamarin")
includes Xamarin.iOS and Xamarin.Android.
E.g., Xamarin 4.0.1.93 contains Xamarin.iOS 9.4.1.24 and
Xamarin.Android 6.0.1.10
The version number you see on the download page refers to the version
number of "Xamarin" - which, as above, includes Xamarin.iOS and
Xamarin.Android. This is the same when you are updating and see
"Xamarin 4.0.1.93" for example.
You need to install "Xamarin" even if you are using Xamarin Studio on
Windows as this includes Xamarin.Android.
and
We do issue separate installers for Xamarin.Android on OS X, so if you are able to use a Mac for your CI (e.g., with something like Jenkins), then this may be more viable.

Xamarin Studio OSX and Windows Builds

I have a beginner question regarding Xamarin Studio. I wrote a prototype app in Windows Form using Visual Studio and I now want to flesh it out and deploy to both Windows desktop and OSX. Someone suggested using Xamarin Studio but I have run into an issue. When I try to build on a Mac for OSX all I get is a .exe. I am new to OSX development and am having trouble figuring out how to continue. Is there a build configuration I am missing? There doesn't seem to be any options for build targets.
Thank you for your time
the .exe can be run with Mono, but what you may be looking for is in the "Build" menu (at least, in the latest Beta), then "Archive for publishing" then "Sign and Distribute"

Resources