KamiSzu
KamiSzu
CC#
Created by KamiSzu on 1/5/2025 in #help
Need help with Rolsyn analyzer with referencing assembly in tests.
Hi. I've started to playing arround with analyzers and I faced big obstacle in tests when referencing attribute which lies in analyzer project. repo https://github.com/MalwareX95/SampleAnalizer; Here I'm tring to just make this work so that namespace could be found, but no luck. I'd would be very glad if someone could take a look at this.

var code =
"""
using SampleAnalizer;
""";

var test = new CSharpAnalyzerTest<StaticFieldAnalizer, DefaultVerifier>
{
TestCode = code,
ReferenceAssemblies = ReferenceAssemblies.Net.Net80.WithAssemblies([typeof(StaticField).Assembly.FullName!, typeof(StaticField).Assembly.Location])
};

await test.RunAsync();

var code =
"""
using SampleAnalizer;
""";

var test = new CSharpAnalyzerTest<StaticFieldAnalizer, DefaultVerifier>
{
TestCode = code,
ReferenceAssemblies = ReferenceAssemblies.Net.Net80.WithAssemblies([typeof(StaticField).Assembly.FullName!, typeof(StaticField).Assembly.Location])
};

await test.RunAsync();
1 replies