Tooling: No quick actions (add using statement for namespace) available when editing Razor views

Created on 23 Jul 2015  路  10Comments  路  Source: aspnet/Tooling

Originally posted as https://github.com/aspnet/Mvc/issues/2849 by @lenardg

When editing .CS code, if I enter a class name that was not used before, and if I have not referenced the namespace this class belongs to, I am offered quick actions that reference the namespace on my behalf. I do not need to check which namespace the type belongs to, nor do I have to go to the top of the file to add that.

It would be nice if a similar user experience could be enabled in the tooling when editing Razor views. Currently if I enter a class name that is missing a namespace or a using statement, I get the red squiggle under the name but no quick actions or help from Visual Studio. I need to remember or look up the namespace and add the reference by hand.

(VS2015RTM, ASP.NET beta5)

Issue Tracker Notification Posted TFS Tracked

Most helpful comment

From a user's perspective this probably feels like a regression since this functionality effectively exists in the VS2013 editor. After upgrading to VS2015 I honestly though my installation was _broken_ until I discovered this known issue.

All 10 comments

Another quick action missing:

When added a @using statement to the view, but still referenced the @model with full namespace, the editor is clever enough to gray out the namespace before the model class - as it should.

But there is no quick action to actually remove the grayed out parts. Somebody new to VS might not even understand why it is suddently gray.

@madskristensen @billhiebert thoughts?

@ToddGrun

From a user's perspective this probably feels like a regression since this functionality effectively exists in the VS2013 editor. After upgrading to VS2015 I honestly though my installation was _broken_ until I discovered this known issue.

I'm really having trouble following the thread of links to other issues and suggestions. Hopefully this issue is still open because this is pretty rough to not be able to just plop something like @Model.SomeNewPropertyName in your .cshtml and then do a CTRL + . to generate the property.

Hello, just switched to VS2015 from VS2013 and this issue feels like major drawback. It was not ideal in VS2013 either. Only option to resolve type is VS2013 razor editor was to inline full namespace for unknown type using smart tag, than move it to using directive by hand. In VS2015 it doesn't work. Please consider two options for VS2015, inline namespace and add using directive.

It's really disappointing to see this not fixed in Update 2 :(

TFS Bug#231272

The GitHub Issue Tracker for the aspnet/Tooling repo is being deprecated in favor of Visual Studio's Report a Problem tool.

If this issue is still a problem with the RTW release of Visual Studio 2017, please report a new issue using the Report a Problem tool. While you can still use .NET Core and ASP.NET Preview tools with Visual Studio 2015, Visual Studio 2017 is now the officially supported tool for developing .NET Core and ASP.NET Core projects.

By using the Report a Problem tool (available in both VS 2017 and VS 2015), you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks. See Visual Studio's Talk to Us page for more details.

Please use the discussion topic here for feedback and questions on the deprecation of this issue tracker. Thanks!

Still not fixed in update 3? And i blamed resharper :)

Was this page helpful?
0 / 5 - 0 ratings