Search Unity

WarnAsError only on Specific Assembly's

Discussion in 'Scripting' started by DriesVienne, Jun 7, 2019.

  1. DriesVienne

    DriesVienne

    Joined:
    Jun 22, 2013
    Posts:
    27
    Hi,

    In our team, we enforce 'Warnings as errors' through the use of a
    -warnaserror+ flag in a csc.rsp file,
    placed in our assets folder.

    Since some packages generate warnings, we where wondering if it was possible to enable 'Warnings as errors' only for our 1st party code.

    Right now we don't use assembly definitions in our current projects,
    so that would come down to only enabling 'Warnings as errors' in the following assembly's:
    Assembly-CSharp
    Assembly-CSharp-Editor

    We might separate our code in multiple assembly's in the future, so if there is any nuance when using
    .asmdef files, that would be helpful to us as well.

    Is it possible to only enforce this rule on our code?
    Are there other solutions we might conciser?

    Greetings,
    Dries.
     
  2. DriesVienne

    DriesVienne

    Joined:
    Jun 22, 2013
    Posts:
    27
    I'm not one for bumping forum posts,
    but this is still relevant for us.

    I'm also generally curious.

    Are there really no thoughts on this matter?

    Greetings,
    Dries.
     
  3. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    Afaik, if you place a csc.rsp next to an asmdef file, that csc file is only relevant to the assembly that asmdef defines. So if you put your code into assemblies using asmdef files, you could target only your code with the warnaserror flag.

    Not 100% sure about exactly how this works, so for sure test it before you try to implement it full scale.
     
  4. DriesVienne

    DriesVienne

    Joined:
    Jun 22, 2013
    Posts:
    27
    Thank you for your reply!

    Will keep an eye out if we decide to start using asmdef files in future projects.
    It frustrates me slightly that I can't piece together more info on this.