1

I have a C# solution that has a very high build time. This article suggests analysing it using msbuild switches.

How can I add those command line switches to my solution so visual studio adds them when starting the build?

I would like to run msbuild using these switches:

/tv:4.0 /m:4 /ds /t:ParallelBuild
Chris Marasti-Georg
  • 34,091
  • 15
  • 92
  • 137
Johannes
  • 6,490
  • 10
  • 59
  • 108
  • additional info: http://stackoverflow.com/questions/33787023/msbuild-how-to-build-multiple-files-and-projects-in-parallel – stijn Sep 08 '16 at 13:53

1 Answers1

2

Go to Tools -> Options -> Projects and Solutions -> Build and Run.

Then enter a number for the "maximum number of parallel project builds".

However, it is likely that this is already set to a value greater than 1, so this might not be much use.

This is equivalent to the /m switch - the other switches you mention are of no significance for enabling multiprocessor builds.

Matthew Watson
  • 104,400
  • 10
  • 158
  • 276
  • OP asked about using MsBuild switches, not specifically about the "Parallel Builds" switch. – Teejay Feb 27 '17 at 14:44
  • @Teejay What? He explicitly asked about the `/tv:4.0 /m:4 /ds /t:ParallelBuild` switches, and as I said in my answer the only relevant one is the `/m` switch. The fact that the OP has already marked this in as the answer indicates that this is, in fact, the right answer. – Matthew Watson Feb 27 '17 at 15:01
  • This is OS's question *"How can I add those command line switches to my solution so visual studio adds them when starting the build?"*. – Teejay Feb 27 '17 at 15:03
  • @Teejay Sometimes you need to interpret questions and give the answer the OP needs rather than what they thought- in this case, the OP wanted to speed up their builds. The command-line parameters he gave were to enable parallel builds. The equivalent for that for a solution is to set the option that I mention in my answer. One must assume that the OP tried it, found that it worked for him, and thus marked this answer as correct. – Matthew Watson Feb 27 '17 at 15:05
  • 1
    This is higly related to the XY problem (http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). The fact is that I came here in search of the solution to *"using msbuild switch in VS"*, but I instead found a specific answer that in no way is related to the question's title. – Teejay Feb 27 '17 at 15:08
  • @Teejay Yes, the question has a poor title, but the body of the question is correct. You could, if you wished, edit the title of the question to improve it rather than downvoting an answer that is correct for the intent of the question. – Matthew Watson Feb 27 '17 at 15:09
  • I'll remove the downvote. But YOU, not ME, should have modified the question's title. *Edit: I see your point, but unfortunately i can't remove the downvote anymore.* – Teejay Feb 27 '17 at 15:11
  • @Teejay What command-line option are you trying to set in Visual Studio, btw? – Matthew Watson Feb 27 '17 at 15:12
  • The one listed here https://msdn.microsoft.com/en-US/library/ms173212.aspx. Another way to set reference aliasies, the *Aliases* property box, seems to miss in VS2013 (it exists in VS2015). – Teejay Feb 27 '17 at 15:15
  • @Teejay I can see the "Aliases" property even in Visual Studio 2010 (just checked it - right-clicked an assembly in the References section of the solution, and selected Properties, and I see an "Aliases" property. Are you sure your assembly is a .Net one (and not COM or something)? – Matthew Watson Feb 27 '17 at 15:22
  • I found the problem. It is that the assembly (from which I reference the DLL to be aliased) is a VB one. It also ignores the ** tag if I directly add it in the *.vbproj*. (in VS2015 I was looking a C# one) – Teejay Feb 27 '17 at 15:29
  • As per this answer (http://stackoverflow.com/a/6540971/1409881) it seems to be not possible in VB.net. – Teejay Feb 28 '17 at 08:52