Search Unity

Question Roslyn Analyzer applying outside of Assembly it belongs to

Discussion in 'Editor & General Support' started by hugeandy, Aug 5, 2021.

  1. hugeandy

    hugeandy

    Joined:
    Nov 2, 2016
    Posts:
    131
    Hi all,

    I have written a custom Roslyn Analzyer which I want to apply to all of our code within our project. I have this mostly working, however I have the problem that the analyzer is also running on code from imported store assets which I don't want. From my understanding of the docs, this shouldn't be happening.

    Our project layout is
    Code (CSharp):
    1.  
    2. Assets/
    3.     Scripts/
    4.       analyzers/
    5.          CustomAnalyzer.dll
    6.       OurScripts.asmdef
    7.    Store/
    8.       StoreAsset1/
    9.       StoreAsset2/
    10.  

    All of our scripts are children of Assets/Scripts, and end up in the OurScripts assembly. The analyzer is in Assets/Scripts/analyzers. The store assets have no asmdefs so end up in the default assembly.

    The analyzer is correctly raising issues in our code, however it also raises errors from scripts in the Store folder.

    The docs say
    The analyzer is in a subfolder of folder which contains an assembly definition file so, as per the docs, it should be only applying to the assembly generated by that assembly defition file.

    Any ideas?

    Cheers,
    Andy