Closed gregbair closed 2 years ago
This is the lowest version of the package the source generator testing framework can support. If we reference a newer version, we are making it impossible to test some scenarios. @sharwell do you agree this is by design?
Yes, this is by design. Test projects should install the SDK, and also install the correct version of the code analysis packages to meet their project needs.
SDK
Quick question, i just ran into this issue and im a bit confused on what to do,
I need my test projects to use v4.4.0 because in 3.8.0 older versions BaseNamespaceDeclarationSyntax
does not seem to be defined.
I tried manually adding v4.4.0 to my test project, but that caused runtime errors.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Nullable>enable</Nullable>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>Generated</CompilerGeneratedFilesOutputPath>
<IsRoslynComponent>true</IsRoslynComponent>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.4.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.MSTest" Version="1.1.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.0" />
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.4.0"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\OPG.SourceGenerator.AutoMapper\OPG.SourceGenerator.AutoMapper.csproj" />
</ItemGroup>
</Project>
@sommmen can you open a new issue for that?
@sommmen can you open a new issue for that?
I decided to go another route and am no longer in need of this.
Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.MSTest
v1.1.0 referencesMicrosoft.CodeAnalysis.CSharp
v3.8.0.The latest version of the latter package is 3.11.0. This causes package conflicts when trying to use both in the same solution, without specifying 3.8.0 for the
Microsoft.CodeAnalysis.CSharp
package.