Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin cycle 7 IOS IPA output now in a datetime folder

I have just updated to the latest version of Xamarin studio, however when I try to build my solution using XBuild, through our continuous integration server it now generates the IPA file in a data time folder, (within the usual bin\iphone\Ad-hoc folders) e.g. :

Finisher3 2016-06-09 11-57-45\Finisher3.ipa

however I do not understand why it now does this - in the previous version it gave me a file as follows:

Finisher3-1.68.1.1.ipa

Does anyone know how to get it back to setting the version number again, rather than putting it in a date time folder which makes it fairly impractical to copy the IPA to a release folder once I have finished building it.

like image 844
Chris Avatar asked Jun 09 '16 13:06

Chris


1 Answers

Update: Old solution doesn't work for latest Xamarin release and is not suggested. Official information and suggestions on solving the problem are published here:

https://developer.xamarin.com/releases/ios/xamarin.ios_9/xamarin.ios_9.8/#New_MSBuild_property_IpaPackageDir_to_customize_.ipa_output_location

However, in my case, having several build machines with ~30 builds editing build definitions or .csproj files on all of them is a nightmare, especially on Friday.

Here is a workaround that I am using for the moment. Between line 1655/1656 insert this code

<IpaPackageDir Condition="'$(IpaPackageDir)' == ''">$(DeviceSpecificOutputPath)</IpaPackageDir>

Then insert following line after 1661:

<IpaPackageName Condition="'$(IpaPackageName)' == '' And '$(_BundleVersion)' != ''">$(_AppBundleName)-$(_BundleVersion).ipa</IpaPackageName>

After your changes this is how file will look. Lines 1656 and 1662 are new. fixed targets file for Xamarin ipa location problem

Good luck, have fun!


Outdated solution:

According to the [email protected], editing Xamarin.iOS.Common.targets for now is the suggested workaround (Option 2 from Johan's answer).

Since the accepted answer only shows reason of the problem (Option 2), here is how to workaround the issue.

The workaround (on Mac) is to go to the folder /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/2.1/ and open file Xamarin.iOS.Common.targets

(or open file directly /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/2.1/Xamarin.iOS.Common.targets).

If you are on Windows, then the file you need to edit is C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets

Then change line 1607 to

    <PropertyGroup>
        <IpaPackageName Condition="'$(IpaPackageName)' != '' And !$(IpaPackageName.EndsWith ('.ipa', StringComparison.OrdinalIgnoreCase))">$(IpaPackageName).ipa</IpaPackageName>
        <IpaPackageName Condition="'$(IpaPackageName)' == '' And '$(_BundleVersion)' != ''">$(_AppBundleName)-$(_BundleVersion).ipa</IpaPackageName>
        <IpaPackageName Condition="'$(IpaPackageName)' == ''">$(_AppBundleName).ipa</IpaPackageName>
    </PropertyGroup>

and line 1734 to

OutputFile="$(OutputPath)$(IpaPackageName)"

These changes are taken from the Xamarin.iOS.Common.targets of previous stable release (5.10.3).

like image 169
Alex Sorokoletov Avatar answered Oct 20 '22 10:10

Alex Sorokoletov