locked
IPA output location RRS feed

  • Question

  • User11693 posted

    Since switching to the beta channel I've noticed the IPA file is being placed in a folder e.g. <path>/bin/iPhone/AppStore/<project> <date time>/<project>.ipa

    This is annoying because it ruins my build script. Have I missed something obvious here?

    Wednesday, May 18, 2016 11:45 PM

Answers

  • User11693 posted

    For anyone interested this is where the problem is. Edit at your own risk. Xamarin.iOS.Common.Targets

    <PropertyGroup>
        <_IpaOutputPath>$(DeviceSpecificOutputPath)$(_AppBundleName) $([System.DateTime]::Now.ToString('yyyy-MM-dd HH-mm-ss'))</_IpaOutputPath>
        <_IpaOutputDir>$(_IpaOutputPath)\</_IpaOutputDir>
        <IpaPackageName Condition="'$(IpaPackageName)' != '' And !$(IpaPackageName.EndsWith ('.ipa', StringComparison.OrdinalIgnoreCase))">$(IpaPackageName).ipa</IpaPackageName>
        <IpaPackageName Condition="'$(IpaPackageName)' == ''">$(_AppBundleName).ipa</IpaPackageName>
        <IpaPackagePath>$(_IpaOutputDir)$(IpaPackageName)</IpaPackagePath>
    </PropertyGroup>
    
    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Thursday, May 19, 2016 11:04 PM
  • User10285 posted

    For anyone else who runs into problems with the .ipa not being output where it's supposed to be, you can add the following into your .csproj to copy it where it belongs:

    <PropertyGroup> <CreateIpaDependsOn> $(CreateIpaDependsOn); CopyIpa </CreateIpaDependsOn> </PropertyGroup> <Target Name="CopyIpa" Condition="'$(OutputType)' == 'Exe' And '$(ComputedPlatform)' == 'iPhone' And '$(BuildIpa)' == 'true'"> <Copy SourceFiles="$(IpaPackagePath)" DestinationFolder="$(OutputPath)" /> </Target>

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, June 10, 2016 8:47 PM
  • User13348 posted

    Hello,

    We are using VSTS to automate all the distribution process.

    Since the last update of xamarin iOS (10.4.0.123), the workaround I added in the csproj file is not working anymore.

    I was adding the following in my ios csproj to override the output location of the ipa file :

    <PropertyGroup>
        <CreateIpaDependsOn>
           $(CreateIpaDependsOn);
            CopyIpa
           </CreateIpaDependsOn>
      </PropertyGroup>
      <Target Name="CopyIpa" Condition="'$(Configuration)|$(Platform)' == 'AppStore|iPhone' And '$(BuildIpa)' == 'True'">
        <Copy SourceFiles="$(IpaPackagePath)" DestinationFolder="$(OutputPath)" />
      </Target>
    

    And I was getting, since the last update, the following error:

    2017-02-23T17:39:19.2831810Z Copying failed. Retries left: 0.
    2017-02-23T17:39:19.2847540Z /Users/developer/********/App.iOS/App.iOS.csproj: error : /Users/developer/********/bin/iPhone/$(Configuration)//App.ipa does not exist  at System.IO.File.Copy
    

    The ipa wasn't anymore generated with this fix..

    So I simply removed the PropertyGroup and the target and the process is working again.

    So it seems that, since the last update, xamarin has change the output location, which is now more convenient and not generated in a timestamp folder/file format.

    So no need anymore to add the PropertyGroup and Target.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, February 24, 2017 12:27 PM

