Closed buzzers closed 2 years ago
3.8.0 is the minimum version. You can explicitly reference a newer version of Microsoft.CodeAnalysis to use a specific version in tests.
@sharwell
dotnet new xunit -o sourcegenerator-xunit
cd sourcegenerator-xunit
dotnet add package Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.XUnit
dotnet add package Microsoft.CodeAnalysis.CSharp
and I get error error: NU1107
.
Microsoft.CodeAnalysis.Common
v4.1.0dotnet add package Microsoft.CodeAnalysis.Common
I get a warn warn : NU1608
, and then retry add Microsoft.CodeAnalysis.CSharp
, get warn warn : NU1608
.
After manually referencing the Microsoft.CodeAnalysis.Common
package, the test can be successfully run, but there will be a warning NU1608
. Is this no problem, how to eliminate it?
dotnet add package Microsoft.CodeAnalysis.CSharp
This line is the problem. To bring in the full set of dependencies with the higher version, you need to do this:
dotnet add package Microsoft.CodeAnalysis.CSharp.Workspaces
@sharwell It's working fine now, thanks.
Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.XUnit
v1.1.1 referencesMicrosoft.CodeAnalysis.CSharp.Workspaces
old v3.8.0 version.I found an issue (#891) related. However, according to its description, I references the new version of the package ( v4.1.0 ) is referenced in my test project, but the compilation still fails.
Do I have to use v3.8.0, or is there another workaround?