-->

Visual Studio 2017 disable Dependency Validation

2020-08-11 10:17发布

问题:

How to disable Dependency Validation in Visual Studio 2017 RC? Whenever I open C# solution it always shows me a message in the Solution Explorer: "One or more projects needs to be updated to perform dependency validation" with an Update button. When I opened it for the first time, it performed some automatic update of packages and config files that I had to remove later.

I need to share the solution between VS2017 and VS2015 and don't want to introduce any backward incompatabilities.

回答1:

You can disable it by language.

Go to Tools -> Options -> Dependency Validation:



回答2:

The changes made to the projects are compatible with Visual Studio 2015 Update 2 or later.

All the project update does is add a reference to the Microsoft.DependencyValidation.Analyzers NuGet package, and add a link to the dependency validation model file as an AdditionalFile so that it is passed to the Roslyn analyzers.

The dependency validation analyzers use Roslyn 1.2 (which shipped with VS2015 update 2), rather than the newer version of Roslyn that shipped with VS2017 precisely so that the analysis would work in older versions of Visual Studio.

The Tools-Options-Dependency Validation option does exactly what the description in the dialogue says: it controls whether a warning is shown in a gold bar if you are using dependency validation (i.e. have a solution with a modeling project with a dependency validation diagram) but have the code analysis setting full solution analysis turned off. Jean-Marc Prieur's blog post explains why you might want to turn full solution analysis on when using dependency validation.



回答3:

If you really want the link to be gone, check the last post on this page:

https://developercommunity.visualstudio.com/content/problem/102206/one-or-more-projects-needs-to-be-updated-to-perfor.html

"I had the same issue, I remove "Architecture and analysis tools" (in VS setup, right side under ".NET desktop development") and this "dependency validation" does not show up anymore (but be aware that you can't load modeling project types anymore)"

Works like a charm!