artificat zip file per build configuration

NAUSHAD JAMIL's Avatar

NAUSHAD JAMIL

12 Jun, 2019 09:22 PM

Currently we are doing build for debug and release.

When the build fires it launches two builds one is with the configuration=debug that zips the pacakge into debugbuild.zip and the other one with configuration=release and that zips the package to releasebuild.zip.

I am wondering if we can specify the same file name and the package will be stored as part of the build configuration. Just seems a bit more cleaner if that isolation is possible.

  1. Support Staff 1 Posted by Owen McDonnell on 12 Jun, 2019 09:52 PM

    Owen McDonnell's Avatar

    Do you mean that you have 2 jobs in a build and you want each one to produce an artifact with the same name but different contents?

  2. 2 Posted by Naushad Jamil on 13 Jun, 2019 08:27 PM

    Naushad Jamil's Avatar

    Here is how it is configured for our solution. We are building for each check-in both debug and release builds. Now appveyor UI distinguishes the debug and release builds. It appears the view when debug build is clicked is different than the one with release build. Why then should I see two different files as the artifact? I would like to see one artifact produced for each job/build. Same name for the files make more sense to me.

    Is this isolation achievable? Not that I can't leave with how it is but it is a bit confusing.

    The other alternative for me is to somehow specify a build configuration per Git repo. Say dev branch does the debug build and master does the release build. How do I do that?

    Thanks,
    Naushad

    [cid:74bab65e-31f0-494c-b6ca-80f26bbe5be9]

    ________________________________

  3. Support Staff 3 Posted by Owen McDonnell on 13 Jun, 2019 08:56 PM

    Owen McDonnell's Avatar

    Just deduplicate and switch your build command to use the %configuration% variable.
    i.e.

    msbuild <your_proj>.csproj /t:Package /p:Configuration=%configuration%
    

    As for your second question, precisely this scenario is described here.

  4. 4 Posted by Naushad Jamil on 14 Jun, 2019 07:33 PM

    Naushad Jamil's Avatar

    Sorry not quite sure what you mean by deduplicate

    We have these two msbuild command lines in project's Build tab settings.

    c
    msbuild ApfmWebServices\ApfmServices.csproj /t:Package /p:Configuration=Release /p:PackageLocation=WS3ReleaseBuild.zip /p:PackageAsSingleFile=True

    So both the job produces two *.zip files. I am thinking the debug job should build one file and the release job should build another file and there should be only one command line here. The output file can be the same (should be the same in my view).

    I tried
    msbuild ApfmWebServices\ApfmServices.csproj /t:Package /p:Configuration=%configuration%/p:PackageLocation=WS3.zip /p:PackageAsSingleFile=True

    It didn't work. Something was wrong with output file.

    Here is the error

    Project "C:\projects\core-ws3\ApfmWebServices\ApfmServices.csproj" on node 1 (Package target(s)).
    764<https://ci.appveyor.com/project/Place_For_Mom/core-ws3/builds/25292408/job/acjex9e34sp5bj0s#L764>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(780,5): error : The OutputPath property is not set for project 'ApfmServices.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='%configuration%' Platform='AnyCPU'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project. [C:\projects\core-ws3\ApfmWebServices\ApfmServices.csproj]
    765<https://ci.appveyor.com/project/Place_For_Mom/core-ws3/builds/25292408/job/acjex9e34sp5bj0s#L765>Done Building Project "C:\projects\core-ws3\ApfmWebServices\ApfmServices.csproj" (Package target(s)) -- FAILED.
    766<https://ci.appveyor.com/project/Place_For_Mom/core-ws3/builds/25292408/job/acjex9e34sp5bj0s#L766>
    767<https://ci.appveyor.com/project/Place_For_Mom/core-ws3/builds/25292408/job/acjex9e34sp5bj0s#L767>Build FAILED.

    Can you please give some detail instructions if what I am looking for is possible.

    Thanks,
    Naushad

    ________________________________

  5. Support Staff 5 Posted by Owen McDonnell on 14 Jun, 2019 10:21 PM

    Owen McDonnell's Avatar

    In the screen shot you are calling the exact same msbuild command for each configuration. If you only want one artifact per configuration then deduplicate (remove one of the commands) and make the confiugration a parameter.

    I didn't notice that you have the script set to powershell. In that case replace %configuration% with $env:configuration (the proper powershell syntax for accessing environment variables).

  6. Ilya Finkelshteyn closed this discussion on 15 Aug, 2019 09:01 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac