How to enable/disable specific ReSharper feature - asp.net-mvc

How to enable/disable ReSharper(?) feature on screenshot?
Visual Studio 2013,
ReSharper 8.1

There are 2 answers to this question: the first one is WHY??? This feature allows you to Ctrl+Left Click (or by selecting Go to Definition (Ctrl+B in IDEA keyboard scheme, F12 in Visual Studio keyboard scheme), it asks you where you want to go: either to the List.cshtml view (deduced by the List() action inside your controller), or to the definition of the base.View() method, which will be decompiled automatically by ReSharper (if you have decompilation enabled in ReSharper Options).
If in any event you want turn off those features for ASP.NET MVC, you can do this in ReSharper Options by going to Code Editing → ASP.NET → MVC, and unchecking Enable ASP.NET MVC References. Please note that this will disable ReSharper's enhancement of all ASP.NET MVC elements - HtmlHelpers in ActionLinks, etc.

Related

How can add controller in ASP.NET MVC6 beta5 project?

i'm install Visual Studio 2015 final release and create mvc6 beta5 project (by default template).
Trying add controller as in mvc 5.2 (also in vs2015 final release):
but, in mvc6 beta5 project this menu missing:
1. How solve the problem?
UPD
2. Is it possible add mvc6 controller with generate views?
Prior to MVC 6.0 the notion of an MVC Controller and a Web API Controller were somewhat different. To the untrained eye, they looked similar but they did behave differently and were using different classes.
Hence why when you clicked the Controller… option, you had the ability to choose between an MVC Controller and/or a Web API Controller.
As of MVC 6.0, both MVC and Web API controllers have now been unified. They are now exactly the same thing and are using the same classes.
So you don’t really have the need to choose between an MVC Controller and a Web API Controller.
Simply click the Add New Item which in turn will open the Add New Item dialog.
From the Add New Item dialog in the top right search textbox, enter Controller.
You’ll be able to select the MVC Controller Class template.
Who knows...maybe by the time they ship the final product, they’ll bring it back but at least for now, this shouldn’t be a show stopper.
EDIT:
For the scaffolding stuff, perhaps this link might help.
to solve this go to project.json
then add the following dependency:
"Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final"
then you should be able to right click controllers folder and see the new controller button appear
I am facing the same issue for visual studio 2015 community edition, followed following steps and restarted visual studio. It resolved my issue
1)Open VS2015=>TOOLS=>Customize.
2)Select Commands.
3)Select Context menu.
4)Select Project and Solution ContextMenus|Folder|Add.
5)Check that 'Controller' appears.
6)IMPORTANT -Move up Controller item to the top.
7)Restart visual studio

Mixing MVC and Webforms - Displaying BOTH Context Menus

