Visual Studio - pasting text into cshtml deletes text

Viewed 413

In Visual studio (2022; v: 17.2.1) when I paste some text into a cshtml file, that same text seems to get copied, but then immediately deleted; including part of existing text. This only seems to happen when overwriting jquery code (anywhere within <script> tags).

A very similar problem is already discussed here with no (usable) solution: https://developercommunity.visualstudio.com/t/when-i-copy-and-paste-what-i-paste-is-deleted-auto/367401

For example:

I have $('#tbSomeInputField1') and I copy an ID from some other control (i.e "tbSomeOtherField2") and I use the mouse to select "tbSomeInputField1" from the code and I click paste. What is left is only $()???

I'm experiencing this problem in the last couple of weeks so maybe it could be related to one of the latest VS updates...

What could be the problem?

1 Answers

the answer given on visual studio community page is working well. Format on paste can be removed

Options -> Source Code -> Code Formatting -> HTML, switch to the HTML Format tab and uncheck Format on paste.

Related