nuiget with multiple build configurations

theraot's Avatar

theraot

17 Jun, 2015 03:59 AM

I have a project with build configurations for each framework version, I want to create a nuget from it using appveyor... but appbeyor only allows me to specify one build configuration for the nuget.

What I want is to be able to select a build configuration for each framework version for a single nuget*. As I understand nuget supports this: http://docs.nuget.org/Create/Enforced-Package-Conventions

I don't want to mess a nuget - because nuget.org won't make it easy to delete nugets made for experimentation (see: http://docs.nuget.org/create/deleting-packages ). For instance I had deleting my project from appveyor multiple times in order to get the build configuration right and still have the first build be 1.0.1 - similar experimentation won't be viable with nuget.org.

Note: notifying the user that a build has no artifacts configured would have saved some time, also noting that the path to the artifacts is relative to the solution folder in the settings form. What is deployment name for?

Alternatively - is there a way to execute all the builds in a single configuration so I can build the nuget structure? - I would prefer if this could be automated since scripting it sound error prone [and you know... nuget.org].

  1. Support Staff 1 Posted by Feodor Fitsner on 17 Jun, 2015 02:11 PM

    Feodor Fitsner's Avatar

    Well, not everything is supported out of the box. I think for your case the best way to go is to use your own build commands/script without automatic packaging.

    - Feodor

  2. 2 Posted by theraot on 18 Jun, 2015 11:33 PM

    theraot's Avatar

    I'm guessing I'll have to call MSBuild from the script to do the build, and maybe I'll have to call nuget.exe. If this script will run in appveyor... that brings some questions:

    - What will be startup path of the scripts?
    - Will msbuild be in PATH enviroment variable?
    -- If not, will I have to fully specify the path? if so... may it change in the future?
    - Will nuget.exe be in PATH envirment variable?
    -- if not, will I have to fully specify the path? if so... may it change in the future?
    - Will I be able to copy and move files from the script?
    - Once a nuget package is done will appveyor deploy it? I assume the nuget enviroment expecta the assemblies not the nuget package.

  3. Support Staff 3 Posted by Feodor Fitsner on 19 Jun, 2015 01:04 AM

    Feodor Fitsner's Avatar

    Sure, answering your questions:

    • Script startup path is %appveyor_build_folder% (C:\projects\<project-slug>)
    • msbuild 12.0 is in PATH (C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe). I don't expect changing that to msbuild 14.0 soon. Other than that all msbuilds (4.0, 12.0, 14.0) are installed in their standard locations.
    • nuget.exe is in PATH and will be always there. Though from time to time we upgrade it to more recent versions.
    • you can copy/move files or whatever you need to run your tests - you are admin on build machine
    • you can setup nuget deployment. First, push nuget package to artifacts and then add nuget deployment provider.
  4. 4 Posted by theraot on 23 Jun, 2015 11:02 PM

    theraot's Avatar

    Ok, I have figured how to do this via script.

    For anybody with a similar problem this is my final script: https://github.com/theraot/Theraot/blob/master/build.bat

    [ https://github.com/theraot/Theraot/blob/6fb136c6ad939496a3463a16c32e0e1bf531c598/build.bat ]

    All I put in appveyor is:

        .\build.bat

    I want it in source control because it helps to change it as needed. Otherwise I would have to change it manually in appveyor and the only way to test it would be to have some builds fails. And if I'm having the script on the repository it makes sense to make it useful to anybody who may want to download the source. So I want it to work without appveyor.

    I have made my build configuration match the names of the folders in the nuget structure to make it easier to build the nupkg.

    The script will read PATH or fallback to default locations for MSBuild.exe and NuGet.exe if they are not available there. For the later, the nuget NuGet.CommandLine was added to the project so NuGet.exe is in the repository.

    There is also a version autoincrement mechanism for the nuget (because we don't want two nugets with the same version).

    Appveyor will start building automatically and some builds will - probably* - fail. I have to choose between maually setting the version in appveyor before I push to master to make it sync with nuget (which complicates my life) or consider that the version numbers have different meaning. I opted for different meanings:
    - appveyor: build history.
    - nuget: semantic versioning: http://docs.nuget.org/Create/Versioning#really-brief-introduction-to-semver

    *: I tend to test to build on Develop branch - yet, it happens.

    I know I could have my script read the version from appveyor and have the nuget use that version... but that means that the script wont work without appveyor - unless some other trickery is involved -. And as I said, I don't want that.

    ---

    I still think this can be supported by appveyor, if anything take the script for guide.

    Another suggestion is to add links to the documents contextually (ie: in build link to http://www.appveyor.com/docs/build-configuration - in artifacts link to http://www.appveyor.com/docs/packaging-artifacts and so on).

  5. Support Staff 5 Posted by Feodor Fitsner on 23 Jun, 2015 11:30 PM

    Feodor Fitsner's Avatar

    Nice, thanks for sharing your solution!

  6. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:57 AM.

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

 

26 Sep, 2024 03:49 PM
26 Sep, 2024 09:02 AM
25 Sep, 2024 07:07 PM
24 Sep, 2024 08:39 PM
24 Sep, 2024 06:47 AM
20 Sep, 2024 05:50 PM