VS 2017 15.3.3 Not Responding - visual-studio

I created an Asp.Net Core 2.0 WebApi application using Visual Studio 2017 version 15.3.3. Whenever I add, edit or delete files from the Solution Explorer, VS freezes for an indeterminate time (2 - 120 seconds), before becoming responsive again.
I have followed all the suggestions from https://developercommunity.visualstudio.com/content/problem/30723/visual-studio-2017-too-slow-for-use.html, but with no success.
I was hoping someone had a solution to this problem, so that I do not have to send a trace to the Visual Studio Team.
It should be noted that I have ReSharper Ultimate and Web Essentials installed, but the problem persisted after disabling them both.

I had the same issue as you today and it was driving me crazy.
Eventually I did a dotnet restore in a command prompt in the web application directory. This solved the long freezes for me. Before the 'restore' adding/removing files took one minute or more, now it only takes 1 second. It could still be better but it is workable now.
Update: the web project I work on has two node_modules folders: one in the project root and one in a subdirectory. When I delete the one in the subfolder the IDE becomes even more responsive. So it looks seems that a Visual Studio 2017 ASP.NET Core web project gets a performance hit when there are a lot of files/subdirectories in the project files. And 'node_modules' is - alas - a directory that grows very fast in size...
Update 2: You can exclude extra folders by adding the <DefaultItemExcludes> property to the .csproj file, like <DefaultItemExcludes>$(DefaultItemExcludes);ClientLib\node_modules\**</DefaultItemExcludes>. This solved it for me.

I took the advice of David Urting and ran dotnet restore to no avail.
My solution also has a client folder containing an angular 4 application, with another node_modules folder.
I removed the client application from WebApApi solution and moving it into the same folder as the .sln file, which is where my git repository is.
When I run ng build --prod (angular cli), I move the distribution files into the www folder of the web application.
The freezing/not responding has ceased.
It should be noted that I removed the node_module folders from the solution also, but this did not help either.

Related

Opening solution using Visual Studio 2017

I have been working on this little mobile app for android using Xamarin in Visual Studio 2017.
When opening the solution with the laptop that I used to develop the app works like a charm. Then I zip the entire folder over the solution.
../myFolder/
app1/ //here is all the code
app1.sln //solution file
myFolder.zip
Transfer the zip file to other laptop/PC through usb, email and online repository, even extensions like rar, 7zp and tar. I simply can not load the solution from other Visual Studio but the one where I created/developed the application originally.
Hours passing with this screen then VS is not responding and after that, it simply crashes/closes with no error message.
In the other hand, I can open any solution created from any other PC in my laptop without issues. After saving, I haven't found the pattern yet, but some solutions can't be opened from the original PC which creates them nor others.
You may be using an older version of Visual Studio on the PC you've facing the issue. I've faced that too.
It was a known bug (reported here and here) already fixed on newer versions.
The workaround is to close VS, delete the folder vs created in the same directory of your solution and try to reopen it.
To avoid other problems on compiling or running your app after that, I recommend you also to delete all bin and obj folders from your project's folders, clean and rebuild the solution.
It's safer keep all your development environments updated in software wise to avoid this kind of trouble.
I hope it helps.

Opening a Visual Studio 2010 project in 2012 what creates the backup folder and how to control it?

