Migration Not Working - want to resolve having both old and new connected mode settings

  • Operating system: Windows 10
  • Visual Studio version: VS 2022 Enterprise
  • SonarLint plugin version: 7.5.0.82292
  • Programming language you’re coding in: C#, HTML
  • Connected to SonarQube Enterprise Edition Version 10.3 (build 82913)

I have been working a C# solution using SonarLint in Visual Studio 2017 with no problems. Then I upgraded to VS 2022. As soon I open the same solution in VS 2022 I got a warning along the top of the frame saying that I needed to migrate because the connected mode settings were old. After performing the migration, I did a pull request, but the build failed saying "Error MSB3030: Could not copy the file “….sonarlint\abbf62af-47b6-4fa0-92dd-18f66ef975e3csharp.ruleset” because it was not found. I assume this was because it was part of the old settings. So, I reverted the changes and ran another pull request - this time the PR succeeded. But when I open the solution now, I get a warning that says “SonarLint: You have both old and new connected mode settings. Please Migrate again to clean up the old settings.” I ran the migration again and did a pull request again, but it failed again because of the same missing .ruleset file. Please help.

Hello @sheeand, and welcome to the Community!

There might have been an error where our migration wizard couldn’t properly clean up the references from csprojs, which would explain the error you get on the CI.

Could you please verify a few things after running the migration:

  • .sonarlint folder is deleted from your repository
  • Any references to ruleset files are removed from your .csproj files
    An example would be
<ItemGroup>
    <AdditionalFiles Include="..\.sonarlint\slvs_samples_bound_vs2019\CSharp\SonarLint.xml" Link="SonarLint.xml" />
</ItemGroup>

OR

<CodeAnalysisRuleSet>..\.sonarlint\slvs_samples_bound_vs2019csharp.ruleset</CodeAnalysisRuleSet>
  • These changes are committed

If you perform the steps above and still see the error, we kindly ask you to provide a minimal repro for this issue so we can debug and fix it.