Visual Studio MVC Scaffolding With T4 Templates Is Very Slow - performance

I'm working on an ASP.NET MVC web application that consists of 43 projects in one solution. We've created some T4 templates for generating/scaffolding Controllers and Views and they're working as they should, but upon selecting Add -> Controller > MVC 5 Controller it hangs on Gathering Information loading screen for about 4-5 minutes until giving you the option to name your Controller and finally creating one.
The same thing happens when selecting Add -> View, but in this case the Gathering Information part is happening before a dialog in which you choose a view template even opens. After choosing any template it creates a new View almost instantly.
This is happening in both Visual Studio 2015 and 2019. I suspect it has something to do with a size of a solution, because in a blank project in a newly created solution it works just fine.
Does anyone know what might be the cause of this problem and is there a way to solve it?

I just ran across this issue in a solution with 7 projects. Ultimately I ended up unloading all of the projects except the one I wanted to add the controller to. After that, I was able to add the controller with just a few seconds delay, then reloaded the other projects.
For those who may not be familiar with multiple project solutions, to unload projects, in the Solution Explorer, select them by clicking the project while holding either the Ctrl or Shift buttons just as you would when selecting files in file explorer. Once selected, right click and select "Unload Project."

Related

Desgin View Is Not Showing On Visual Studio-2017

I am working on a project using Visual Basic(Programming language)on Visual Studio-2017 and when i first start my projects i get my design view like this:enter image description here,
Then when i save my work and re-open the project another time my desgin view is not showing up and it looks like this:enter image description here
Please help!! My desgin view apperars when i start a new project and when i save the project and come back to it another time it's not showing up and i don't how to get it back and i searched all over the internet i can't find an answer. I tired lot of methods to bring the design view back but it's just brings up the code like in the 2nd image. Please help!
You can open project in VS 2017 by two ways: open folder where files are located or open solution: .sln file:
Open solution give you some advantages, for example you can see compile, debug and as in this case see form design view.
#aace2030 I have face the same issue with VS 2017, but I was able to solve it. What you got to do is right click on your form, for example if your form name is "Form1.cs". Right click on it and you'll see an option called "Include in project", just click on it, this should solve your problem.

Visual Studio 2015 - New Project Windows Obscuring Details

Hi I have Visual Studio 2015 - And when I try to create a new Windows Form Application - both the Location, SolutionName, CreateDirectoryforSolution box and Add to Source Control are missing - Yet if I select a "Telerik" type or other types it shows - I've checked on my colleagues machine and his works as predicted. ie Shows the other project elements.
Two images below - Any clues? Resizing the frame does not help.
Thanks
and with the correct details:-
Visual Studio allows you to create new projects without having to save them (temporary projects).
If you create a new Forms application, it will generate all the files etc. If you wish to save, click the Save menu option and the following window is shown:
You can control this behaviour via the options:
On the Tools menu, click Options.
Expand the Projects and Solutions node, and select the General node.
Make sure Save new projects when created is cleared, if you want to allow temporary projects; otherwise, make sure it's checked to be prompted for location and solution name when creating a new project.
Click OK.
With the Save new projects option is checked, you'll be prompted for a Name, Location and Solution Name when selecting the project type, as per the screenshot below.
This MSDN article: Temporary Projects provides a fuller explanation on the subject.

What does the 1st dropdown in the code window really mean in Visual Studio 2013?

I have a large legacy solution with several projects in it and I was looking at the 1st dropdown in the code window. I thought that it referred to any other projects that use the same file that was currently displayed, but it appears to be doing something different. The hover text states
Use the dropdown to view and switch to other projects that this file (filename) may belong to.
That may part is what I think is a cop out to say that VS may get confused sometimes. Am I wrong?
What I am seeing for the stdafx.h file in my projects is that from project 1 it shows project 1 and project 2 in it, but when I go to project 2's stdafx.h (which is a separate physical file), it shows project 1, project 2 and a whole lot of other projects.
If I am wrong, what is this trying to tell me?

Visual studio exclude folders from rebuild

I'm building an addon ASP.net set of pages ontop of an old classic ASP system.
The new pages are in the folder newversion/ this is the only folder I need rebuilding when I make changes, at the moment it attempts to build the entire site which results in a lot of errors.
Can you exclude all other folders from the build configuration?
Edit Please note, the other pages are still going to be edited (all the classic ASP ones) so exlcuding them from project etc really doesn't help
Edit 2 Here's a screen shot from VS
Select the files you like to exclude in the solution explorer
Press F4\Alt+Enter to open properties window.
Change Build Action property to Nnoe.

Visual Studio 2010 Designer Bug: Unable to copy from obj\debug to bin\debug

Wondering if anyone has a solution to this 2010 bug. I have a project that built fine in Visual Studio 2008 that wont build in 2010 because Visual Studio is holding on to the dll after the application is run ONLY if a designer window is open. I created a really light weight project that shows this problem. If you create an application then create a lib dll. Put one form in the dll, open the form in design view and then run the application. It will run fine, then close the app, go to the code view of the form in design view, and change the code ( I just renamed a single variable) then try to recompile you get the following:
Error 1 Unable to copy file "obj\Debug\customlib.dll" to "build\debug\customlib.dll". The process cannot access the file 'build\debug\Customlib.dll' because it is being used by another process.
If you run Process Explorer and search for the dll, the only process holding the dll is devenv.exe!!!
I have done a ton of searching on this problem and have found similar issues with older versions of Dev Studio where people were able to just add a pre-step to move the locked dll to another name (.locked) and build. Well that works the first time, but the next time you run then edit you are locked out of both the current dll and the one you moved to .locked, so unless I am willing to add code to randomly generate a name for the locked dll, this wont work for me (I don't want my debug directory size to grow with files never getting deleted.)
I have only found one workaround and if you are in this same boat this is what I have to do to edit and run. I make sure EVERY design view window is closed BEFORE I ever run my project in the debugger. If you close all the open design view windows devenv.exe will not hold the dll.
Does anyone have a better solution to this problem?
I'm not sure whether this will work for you or not, but this similar question if you have this line in AssemblyInfo.cs:
[assembly: AssemblyVersion("2.0.*")]
changing it to:
[assembly: AssemblyVersion("2.0.0.0")]
will solve this isue.
The Visual Studio add-on "VSCommands" claims to have a fix for this problem. I've not tested it yet, but it also claims to have an in-IDE stackoverflow reputation tracker which intrigues me :)
Your "Close designer before debugging" workaround seems to be working for me (so far), for which I'm very grateful. It was beginning to get to the stage where am large part of my day was spent in the following workflow...
F5
loud expletive
ALT F4
WIN 3
waits impatiently...
F5
I have had the same problems for a long time and then suddenly they disappeared. I realized that the source of the problems was initializing code in the constructors of WCF services and WPF controls. After cleaning the constructors from any dependencies to other assemblies everything has been fine.
So my suggestion is: Clean your constructors.
In WPF it is possible that inserting:
if (DesignerProperties.GetIsInDesignMode(this)) return;
or similar will have the same effect.

Resources