Search code examples
c#visual-studioresharperprojects-and-solutions

How do you mark implicitly loaded assemblies for an entire team?


The repository we work in contains multiple applications and services, and a whole bunch of DLL files that are shared among many of them. We have a form of inversion of control in place to keep the size of the individual applications smaller by leaving out DLL's that are not used. The DLL's are referenced by the solution that produces the .exe or service.

This works. However, Visual Studio and Resharper mark these references as unused, as no code explicitly references anything inside of these DLL references (they are implicitly being used through interfaces). This causes some newer developers to try and clean the references through Resharper by using its optimize references functionality. This causes the DLL's to not be shipped with the application leading to problems in runtime.

I'm looking for a way to mark a project as "used at runtime" which is possible in Resharper. See Retain references to implicitly loaded assemblies in the Resharper documentation.

The result is exactly what I want, but this setting is stored in the user settings. Not in the project settings or in the shared settings of Resharper. While adding the user settings to the repository is technically possible, this would lead to undesired results as other developers might have customized their Resharper settings.

I've tried to copy the values from the .DotSettings.user to the team shared variant. But this does not seem to work.

Is there any way to achieve the same result, but team-wide?


Solution

  • The following part of the docs, unfortunately, does not indicate this:

    ReSharper will save the information about implicitly used references in its layered settings — in a *.DotSettings.user file either for the project or solution.

    As you have already discovered, the *.DotSettings.user file sometimes contains locally scoped settings and I think this is another one.

    But nonetheless, I think it's worth contacting JetBrains and raising a feature request.