Solution-wide analysis gets lost with .ascx in different project
I have a problem using Resharper Solution-wide analysis and code completion features when woking on .ascx controls. My control is located in separate project in the same solution. All view files (aspx and ascx) are xcopied to target directory as a post-build task. The project is of class library type, but the problem exists if it is Web project, too. In my control .ascx file I'm specifying from what the control inherits and trying to use view model like this:
<%@ Assembly Name="WebEngine.CommonViews" %>
<%@ Assembly Name="WebEngine.Infrastructure" %>
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<WebEngine.Infrastructure.SettingsViewModel<System.Collections.Generic.IEnumerable<WebEngine.Infrastructure.News>, WebEngine.Infrastructure.NewsListSettings>>" %>
Assembly names, namespaces, type names are correct, the project references needed assemblies and everything compiles and runs OK. Resharper marks Control tag red with error "Cannot resolve symbol". And all code references in the .ascx file are red, too, so I have no code completion at all.
I am using JetBrains ReSharper 5.1 C# Edition
Build 5.1.1753.4 on 2010-10-15T16:51:30
Am I doing something wrong? Is it known issue? Is there any workaround for the problem?
Thanks in advance.
Please sign in to leave a comment.
Hello,
Could you please attach a small sample solution demonstrating this behavior?
Thank you!
Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Here is the simple MVC application with controllers and models in main project and views moved to separate one. The view marked as error is in ExternalViews - Views\Shared\NewsList.ascx.
I've noticed that ReSharper already understands references in my .ascx, but it has a problem with generic ones. I can specify the control like that:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
and there's no error, but I can't do it like that:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<System.Collections.Generic.IEnumerable<string>>" %>
When this view is in the main project, there's no error.
I believe that post-build copying view files is not a standard way of doing things, but it works and is helpful in my scenario, so it will be great if ReSharper would support it.
Attachment(s):
ResharperTest.zip
The same is when I replace post-build copying with embedding view files in resources. Resharper can't understand referenced generic types in external .aspx/.ascx files and mark it as errors, even if it already knows all the referenced assemblies.
Hello,
This seems to be a bug, so I've created a bug-report in our tracker: http://youtrack.jetbrains.net/issue/RSRP-204473
and you can vote for it. Thank you!
Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"