How to add custom HTML Tags to Visual Studio and Avoid Squiggly Lines - validation

I'm using Visual Studio 2013 to create raw HTML pages (i.e. index.html).
In my HTML I am implementing custom HTML tags. As such, Visual Studio underlines my custom tags with squiggly lines (due to the warning of "Unknown element ...").
In hopes to get rid of the squigglies, I added my custom tags to the list of "Tag Specific Options" via Tools > Options > Text Editor > HTML (Web Forms) > Formatting > Tag Specific Options. However, the squiggly lines persist.
Is there a way to inform VS2013 that my custom HTML tags are valid (i.e. keep VS2013 from underlining my custom tags with squigglies)?

Visual Studio 2013 Update 4 removes the validation in .html files, but not in .aspx files.
Support for custom elements, polymer-elements and attributes
We no longer validate unknown attributers for custom elements as there
will be many custom made tags in different frameworks. So there will
no longer be squiggles under the unknown elements.
— Announcing new Web Features in Visual Studio 2013 Update 4 RC
Download Visual Studio 2013 Update 4.
Validation is only removed in the HTML editor, not the HTML (Web Forms) editor. This means that, by default, .html files will not have custom element validation, but .aspx pages will. If, like me, you don't think this makes sense, show your support by voting for custom elements in .aspx files.

Hmm... what are you trying to accomplish? Keep in mind that if you could somehow make visual studio ignore the unknown element, that's no guarantee browsers looking at your page will be able to translate the element too.
Are your pages HTML5? if so you've got a shot at making it work. but you'll have to define it in client code. Here is source.
But most browsers don't support it yet! look at here elements.
In the case of making Visual Studio recognise the tags you could take this approach:
1) Go to: Tools > Options > Text Editor > HTML (Web Forms) > Formatting
2) Press "Tag Specific Options"
3) Select "Client HTML Tags" in the new window's treeview
4) Press "New Tag" below the treeview to add a new tag

Related

Remove automatic addition of using statements on Visual Studio on using methods not in the current namespace [duplicate]

I am using Visual Studio with Unity. When I copy and paste a code in Visual Studio. It automatically adds an unnecessary namespace on the top. It is pretty annoying to see if there have many unused namespaces over time. May I ask if is this a bug or how can I turn off the auto import namespace when copy paste?
From the suggested name, I think Visual Studio confuses the "length" and "Length"
Here are the steps to reproduce the problem
On the top of the page in Visual Studio, go to Tools > Options > Text Editor > C# > Advanced > Uncheck the option for "Add missing using directives on paste" then click OK on the bottom of the page. And then restart Visual Studio.
Might be useful to some to note that tab completion will still auto-add missing using directives.
Here is an example with the option checked (the example specifics are not relevant but in this case an attribute is being pasted to an ASP.Net Core Razor Page):
Here is an example with the option unchecked:

Can I set HTML5 semantic markup after a project has been created?

I'm quite new to ASP.NET and Visual Studio. I'm working on an old project, is it possible for me to turn on HTML 5 semantic markup? I've not been able to find the option, I would have expected the option here! :
I'm using Visual Studio 2010 Ultimate
The following is a screenshot of the new project dialog.
Link to a similar topic containing a variety of answers:
Is it possible to add HTML5 validation to Visual Studio?
Download link for the VS 2010 update which gives HTML5 validation:
http://visualstudiogallery.msdn.microsoft.com/a15c3ce9-f58f-42b7-8668-53f6cdc2cd83
Answer to my question:
Install the update, and when developing HTML:
Right click > Formatting and Validation > Validation > Target: HTML5.
Alternatively you can select HTML5 from the drop down above the text area, next to the 'Check page for accessibility button'.

How to disable Visual Studio "smart" way to replace IDs in markup

From the hundreds of Visual Studio options, is there one to disable the way VS replace the IDs in markup when copy&paste from other control?
Almost always only need to change a few characters but VS thinks he is being smart replacing all the ID
Go into Tools > Options > Text Editor > HTML > Miscellaneous and uncheck "Auto ID elements on paste in Source view"
source:
How do you customize the copy/paste behavior in Visual Studio 2008?
but in 2010 it is the same

Visual Studio Environment intellisence offers duplicate tags. Are they the same?

when editing an aspx page in visual studio the intellisence offers auto insertion of the usual asp:tags, but it also offers some tags that are not prefixed with asp: and not regular html. For instance, it offers an updatepanel tag, loginview tag and an image tag. Are these some sort of short-hand for adding asp.net web controls?
I have tested this and it doesn't do anything. After adding the tag visual studio's intellisence doesn't suggest any attributes and it doesn't render any sort of output to the client. Still not sure why intellisence suggest them, but they aren't server controls.

Visual Studio uses XHTML tag closing for HTML5 tags

Whenever I type out tags that don't require an end tag, Visual Studio adds a forward slash to it, as if they were XHTML.
I think this is unclean and annoying, and I'm hoping anyone can tell me how to fix or work around this issue.
It even happens when I complete <!DOCTYPE html with a >, and it'll form <!DOCTYPE html />.
For completeness I'm posting this answer. Although we're in 2014 now, with Visual Studio 2013 and HTML5 is getting more and more supported by the major browsers, Visual Studio still behaves the same as ... like always?
The option is just a bit different than in 2010 I assume (based on accepted answer).
What you could do is disable the auto closing tag option in Visual Studio.
Go to Tools >> Options >> Text Editor >> HTML >> Formatting
Uncheck the "Auto insert close tag" option.
This will now allow you to type <br> (for example) and it won't auto-complete it as <br />
For Visual Studio 2012, go to Tools -> Options -> Text Editor -> HTML -> Formatting and click Tag Specific Options.
Under Default Settings -> Client tag does not support contents, set Closing tag to No closing tag.

Resources