none
command line switches multiple times RRS feed

  • Question

  • I have built a custom element that uses a custom compiler. Now, if I have something like a StringProperty for my task, then I can add a "Switch" value... let's say 'Switch="/myOption [value]"' ... this works fine. Now, what if I want to allow multiple values here? E.g. value is "option1,option2" ... is there a way to directly tell MSBuild to generate a 'Switch' that looks like this: "/myOption option1 /myOption option2" ... or is that impossible? (I'm doing it with a script currently, but I was wondering if there's an easier way)

    Rudolf

    Sunday, October 20, 2019 2:44 PM

Answers

  • Ah... found it (by reading the source of MSBuild)

    if you want multiple /myOption, you must make this value of type "StringListProperty" and if you want a "StringListProperty" to behave differently you can define it's behaviour with the CommandLineValueSeparator Option and ask for something like /myOption val1,val2 ...

    Rudolf

    Sunday, October 20, 2019 8:10 PM

All replies

  • Ah... found it (by reading the source of MSBuild)

    if you want multiple /myOption, you must make this value of type "StringListProperty" and if you want a "StringListProperty" to behave differently you can define it's behaviour with the CommandLineValueSeparator Option and ask for something like /myOption val1,val2 ...

    Rudolf

    Sunday, October 20, 2019 8:10 PM
  • Hi Rudolf,

    Welcome to the MSDN forum.

    We are glad to hear that you have solved your issue. Congratulations to you.

    > > Besides, please do not forget to mark as answer since you have solved it and it will help other community members search and handle similar issues.

    > > If you have any other issues about MSBuild in the future, you should start a new post to let us know.

    Have a nice day.

    Best Regards,

    Perry


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Monday, October 21, 2019 4:32 AM