Is there a way I can get Resharper to ignore an unused link?

Using Resharper, we can right-click the "Links" link for the project and select "Optimize Links". It shows class libraries that are not used or not required by the compiler.

I have a class library that should only be used as a reference (you never need to use code). The DLL is configured to enter itself at startup while it is part of the links. In case you are wondering why this was ever done, it handles errors not found for ASP.NET MVC projects ( Nuget package page ).

Is there any possible way that I can tell Resharper that this link is either part of the compiler required, or part of the links used? I just want to try and prevent the developers from deleting my DLL in case of an accident.

+5
source share
1 answer

You can associate Resharper with StyleCop. It allows you to warn in your code based on StyleCop settings. For each warning, there is a way (using the "Resharper bubble") to turn off the warning: http://tof.canardpc.com/view/49d10973-eb25-4a26-90b2-19d872083285.jpg

it adds a comment line to your code to turn off warning on warning;

// ReSharper disable once RedundantUsingDirective using My.Unused.Reference; 

After some tests, saldy, it seems Resharper doesn't care about this when you run "Optimize Link"

+1
source

Source: https://habr.com/ru/post/1207452/


All Articles