43
votes

In Tools > Options, I cannot find the setting to disable auto-renaming of elements which are pasted in HTML source view.

It used to be: Tools > Options > Text Editor > HTML > Miscellaneous > Auto ID elements on paste in Source view. But that option is gone in Visual Studio 2013.

How can I disable the auto-renaming?

2
Looks like someone has created the same issue on the Microsoft Connect site a few days ago. It is under review. connect.microsoft.com/VisualStudio/feedback/details/806446/…Scott Wylie
To save other people time, unfortunately trying to add the registry key back of 'AutoIdSnippets' 0 doesn't seem to work.mattmanser
Same issue here. Hope someone finds a resolution to this. Very annoying.Bernesto

2 Answers

31
votes

For now the best solution seems to be a workaround that was posted by a user on the Microsoft Connect website which is to paste the code as a comment.

Fool the IDE that we're not pasting code (thus he won't alter it). How ? Paste a comment ! How to do that in real life ? Here is how I do it (feel free to suggest other ways!):

1) Place cursor where I want to paste code 2) ctrl-k, ctrl-c (i.e. comment region. Since no region was selected, an empty comment is inserted and our cursor Inside of it) 3) ctrl-v (paste content that is believed to be a comment by the IDE) 4) ctrl-k, ctrl-u (i.e. un-commenting the current comment we're in!

0
votes

The auto ID assigning is made only if the ID is used by another control on the same page.

Copy the code and paste in external editor like Notepad++, then copy it again from NP++ and paste it in the code editor page, the ID should remain the same.