I have added MVC4 to an ASP.NET Webforms project in Visual Studio 2010.
I changed the .csproj's project type to that of an MVC4 project as detailed here:
Context menu to Add Controller/View missing
to give me the MVC specific context menus.
Now the ASP.NET Webforms context menus (such as add 'UserControl') are gone.
How can I hack VS2010 to give me both the MVC4 and ASP.NET context menus for a given project?
In short and officially: no, this is not possible (disclaimer: I'm a software engineer at Microsoft who used to work on Visual Studio + Blend, but now Internet Explorer).
In Visual Studio, a project only has a single type, and the "ASP.NET Web Application" (WebForms) and "ASP.NET MVC Application" (ASP.NET MVC) are two different project types - they're very similar and share common features, but are still different types.
The MVC project type does not have UserControls and other Items in the Add New Item dialog or context-menus because they're largely irrelevant and wouldn't work as you expect them to (granted, it is possible to have WebForms (and not just using .aspx files as Views)) but I don't think it's a good application-design decision.
Unofficially... the items that appear in the Add New Item dialog are specified in the registry. This is documented here: https://msdn.microsoft.com/en-us/library/bb165141.aspx however this information is intended for developers of new project types, rather than allowing users to modify their own (and certainly you're at risk of breaking your VS if we release another update which makes assumptions about how your Add New Item templates are configured).
If you want to do it this way - go ahead, but be careful, and make a note of everything you do so you can undo it.
Since the IDE is based on working in single mode, It seems we have 2 ways:
Attempt to use a configuration that is done an OR action between two project types, so we have both of them, but lack of true functionality is demanded :(
Write some lines of C++ code to change configuration immediately (based on tip here), so you have a switcher application to run when you want :)

Aren't there supposed to be MVC 3 controls in the VS 2010 toolbox?

I've installed ASP.NET MVC3 and the Tools Update, but don't see any MVC3 controls in the Toolbox.
If they are supposed to be there, how do I add them?
If not, why not?
MVC does not have any server controls that come with Visual Studio. It is a completely different paradigm from ASP.NET Forms type development where you use standard HTML controls and control behavior with JavaScript/JQuery. You can extend them with third party controls which are usually in the form of JavaScript libraries. A good one to start with is JQuery UI which is open source and included in the template project that is created for MVC 3.
No. MVC doesn't have server controls. A great place to start is ASP.NET MVC Overview.

ASP.NET MVC Razor designer

I am introducing ASP.NET MVC to a new team and one of the questions that comes up often is "Is there a designer view"
Even if it's not for layout is there an IN visual studio design view for ASP.NET MVC3 using the razor view engine.
No, there is no designer. It would likely be difficult for a designer to even know what is meant by Razor code in many cases.
It's really not so difficult to just use your web browser as a viewer. You can make changes to the HTML without having to recompile, just make the change, save, and refresh your browser.
EDIT (8/2/2013)
Since this answer was originally written, Microsoft has released Visual Studio 2012 which includes a feature called Page Inspector, which while not a true "designer" in the way that the question was written, it does give a much nicer semi-live preview mode. This has been improved in Visual Studio 2013 (which was RTM'd today, 10/17/13).
I use a web browser window and set the url my localhost in place of the designer.
view > "other windows" > "web browser". I then split the windows vertically or horizontaly.
I was able to work using the following trick:
change the razor file's extension to .html
Open the document
with the document open, change file extension back to .cshtml
Congratulations, you now have a designer's view of the razor file. If you need razor intellisense, close and re-open it.
No, in general you should try and steer clear from visual designers. The combination of HTML/CSS/Javascript is something that just cannot be done well with visual designers and the short term pain of learning these manually will be well worth it. Once you know these well you will be coding in a cleaner and quicker way. I often use Expression Web to do initial layouts before copying it to Visual Studio.
I know I am late to the party, but..
You can trick the IDE as mentioned above, but if you are building applications in MVC, you should be comfortable in code view. It is more productive and most of the responsive design and css implementation can give you false results in design view. Designer is useful in WebForms. But with the Browser Link feature in Visual Studio 2013, there is no longer any reason to trick your IDE, you can have one-to-many browsers open and get live updates back and forth from browser to visual studio. Can't beat that! The browser is where it's at!
Browser Link!
Install the following and you will be golden!
Microsoft Visual Studio 2013 Update 3
Web Essentials (Dependent on VS Update 3)
I think they are working on that as a feature for Expression Blend 5 Developer Preview .
They clearly recognise the issue of designing JS in the designer so I suspect they realise the same applies to some designers working on MVC applications.
I was told by someone from Microsoft "I think in Blend for HTML, using interactive mode, you would probably be just fine with designing MVC or MVVM patterns"
Also check out Visual Studio Page Inspector it looks like it will do what is needed
In Visual Studio 2013 added browser link this allows two way communication between browser and Visual Studio. It means you can refresh browser when you change code and instantly see how it looks. Also you can change Css in the browser and have it saved in Visual Studio
There is workaround it is mentioned here http://www.codeproject.com/KB/aspnet/EnablingDesignerSupport.aspx

R# "cannot resolve view" when changing the default location for views + custom ViewEngine for ASP.net MVC2

We have a project in ASP.net MVC2 were we have our own ViewEngine that overrides were views locations are. Problem is that Resharper 5.1 is not picking up this, of course. Is there anyone who knows of a way to extend R# to pick this up?
I don't want to disable R# to not try to resolve view globally or local with the R# comment. I want to full tooling support.
R# and Visual Studio don't have support for custom view locations. Imagine views stored in a database for example. You could still write to the R# team and ask to implement this feature in the next version.

Resources