Custom msbuild property

Matt Calhoun's Avatar

Matt Calhoun

13 Feb, 2015 03:30 PM

I am wondering if there's a way to add a custom property to msbuild through the UI?

Since I haven't seen a way, I have also tried using a build script by copying the msbuild command from the console and adding the property, but that seems to fail as well...

msbuild ".\MyProj.sln" /verbosity:normal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /p:DeployOnBuild=True /p:PublishProfile=appveyor /p:MyProp=true

  1. Support Staff 1 Posted by Feodor Fitsner on 13 Feb, 2015 05:21 PM

    Feodor Fitsner's Avatar

    MsBuild properties could be specified in environment variables. Just try setting MyProp environment variable.

  2. 2 Posted by chris on 23 Jun, 2015 10:04 PM

    chris's Avatar

    I'm looking to do something similar.

    @feodor can you explain how that would work specifically. If I wanted to add /p:_DestinationType=AzureWebSite as an option to my msbuild, how could I do that through environment variables?

  3. Support Staff 3 Posted by Feodor Fitsner on 23 Jun, 2015 10:08 PM

    Feodor Fitsner's Avatar

    Just add _DestinationType variable on Environment tab of project settings (or setup it in appveyor.yml).

  4. 4 Posted by chris on 24 Jun, 2015 03:37 PM

    chris's Avatar

    thanks @feodor. I did add that environment variable to the Environment tab on the build settings, but I did not see it added when msbuild was called. This is the entry from my log msbuild "src/MyProject.csproj" /m /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /p:DeployOnBuild=True /p:PublishProfile=appveyor

  5. Support Staff 5 Posted by Feodor Fitsner on 24 Jun, 2015 05:11 PM

    Feodor Fitsner's Avatar

    Right, it shouldn't be added to the command line, but any environment variable can be referenced in build file (.proj, .targets) as $(variable_name), so if you have $(_DestinationType) somewhere in MSBuild project and define environment variable with the same name that should work.

  6. 6 Posted by chris on 24 Jun, 2015 06:03 PM

    chris's Avatar

    Got it! thank you.

    Would you consider adding the ability to pass additional command switches to the msbuild.exe from the interface and yaml? Today we have Configuration, Platform, and Project file...But I would propose adding a 4th text box called Options || Command Line Params which would support custom command switches. This is typical in other CI servers like Bamboo and TeamCity and would love to see that here as well. Thanks again.

  7. Support Staff 7 Posted by Feodor Fitsner on 24 Jun, 2015 06:18 PM

    Feodor Fitsner's Avatar

    Sure, though you can always switch to a custom msbuild command.

  8. 8 Posted by chris on 24 Jun, 2015 07:03 PM

    chris's Avatar

    That's exactly what I'll do for now, thank you.

    The main advantage I see to what i'm proposing though is leveraging the ease of configuration and the automatic packaging options. Once I go to command line, all of that is on me. That's certainly a fine work around, but it definitely takes away from simplicity you have here....which so many other CI servers are missing.

  9. 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


? 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