How to do a parallel build in Visual Studio 2013? - c#

According to this MSDN article:
http://msdn.microsoft.com/en-us/library/cyz1h6zd.aspx
one "can run multi-processor builds for C++ and C# projects." using the IDE. My solution contains only C# projects, but when I do "Build Solution" I can only see one MSBuild process in task manager and one csc.exe process.
In Tools -> Options -> Projects and Solutions -> Build and Run I have "maximum number of parallel project builds" set to 4 and my computer has 4 cores.
Is it possible to setup VS2013 to build my solution projects in parallel?

I tested the option you mentioned on my larger solution with lot of independend projects in VS2013 and it builds these projects in 4 newly spawned build processors.
If your projects depend on each other the build will have difficulty to run concurrently. But it basically does work in VS2013.
For reference this is the setting:
Putting 8 in there spawned 8 build processors.

Related

Visual Studio have many delay before start to building and some time be stop again

We have a moderately sized solution, with about 20 projects. In one of them I have my business entities. On compiling any project, visual studio waits and hangs about one and a half minutes on this BusinessEntities project.
I tried our solution in SharpDevelop and it compiles our complete solution, in 18 seconds. Similar timing with MSBuild.
My guess is that VS is trying to find out if the project needs a compile, but this process is about 15 times slower than actually performing the compile!!
I can't switch to the great sharpdevelop, it lacks some small, but essential requirements for our debugging scenarios.
Can I prevent VS from checking this project, And have it compile the projects without such a check, just like sharpdevelop?
I already know about unchecking projects in configuration management to prevent building some projects, but my developers will forget they need to compile this project after updating to latest sources and they face problems that seem strange to them.
Edit: Interesting results of an investigation: The delay happens to one of the projects only. In configuration manager I unchecked all projects, then compiled each of them individually. All projects compile in a few seconds!! The point is this: if that special project is built directly, compiles in a few seconds, if it is being built (or skipped, because it is up-to-date) as a result of building another project that depends on it, VS hangs for about a minute and half, and then decides to compile it (or skip it). My conclusion: Visual studio is checking to know if any files are changed, but for some reasons, for this special project it is extremely inefficient!!

Visual Studio 2017 outputting older build versions in bin/debug folder

When I build a C# program (this has been going on for several different solutions/projects I have been working on) in Visual Studio 2017, the new, updated code will build and run in debug mode (and run correctly).
However, the application that Visual Studio has been outputting when I build/debug them has been remaining with the original, first version of code that I saved. When I choose the options to rebuild, it will update the time stamp on the application and .pdb files, but the application will perform the way it did in earlier code versions, not the most recent code version that was running problem when I ran debug mode immediately after pressing Ctrl + F5.
These are C# Console Apps with the .NET Framework 4.6.1, if that makes any difference. I checked the output folder, and it is indeed the desired folder and the one I have been looking in... so why is the time stamp updating on the application (.exe file) that it outputs, but not the code itself? What am I missing?
When I run into strange things like this in Visual Studio, the first thing that usually works is to clean the project and rebuild. If that doesn't work, I'll close Visual Studio, re-launch, then clean and rebuild again. If that doesn't work, I would start looking into any extensions you have installed that might be getting in the way of your build process.
Further, you can look into logging the extensions activity to help troubleshoot if there are issue there. See the following article:
https://blogs.msdn.microsoft.com/visualstudio/2010/02/24/troubleshooting-extensions-with-the-activity-log/
You may have already tried this, but since it wasn't mentioned I thought I'd provide it for others in a similar situation.
Two possible reasons:
(1) Your project was not recompiled during debugging. Please enable Edit and Continue under TOOLS->Options->Debugging.
(2) Visual Studio has a concept of incremental build. If you have a solution with two or much more projects and if you change source code in only one of the two projects, the "Build" command will compile only the modified project. But the "Rebuild" command, on the other hand, it will recompile all projects in this solution.

Building on Many Core Systems in Visual Studio

I recently (massively?) upgraded my system from a (circa 2010) Core i7 980x with 12 GB of Ram to a Dual dodeca-core system with hyperthreading (2x12x2) with 128GB of Ram.
On Visual Studio's end, I rarely see it go beyond 6% utilization (3 cores) during build. Does anyone here know what the caveats to its build pipeline are: does it just have one core per project, does it distribute a single project across multiple cores, or is there something I'm missing?
I'm currently using Visual Studio 2013 and have shelved the 2015 upgrade until ... I recover from the system upgrade :)
On the note above, does Visual Studio 2015 see improved performance on distributing its workload due to the Roslyn pipeline, or is it still using the preexisting MSBuild architecture?
OP:
Does anyone here know what the caveats to its build pipeline are: does it just have one core per project, does it distribute a single project across multiple cores, or is there something I'm missing?
To change how many cores Visual Studio will use during compilation of a .NET solution, check out Tools.Options.Projects and Solutions.Build and Run https://msdn.microsoft.com/en-us/library/y0xettzf(v=vs.90).aspx.
MSDN:
1. In the Visual Studio IDE, on the Tools menu, click Options.
The Options Dialog Box will appear.
2. Expand the Projects and Solutions folder, and then select the Build and Run property page.
3. Enter an integer in the text box for the Maximum number of parallel project builds property. The highest value that you can set this property is 32.
Having said that actual results will vary depending on how many projects are independent vs projects that depend on other projects to be built first. If you have many dependencies, you may not notice much gain.
OP:
I've already set this to 48, which was incorrectly set to 32 by default on this new machine
EDIT: OP has indicated that the number of logical cores is 48.
Generally, setting this value to inordinately large values has no benefit:
MSDN:
Build performance does not increase when you set the Maximum number of parallel project builds property to a value greater than the number of CPUs on your computer. https://msdn.microsoft.com/en-us/library/y0xettzf(v=vs.90).aspx

Can I compile all projects and dependencies into a single .exe in Visual Studio 2013?

I'm working on a Windows Forms application that installs its own prerequisites via a UI (a bit like InstallShield, or similar, might) before being usable. My application, as it stands, consists of two projects, one of which contains folders, which contain the prerequisite bits of software, which I install, quietly, using the command line, after checking whether or not they're already on the target machine.
What I'd really like to do is compile both projects and all of the third-party executables into a single executable. Can it be done? I'm open to "self-extractor" suggestions, but I don't know where to start with these in Visual Studio.

NCover free Version for multiple solutions

I am using NCover 1.5.8 which comes with TestDriven.Net 3.0. I am using NCover for Visual studio 10.0.
I have 26 Solutions and each solution having about 10-30 projects total is about 560 projects. I use a common directory for building all solutions.
When I am running NCover for a single file or for a project or even for a complete solution then it's working fine but I am unable to run NCover for all the 26 solutions at a time.
All the 26 solutions belongs to a single software product and many projects having cross solution DLL reference so I need coverage according to that. I have also tried to run it using console but in case of console I am getting empty coverage XML file.
I am using NUnit 2.5.10, NCover 1.5.8, TestDriven.Net 3.0, Visual Studio 2010 professional, Windows 8 64 bit.

Categories