I have an issue. We are upgrading to VS 2012 at work. When we open a VS 2010 project Visual Studio converts the project. This is fine, because VS 2010 can still use the project (yay microsoft). However, there is a \Backup folder created in the solution directory. Is this being created as part of the migration? Is there any way to control it?
The reason I ask is that the process that makes this folder copies web.config files into the folder. If you then try to build the solution (these are MVC projects), we get a "It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS." error. The cause is that there is a web.config file in a subfolder instead of the root folder. We did not make and do not want this change, and cannot figure out how to control it. Deleting the Backup\Web.config file fixes the error. Renaming it from web.config to web.config.bak fixes the problem.
I don't really want to have to personally open and convert every single project, and don't want random people bumping into this problem. Any idea how to either stop VS from creating the Backup folder, or how to make it create them in the my documents studio folder etc? I can't find any setting to control this and can't find any good info.
By chance, are you using the MvcBuildViews property to pre-compile your views at build time? If so, this is why you're encountering this (since it does the pre-compile in the same directory, it doesn't filter out any of the files below the project directory).
Note that you will also encounter this issue if you use the Publish feature for this project. Publish copies the web.config under your intermediate build output directory (by default, obj/) before and after applying web.config transforms.
The good news is that in VS2012, or in VS2010 with the latest Azure SDK installed, pre-compile is now supported for Web Application Projects (including MVC). These settings are currently in the project properties, under the Package/Publish Web tab.
(this doesn't directly address your question about the Backup folder, but it was too long for a comment.)
There is no way to control it that I found. We had to go ahead and run through and convert every project to 2012 and delete the backup folders to prevent any other team from running into it.

Recover a Visual Studio project that was never saved

I started a new project this morning and, after putting ~3 hours of work into it, I tried to open a file from another project to get some code from it. I got a warning about discarding an unsaved object. After telling it to go ahead, I realized that it was referring to the project I had just been working on and not another file that I had just opened.
Even though I never saved the project, the various files containing my code and dataset had to exist on the hard-drive. Are they still there, perhaps in a temp folder? I'm developing on a box running Server 2008 R2 (don't ask, not my decision :) ).
This may help:
http://blogs.msdn.com/b/saraford/archive/2008/02/14/did-you-know-where-visual-studio-saves-auto-recovered-files-in-the-case-of-an-unexpected-shutdown-151.aspx
Also check C:\Users{Username}\AppData\Local\Temporary Projects
You could try one of those undelete programs and see if it finds anything.
Tools > Options > Projects and Solutions
and check the item
Save new projects when created
Save frequently. :)
Need to give one related input. Who the hell had the idea to implement this feature???
I used Visual Studio until 2003, then came back again to 2010 now.
After 2 days work, saving all the time, as I used to (Ctrl + S), I close the project and decide not to save the solution itself.
Done. All lost. Nothing can be recovered from anywhere in the computer.
How can a developer implement a dumb idea such as dropping all work in an "in memory" project.
You either know about it already or you will get screwed; like thousands found on Google during my desperate search.
Did Microsoft VS team look at it at least?
So frustrating...
It might be worth checking out the folder where AutoRecover files are saved.
You can find the default file location in Visual Studio on the Tools - Options menu. Look in the Projects and Solutions section - expand that and look in General to find the default file locations.
My files were under C:\My Documents\Visual Studio 2008\Backup Files.
I had this happen to me this morning. I worked on a new project yesterday and windows ran an update last night. Despite having debugged my program - the project had not saved - for some reason it didn't occur to me that the project might not be saved. I left the program running on my computer when I went to bed. This morning when I work up, I saw that windows had run an update. A few hours later, I saw that my computer had no trace of my program. I realize this is an old post, but I thought I would shed some light on what I did, since i was able to recover my files.
First I went here: http://windows.microsoft.com/en-us/windows7/recover-lost-or-deleted-files
In Visual Basic 2010 Express, a backup folder is created with your project name. Sure enough, my project backckup folder was there: Documents\Visual Studio 2010\Backup Files\MyProject. But, the folder was empty. I "restored this folder to a previous version" using the steps listed in the link above. After doing that, the folder was still empty, BUT, the temporary folder "C:\Users{Username}\AppData\Local\Temporary Projects" now contained my project's folder and files. Prior to running the "restore to previous version", the temporary projects folder was also empty.
So, I was able to copy the folder out of the Temporary Projects folder and I am as happy as one can be - or close to it.
Hope that helps someone out.
A note to the answers above, I had a mini jumpscare when i could not find my project anywhere, not in the recent projects nor in the visual studio projects folder.
I eventually found the project in the visual studio projects folder of the admin user;
I was looking at:
C:\Users\LocalUser\Documents\Visual Studio 2015\Projects
Whilst the project was saved under:
C:\Users\LocalAdmin\Documents\Visual Studio 2015\Projects
Bottom line is; also check the \documents of the admin user. This likely happend because i was testing an admin only application and visual studio was running with the admin's user profile loaded.

Visual Studio 2005 and Sitecore ...Very very slow

We have Visual Studio 2005 and using Sitecore. In Sitecore solution we have different 4 projects. The problem is whenever I debug it takes much time to debug and then after debug when I run in browser it takes even more longer time.
I tried to clean the solution but did not work and I am trying to fix from many hours now and cannot find any solution.
I tired to create new project separately then it works fine its only with this solution of Sitecore which has problem.
Can anyone please help me...
Thanks!
this is a common problem in all versions of Visual Studio which is due to the many files in the /sitecore folder WHEN you have the "Show all files" turned on, on the project which contains Sitecore. I think Visual Studio tries to load each and every file when debugging with that option turned on.
Turn it off and you should be good to go :)
We include the Sitecore directory as a virtual directory in IIS, this way we don't have to have the Sitecore folder under the VS project root. Our typical setup for Sitecore is something like this:
/Site
/Website
/Layouts
/XSL
/Bin
/...
/Virtual
/Sitecore
/Sitecore Modules
/Data
The Visual Studio project then looks at the /Site/Website folder and knows nothing about the virtual folder.

Problem after publishing web application from VS 2010

Whenever I publish my MVC web application in VS 2010 via the One-click publish feature (I'm not doing any web.config transforms or anything fancy - yet!). The next time I come to build the app I get the following error:
It is an error to use a section registered as allowDefinition='MachineToApplication'
beyond application level. This error can be caused by a virtual directory not being
configured as an application in IIS. in ...MyWebApp\obj\release\package\packagetmp
\web.config
A new copy of the web.config file is indeed created by VS2010 below the ...MyWebApp\obj\ folder so I deleted the whole obj folder and I was then able to build again.
But I shouldn't have to do that each time I publish - I must have something configured incorrectly - can anyone help please.
Thanks.
This is unfortunately a known issue with Publishing a web application to the file system. This still affects the release version (RTM) of Visual Studio 2010. It's not limited to the Beta or RC versions.
This problem "bit" me also, and I too was having to manually delete the Debug and Release folders inside the obj folder within my web site solution folder.
The real answer for an automated "workaround" can be found in this answer to the other Stack Overflow question:
Why do I randomly get a “error to use section registered as allowDefinition='MachineToApplication'” when building an MVC project?
In a nutshell, you need to delete the web.config files from either the Debug or Release folders (or both!), and that's achieved with a pre-build command (configured in the Build Events tab of the Project Properties page of your solution):
del "$(ProjectDir)\obj\Debug\Package\PackageTmp\web.config"
del "$(ProjectDir)\obj\Release\Package\PackageTmp\web.config"
Personally, I delete the entire obj folder since all those files are re-created with each build anyway.
I have just found a work around for this that has worked for me, open the .csproj for your web project and change the node under the Project\PropertyGroup node to this:
from this:
<MvcBuildViews>true</MvcBuildViews>
to this:
<MvcBuildViews>false</MvcBuildViews>
This has worked for me, hopefully it will work for you also.

Resources