3

When we add a file, create a folder, rename a file or folder it lasts for seconds until this is done.

Even when directly doing those changes on the folder structure, it takes seconds in VS2019 to see them.

In other projects, part of the same solution we do not have this problem.

Any suggestions?

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
BrilBroeder
  • 1,409
  • 3
  • 18
  • 37
  • 1
    Why not attach a debugger (VS itself will be sufficient) to VS and see what is happening in these slow periods? Alternatively/additionally, attach a Performance Profiler like e.g. [this one](https://www.red-gate.com/products/dotnet-development/ants-performance-profiler/) to VS. – Uwe Keim Jun 16 '20 at 09:54
  • VS cannot attach to itself. – BrilBroeder Jun 23 '20 at 08:13
  • I'm doing this since years. Of course you need to start a second instance of VS. – Uwe Keim Jun 23 '20 at 09:10

3 Answers3

3

STEP 1 Clear Cache

  1. Win+E to open File Explorer enter image description here
  2. Click tab "File" and "Change folder and search options" enter image description here
  3. Click Clear

STEP 2 Minimize Index scope

I. Open Windows Settings and Select "Indexing Options"

enter image description here

II. Click "Modify"

enter image description here

III. Unselect Driver C:// and others

enter image description here

Michael Wang
  • 3,782
  • 1
  • 5
  • 15
0
  1. You can do the dotnet restore in a command prompt in the web application directory. This solved the long freezes.

  2. Clean this directory:

%SystemRoot%\Microsoft.NET\Framework\versionNumber\Temporary ASP.NET Files

  1. You can exclude extra folders by adding the property to the .csproj file, like <DefaultItemExcludes>$(DefaultItemExcludes);ClientLib\node_modules\**</DefaultItemExcludes>

references here:

https://developercommunity.visualstudio.com/content/problem/35570/create-new-file-and-file-rename-are-extremely-slow.html?page=1&pageSize=10&sort=votes&type=problem

https://learn.microsoft.com/en-us/previous-versions/ms366723(v=vs.140)?redirectedfrom=MSDN#compilation-folder-location

ASP.NET Temporary files cleanup

0

I had slow file add, delete, save, and slow folder add.

I just fixed mine, however my project also has React frontend, the culprit was the "node_modules" folder. I had moved the project from another drive and VS2019 included it as an active folder. Excluding it from the project brought everything back to normal. Since my project is .Net Core 3.1 + React - doing this might serve others - not sure if the OP is using node.js

In Solutions Explore --> Right click node_modules folder --> select "Exclude from Project"

If you are using source control (git) will still work ok as will the rest of your application.

David B
  • 121
  • 6