All replies

  • User11693 posted

    For anyone interested this is where the problem is. Edit at your own risk. Xamarin.iOS.Common.Targets

    <PropertyGroup>
        <_IpaOutputPath>$(DeviceSpecificOutputPath)$(_AppBundleName) $([System.DateTime]::Now.ToString('yyyy-MM-dd HH-mm-ss'))</_IpaOutputPath>
        <_IpaOutputDir>$(_IpaOutputPath)\</_IpaOutputDir>
        <IpaPackageName Condition="'$(IpaPackageName)' != '' And !$(IpaPackageName.EndsWith ('.ipa', StringComparison.OrdinalIgnoreCase))">$(IpaPackageName).ipa</IpaPackageName>
        <IpaPackageName Condition="'$(IpaPackageName)' == ''">$(_AppBundleName).ipa</IpaPackageName>
        <IpaPackagePath>$(_IpaOutputDir)$(IpaPackageName)</IpaPackagePath>
    </PropertyGroup>
    
    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Thursday, May 19, 2016 11:04 PM
  • User904 posted

    It's a side effect of the bug fix https://bugzilla.xamarin.com/show_bug.cgi?id=35667 The $(IpaPackagePath) MSBuild variable can be used to locate the .ipa file after the build.

    Thursday, June 9, 2016 4:00 PM
  • User153755 posted

    Hi @prashantvc , it appears that the Bundle is not being appended to the .ipa file name as well. Is this working as intended?

    Friday, June 10, 2016 1:41 PM
  • User10285 posted

    Is any of this being addressed? We created shell command scripts to automatically upload to iTunesConnect when we build for AppStore, this has caused us to have to use the painful manual upload process.

    Friday, June 10, 2016 5:02 PM
  • User10285 posted

    So, I have tried manually editing my .csproj as described in https://kb.xamarin.com/customer/portal/articles/2061038-can-i-change-the-output-path-of-the-ipa-file-, unfortunately since the generated folder uses a timestamp for its naming, and this step does not occur in the same second as the creation of the folder, it fails to regenerate the same folder name by once again using DateTime.Now().

    I'm really not keen on changing the Targets files, and it's not clear why there was any need for the generated folder. Will the $(OutputPath) build variable be fixed to contain the true output path? Or will we have the ability to not have the generated folder created at all?

    Friday, June 10, 2016 6:11 PM
  • User10285 posted

    For anyone else who runs into problems with the .ipa not being output where it's supposed to be, you can add the following into your .csproj to copy it where it belongs:

    <PropertyGroup> <CreateIpaDependsOn> $(CreateIpaDependsOn); CopyIpa </CreateIpaDependsOn> </PropertyGroup> <Target Name="CopyIpa" Condition="'$(OutputType)' == 'Exe' And '$(ComputedPlatform)' == 'iPhone' And '$(BuildIpa)' == 'true'"> <Copy SourceFiles="$(IpaPackagePath)" DestinationFolder="$(OutputPath)" /> </Target>

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, June 10, 2016 8:47 PM
  • User16951 posted

    Guys from Xamarin, why do we have this problem and when will the fix be available?

    Tuesday, June 14, 2016 8:48 PM
  • User16951 posted

    According to the support, editing Xamarin.iOS.Common.Targets for now is the suggested workaround.

    Wednesday, June 15, 2016 6:01 AM
  • User16951 posted

    So the fix 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). 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).

    Thank you everyone who helped to find this problem and solve it!

    Wednesday, June 15, 2016 7:34 AM
  • User11693 posted

    @AlexS Have you seen @JarrodKoch's suggestion of editing your .csproj? Saves you having to back up the target file every time you upgrade Xamarin.

    Thursday, June 16, 2016 3:29 AM
  • User16951 posted

    @PhillipWilliamson I did. Having 10+ projects on build server and editing just one .targets file now instead of 10 .csproject files is the option I choose. Next update will overwrite .targets and hopefully fix the problem we are all having here (I know support is working tightly on this). Changing .csproj now will require changing it back after .targets are fixed by the next update.

    Thursday, June 16, 2016 3:40 AM
  • User96634 posted

    I made a change to Xamarin.iOS.Common.Targets, i only change line 1608 to <_IpaOutputPath>$(OutputPath)</_IpaOutputPath> So it looks like the following

    <PropertyGroup>
        <_IpaOutputPath>$(OutputPath)</_IpaOutputPath>
        <_IpaOutputDir>$(_IpaOutputPath)\</_IpaOutputDir>
        <IpaPackageName Condition="'$(IpaPackageName)' != '' And !$(IpaPackageName.EndsWith ('.ipa', StringComparison.OrdinalIgnoreCase))">$(IpaPackageName).ipa</IpaPackageName>
        <IpaPackageName Condition="'$(IpaPackageName)' == ''">$(_AppBundleName).ipa</IpaPackageName>
    
        <IpaPackagePath>$(_IpaOutputDir)$(IpaPackageName)</IpaPackagePath>
    </PropertyGroup>
    

    After this change the ipa was in the same place as it was prior to update.

    Also if you are building on Windows the file you need to change is C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets

    Thursday, June 16, 2016 4:01 AM
  • User73229 posted

    Hey everyone!

    Another option is to add a copy target to your csproj file, which will copy the IPA to a desired location. I have posted a Q/A style entry on Stack Overflow describing this process:

    http://stackoverflow.com/questions/37870098/how-do-i-change-the-ipa-output-location-of-a-xamarin-ios-project/37870099#37870099

    Thanks!

    Friday, June 17, 2016 3:20 PM
  • User88 posted

    This is very annoying and cost me way too much time today. I sure hope an official fix is in the works.

    For anyone wanting to exactly restore the old behavior where the BundleVersion is included in the ipa file name, I modified the csproj workaround as follows:

    <PropertyGroup> <CreateIpaDependsOn> $(CreateIpaDependsOn); CopyIpa </CreateIpaDependsOn> </PropertyGroup> <Target Name="CopyIpa" Condition="'$(OutputType)' == 'Exe' And '$(ComputedPlatform)' == 'iPhone' And '$(BuildIpa)' == 'true'"> <Copy SourceFiles="$(IpaPackagePath)" DestinationFiles="$(OutputPath)$(_AppBundleName)-$(_BundleVersion).ipa" /> </Target>

    Tuesday, June 21, 2016 5:02 PM
  • User13824 posted

    For cross-referencing, I have now added this as a known issue / breaking change in the Xamarin.iOS release notes for Cycle 7. Along the way I created a new "product design question" bug report to discuss the trade-offs of this change with the engineering team. I have left that bug as public for now to provide visibility on the discussion. But to help keep the bug moving forward smoothly, I would recommend that users not comment directly on the bug report unless they have some specific constructive input to share. Thanks!

    Of course, feel free to continue to discuss workarounds for the issue in this forum thread as needed.

    Tuesday, June 21, 2016 8:40 PM
  • User158539 posted

    There's also the wider question of how in the hell this kind of breaking change makes it all the way through QA and into stable. smh.

    Tuesday, June 28, 2016 12:41 AM
  • User3585 posted

    How to get the $(IpaPackagePath) variable value after running an MSBuild activity in a TFS build process template?

    It is possible to pass-in values to variables already defined on the MSBuild activity (or with the CommandLineArguments property), but I never herd about the possibility to get back values from it...

    The only solutions I currently see is to: - Customize project and build process to output the variable value to a file on disk then reload it from the build process template. - Set MSBuild logging to verbose then parse output for the variable.

    Not so much fun in every case :)

    Tuesday, June 28, 2016 7:11 PM
  • User42331 posted

    Just wanted to chime in that this was a time-waster for me, too. Ended up just using find -name to get the path to the file. Variable directory or file names are always a pain for build scripts.

    Tuesday, June 28, 2016 7:38 PM
  • User10329 posted

    What if I want my ipa to show both the public version number and private version number. I have 1.0 for my CFBundleShortVersionString and 34 for my CFBundleVersion. So I want my ipa to be:

    XXXXX-1.0.34.ipa

    That is what I was used to before this change.

    Thursday, July 7, 2016 8:21 PM
  • User10329 posted

    Nevermind, I can still achieve that by specifying the IpaPackageName on the command line to control the name that gets put in the weird directory. And then use the new target in my csproj to just copy the filename (with the name I told it to be) to the BuildOutput directory.

    Thursday, July 7, 2016 8:47 PM
  • User12272 posted

    I've just done Xamarin update to my build machine through the stable channel (Xamarin.iOS ver 9.8.2.22). That changes also screwed up my script from not able to find the IPA file, and so on.

    I fixed it by simply commented this line <!--<IpaPackageDir Condition="'$(IpaPackageDir)' == ''">$(DeviceSpecificOutputPath)$(_AppBundleName) $([System.DateTime]::Now.ToString('yyyy-MM-dd HH-mm-ss')) </IpaPackageDir>–>

    And add this: <IpaPackageDir Condition="'$(IpaPackageDir)' == ''">$(DeviceSpecificOutputPath)</IpaPackageDir>

    Depends on what you want it to be. For my case, I removed the AppBundleName as well as the DateTime.

    File Location: /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/2.1/Xamarin.iOS.Common.targets

    Friday, September 2, 2016 3:25 PM
  • User13824 posted

    Note that you can also customize the IpaPackageDir MSBuild property on a project-by-project basis (thank to the Condition="'$(IpaPackageDir)' == '' attribute in the .targets file). One potential advantage of setting the property in the individual project .csproj is that then it won't be necessary to re-patch the .targets file after updating or reinstalling Xamarin.

    Additional details in the release notes:

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

    Friday, September 2, 2016 3:57 PM
  • User61098 posted

    Oh glad to see I'm not the only one touched by this breaking change. Just imagine the number of hours burned by it. Guess there's way more people already using a mobile DevOps approach than Xamarin imagined - all out of VSTS and with custom scripts.

    Friday, September 9, 2016 8:55 AM
  • User23301 posted

    +1 for this change breaking our build pipeline. I'd just like to add that none of the of the official solutions are really suitable. Changing the csproj, along with being a big resource drain to update our 50 or so projects, now requires us to educate every dev here to modify the csproj for all new solutions. Changing the msbuild files requires re-implementing this change on every upgrade of Xamarin.

    Pretty annoyed that this was changed as the out of the box default behaviour. Seemed to be working fine previously.

    Tuesday, September 27, 2016 5:30 AM
  • User62769 posted

    This broke our builds as well, but the time investment in fixing it was only an hour (care of this forum thread). Thanks to everybody who dealt with this before me.

    Friday, December 9, 2016 2:24 AM
  • User85069 posted

    I would like to know who thought putting spaces in a file path was a good idea? And why could have the default not been the same behaviour as before?

    Thank you to those who ran into this before I did.

    Monday, January 30, 2017 9:03 PM
  • User13348 posted

    Hello,

    We are using VSTS to automate all the distribution process.

    Since the last update of xamarin iOS (10.4.0.123), the workaround I added in the csproj file is not working anymore.

    I was adding the following in my ios csproj to override the output location of the ipa file :

    <PropertyGroup>
        <CreateIpaDependsOn>
           $(CreateIpaDependsOn);
            CopyIpa
           </CreateIpaDependsOn>
      </PropertyGroup>
      <Target Name="CopyIpa" Condition="'$(Configuration)|$(Platform)' == 'AppStore|iPhone' And '$(BuildIpa)' == 'True'">
        <Copy SourceFiles="$(IpaPackagePath)" DestinationFolder="$(OutputPath)" />
      </Target>
    

    And I was getting, since the last update, the following error:

    2017-02-23T17:39:19.2831810Z Copying failed. Retries left: 0.
    2017-02-23T17:39:19.2847540Z /Users/developer/********/App.iOS/App.iOS.csproj: error : /Users/developer/********/bin/iPhone/$(Configuration)//App.ipa does not exist  at System.IO.File.Copy
    

    The ipa wasn't anymore generated with this fix..

    So I simply removed the PropertyGroup and the target and the process is working again.

    So it seems that, since the last update, xamarin has change the output location, which is now more convenient and not generated in a timestamp folder/file format.

    So no need anymore to add the PropertyGroup and Target.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, February 24, 2017 12:27 PM
  • User135518 posted

    Thank you Renaud. After upgrading our build machine we once again started having issues. Glad that the original workaround has been fixed, just wish it was made clearer that it was... Appreciate you updating the thread with the new information.

    Friday, March 10, 2017 6:04 PM
  • User286075 posted

    @RenaudLaloire , Thanks ... It was exact is happening with my build. for me, it solved.

    Tuesday, May 2, 2017 2:25 PM
  • User102813 posted

    According to the accepted answer, simply removing the copy (CopyIpa) routine will fix that particular issue, since the ipa is now moved to the correct location. But looking through the logs, I am seeing a bunch of items with '//' in file path. Not sure what else is going on that's not right. For us, our provisioning profiles are not working anymore. Builds pass, can't install.

    Anyone having any weird issues with Mono 5.0 on Mac OSX build server?

    Friday, July 28, 2017 5:42 PM