Skip to content

[msbuild] Post-build msbuild targets firing before IPA creation #7139

Closed as not planned

Description

@vsfeedback

This issue has been moved from a ticket on Developer Community.


(obviously it's xamarin-iOS-project with some mac paired)

My post-build event command line is something like
copy c:\MyProj...\bin\MyProj.ipa f:\MyProj.ipa

variant 1:
no ipa file existing (because bin-folder deleted, after clean, ...)
I get after build error msg "File does not exist"
and the ipa-file is not created

variant 2:
old ipa file is existing
no error msg after build, the copy command is executed before creating the new ipa
in C:...\bin\ I see the new ipa file but in F:\ I see the old file.

I would expect that "post-build event command line" is called really after Build completed.
(With VS2017 it did work)

Regards, Holger Gothan.


Original Comments

Visual Studio Feedback System on 9/12/2019, 02:49 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Emanuel Fernandez Dell'Oca [MSFT] on 9/17/2019, 11:49 AM:

Hi @Holger Gothan,
Could you attach a Diagnostic build output after reproducing this problem (it’d be great if you could do so for each variant you mentioned)? If you’re building from inside Visual Studio you can change the build output verbosity from Tools -> Options -> Projects and Solutions -> Build and Run -> MSBuild project build output verbosity

Thanks for reporting!

Markus Friedrich on 9/18/2019, 01:52 AM:

(private comment, text removed)

Emanuel Fernandez Dell'Oca [MSFT] on 9/27/2019, 10:47 AM:

Hi,
Sorry for the late response and thanks for the attached build outputs. We’ve been able to reproduce this problem, and it seems to be an issue on the core targets of the Xamarin.iOS SDK, so I’ll assign this ticket to that team so they can furtherly investigate it.

On the meantime, I think you can add a target that runs after the build finishes as a workaround, like the following:
<Target Name="_CopyLocalIpa" AfterTargets="Build">

<Exec Command="copy command used on the PostBuildEvent" />

</Target>


You’ll need to add that target in your csproj file right before the **</Project>** closing tag.

Thanks!

Visual Studio Feedback System on 9/27/2019, 10:49 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Holger Gothan on 9/30/2019, 08:53 AM:

the is a good workaround. thx


Original Solutions

(no solutions)

Activity

  1. changed the title [-]VS2019, 16.2.5, post-build event command line is executed before creating ipa file[/-] [+][msbuild] Post-build msbuild targets firing before IPA creation[/+] on Sep 30, 2019
  2. added
    bug
    help wanted
    msbuild
    on Sep 30, 2019
  3. added this to the Future milestone on Sep 30, 2019
  4. added
    good first issue
    on Sep 27, 2022
  5. removed
    good first issue
    help wanted
    on Oct 7, 2025
  6. rolfbjarne commented on Oct 7, 2025

    @rolfbjarne
    Member

    I don't think we'll fix this, because it requires changing the orderings tasks and targets are executing, and this is rather fragile and can have a lot of unintended side effects.

    Additionally there are multiple ways to accomplish the same goal, all trivial to implement:

    1. The original workaround that was posted, by adding this to the csproj:
    <Target Name="_CopyLocalIpa" AfterTargets="Build">
        <Exec Command="copy command used on the PostBuildEvent" />
    </Target>
    1. A similar solution, just after the CreateIpa targets:
    <Target Name="_CopyLocalIpa" AfterTargets="CreateIpa">
        <Exec Command="copy command used on the PostBuildEvent" />
    </Target>
    1. Set the IpaPackageDir or IpaPackagePath properties to the desired location of the .ipa, avoiding the need to copy it around in the first place.
    <PropertyGroup>
        <IpaPackageDir>/path/to/local/ipa/directory/</IpaPackageDir>
    </PropertyGroup>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmsbuild

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions