Why is Resharper Code Cleanup adding unnecessary import namespaces in ascx files?

Using Resharper 6.1 on Visual Studio 2010 I'm trying to do some basic code cleanup on a c# Web Application project.
In this process Resharper keeps adding a set of unnecessary import namespaces in some ascx files. Immidiately after Code cleanup is completed Resharper is suggesting that the using directive is not required and suggesting to remove them.

<%@ Import Namespace="System.Web.DynamicData" %>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="System.Web.UI.WebControls.Expressions" %>
<%@ Import Namespace="System.Web.UI.WebControls.WebParts" %>

Have anyone else experienced this?
I have tried changing the settings in R# Options > Code editing > Namespace Imports, and also disabling optimize Register directives/Using directives in ASP.NET and C# section in Code cleanup, but still it keeps adding these imports.

I should add that these imports are not used specifically in any parts of our application so why R# thinks I need them is a mystery.

Comment actions Permalink

Hi Kenneth,

I beleive it was a known issue for ReSharper 6.1, which should be fixed in new ReSharper versions.

1. If you have 6.x license only, please try 6.1.1 from here: http://resharper-support.jetbrains.com/entries/21206508-Where-can-I-download-an-old-previous-ReSharper-version-
2. If it won't help, you may try to use ReSHarper 8 EAP, which can be used in evaluation mode for free: http://confluence.jetbrains.com/display/ReSharper/ReSharper+8+EAP.


Comment actions Permalink

Thanks. I will give it a go.

Comment actions Permalink

This solved the issue. Thanks


Please sign in to leave a comment.