Search Issue Tracker
Won't Fix
Votes
0
Found in
2018.2.16f1
2018.3.0a1
2019.1.0a1
2019.2.0a1
Issue ID
1101950
Regression
Yes
Code Analysis Settings in Visual Studio are reset when Launching Unity
How to reproduce:
1. In the attached "case1101950" project folder open case1101950.sln in Visual Studio
2. In the Solution Explorer window right-click Solution 'case1101950' and select Properties
3. In the Properties window go to Common Properties->Code Analysis Settings
4. Change the Rule Set from "Microsoft Managed Recommended Rules" to "Microsoft All Rules" then click Apply and OK
5. Save the changes and exit Visual Studio
6. Open the project in Unity
7. In the Project window Open NewBehaviorScript in Visual Studio
8. In the Solution Explorer window right-click Solution 'case1101950' and select Properties
9. In the Properties window go to Common Properties->Code Analysis Settings
Expected result: Rule Set is set to "Microsoft All Rules"
Actual result: Rule Set is reset to "Microsoft Managed Recommended Rules"
Reproducible with: 2018.3.7f1, 2019.1.0b4, 2019.2.0a6
Not reproducible with: 2017.4.21f1
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- The Scene View becomes gray and "NullReferenceException" errors are thrown when attaching the Unity Editor process to RenderDoc
- Memory usage rapidly rises when changing colors in the color wheel
- Physically Based Sky's Horizon and Zenith Tint Color Selection Bars don't have immediate access to color pickers
- EmptyAdditionalLightShadowmapTexture leaks from memory when URP quality level is changed using QualitySettings.SetQualityLevel
- Referenced ScriptableObject field does not get updated and cannot be set to "None" when there are no Objects of that type
Resolution Note (2020.2.X):
The problem is with the integration of a third party tool Visual Studio. We have made Microsoft aware of the issue and their response was:
The root issue is that advanced users are customizing csproj, in this case with extra tags like <RunCodeAnalysis> or <CodeAnalysisRuleSet>.
We already re-process the solution to find external project references, but we don't have someting similar to re-process csproj files.
Now that we have Directory.Build.props and Directory.Build.targets files auto-imported by MSBuild, it should be enough to move all the user customizations in those files, instead of the generated csproj.
If you have additional questions I would suggest that you contact Microsoft.