How to prevent/disable visual studio auto correct of quotes after href when editing views - asp.net-mvc

Have an annoying visual studio auto-complete behavior.
When editing an MVC view (cshtml) when typing href= Visual studio will autocomplete to "help me out" by auto completing the quotes, for example href="". The problem is with MVC the majority of my links are generated dynamically using #Url.Action(...).
If there a way to control this auto editing? A minor thing but it disrupt my flow every single time, enough that I posted the question.

Why don't you just add Url.Action inside quotes. Like href="#Url.Action(...)".
Or if you want to disable automatic quotes look here Turn off automatic quote insertion in Visual Studio 2010 is the same in Visual Studio 2013.

Related

Prevent visual studio from moving tags and braces in view

I am developing a report in asp.net MVC. How do I prevent Visual Studio 2015 from moving the tags and braces when working in the View?
I have already gone to Tools > Options > Text Editor > C# > Formatting and unchecked all 3 of the boxes under General. which stops Visual Studio from moving them when working in the Controller but not the View.
I would prefer Visual Studio to NEVER move any of my curly braces and tags, and let me worry about how it looks. As it is, it keeps moving tags and curly braces and making it difficult to see nesting and that all items have closing braces.

Visual studio 2015 CE intellisense keeps closing up

I have quite an odd issue in VS 2015 CE. I'm working on a ASP MVC site and when I I try to access Model properties using Razor in view inside a method a visual studio immediately closes the intellisense window which shows the available properties.
Works perfectly:
#Model.Shared.UserName
Doesn't work
#Html.Raw(Model.Shared.UserName)
When I'm typing the "Model." inside a method, Visual studio keeps closing up the suggestion window. This is becoming really annoying. Has anyone experienced something similar?
The window I'm referring to:
A workaround that I've managed to satisfy myself with after half a year is to use ReSharper which amazingly fixed this issue as well. It's not exactly solution to why the Visual studio is acting this way, but there is probably little left to do.

Empty Text in TFS HtmlFieldControl

TFS 2013 on-premise, VS 2015 client.
I've edited my Bug Work Item Template to include descriptive empty text in the "Steps to Reproduce" tab.
The empty text displays properly in Visual Studio client (VS 2015 as of this writing), but will not display in the web client. I'm prompting bug work items to include descriptive text in the "Steps to Reproduce" control. It renders as expected in Visual Studio client app:
But nothing in the web interface:
There's a related question that's already been asked (and unanswered), but I don't have the reputation to comment, and the mods deleted my "answer," which really clarified the issue from the original question.
Has anyone discovered a solution that will render in both Visual Studio AND the web client?
Tested in TFS 2015.1 + VS 2015, could reproduce your scenario. The Empty Text can be shown in both VS and web access for a FieldControl type, but for HtmlFieldControl, the Empty Text only can be shown in VS.
I also customize a field to use HtmlFieldControl, same result. The Empty Text can't be shown in web access.
It's suggested to submit a UserVoice at website below: https://visualstudio.uservoice.com/forums/121579-visual-studio-2015

Visual Studio 2015 "Not Responding" when adding an MVC controller or view

We are attempting to add MVC to an old, large, legacy webforms app. (The intent is to gradually re-implement portions of the app using MVC until the old app is gone).
Setting it up has gone smoothly. We have an MVC Area, and I created a controller which is accessible when running the app, by means on directly typing the url.
But whenever we "Add > Controller" or "Add > View"... Visual Studio hangs for around 10 minutes "Not Responding".
Clearly there is some bug in visual studio interacting with some quirk in our legacy project.
Googling, I have so far found only a few similar cases that are old & do not seem applicable.
Not sure where to begin resolving this.
UPDATE:
For what it is worth, we have converted the original VB webforms project to C#. I then added MVC Nuget package and and MVC area. Visual studio no longer seems to hang when adding controllers. So this might be a VB specific thing. Or maybe some windows update to visual studio fixed this in the interim since i posted this. Not sure.
The problem is still present in Visual Studio 2015 Update 1.
As a workaround, instead of selecting "Add View" you can select "New Item" and choose a page template from Web/MVC instead.
It is still in Visual Studio 2017; It takes time and you can restart making Controller/View or you can wait sometimes
this seems like bugs from visual studio,
you can copy other controller and paste it then rename namespace.
for temporary until visual studio is fixed.
I'm having the same issue. This should work. I'm selecting "Add Controller" from the context menu. It just spins saying Visual Studio not responding. This is with Visual Studio 2015.
In my case this situation arises when adding view to the controller and visual studio 2015 hangs indefinitely. However it creates the view file in the directory but not shown in solution explorer. I have manually copy pasted the file from directory to solution explorer and everything worked well.
Check if the below blog could help resolve your issue
http://digioz.blogspot.co.uk/2013/06/visual-studio-2012-freezes-or-crashes.html

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

Resources