I've been trying to learn SDL, but haven't been successful at linking the .lib
When compiling my C++ program I'm told the file cannot be opened.
Build started 8/8/2014 1:08:01 AM.
1>Project "C:\Users\Steven\Documents\Visual Studio 2013\Projects\KinectTest\KinectTest\KinectTest.vcxproj" on node 2 (Build target(s)).
1>Link:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"C:\Users\Steven\Documents\Visual Studio 2013\Projects\KinectTest\Debug\KinectTest.exe" /INCREMENTAL /NOLOGO /LIBPATH:"C:\Program Files\Microsoft SDKs\Kinect\v1.8\lib\x86" /LIBPATH:"C:\SDL2-2.0.3\lib\x86" Kinect10.lib SDL.lib SDLmain.lib opengl32.lib glu32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:\Users\Steven\Documents\Visual Studio 2013\Projects\KinectTest\Debug\KinectTest.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\Users\Steven\Documents\Visual Studio 2013\Projects\KinectTest\Debug\KinectTest.lib" /MACHINE:X86 Debug\KinectTest.res
Debug\KinectTest.obj
1>LINK : fatal error LNK1104: cannot open file 'SDL.lib'
1>Done Building Project "C:\Users\Steven\Documents\Visual Studio 2013\Projects\KinectTest\KinectTest\KinectTest.vcxproj" (Build target(s)) -- FAILED.
Build FAILED.
Time Elapsed 00:00:00.22
Directory Contents:
Directory of c:\SDL2-2.0.3\lib\x86
03/15/2014 07:34 PM <DIR> .
03/15/2014 07:34 PM <DIR> ..
03/15/2014 07:33 PM 1,007,104 SDL2.dll
03/01/2014 11:23 AM 116,400 SDL2.lib
03/01/2014 11:23 AM 40,536 SDL2main.lib
03/01/2014 11:23 AM 821,670 SDL2test.lib
4 File(s) 1,985,710 bytes
2 Dir(s) 69,829,705,728 bytes free
As you can see above the directory of the lib was included and the file is in fact in that location
Props File:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>C:\SDL2-2.0.3\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>C:\SDL2-2.0.3\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>SDL.lib;SDLmain.lib;opengl32.lib;glu32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemGroup />
</Project>
You are trying to link the library calling it SDL.lib when in fact it should be SDL2.lib
In the directory:
03/01/2014 11:23 AM 116,400 SDL2.lib
From Additional Dependencies:
<AdditionalDependencies>SDL.lib;...</AdditionalDependencies>
This is the same for SDLmain.lib which should be SDL2main.lib
Related
I have a web api project that won't build on teamcity when I add a .net framework (4.71) class library to the solution. If I remove the class library, the build succeeds.
[CoreCompile] Csc [12:03:15][Csc] C:\Program Files (x86)\Microsoft
Visual Studio\2017\BuildTools\MSBuild\15.0\bin\Roslyn\csc.exe
/noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4
/define:DEBUG;TRACE /highentropyva+ /reference:"C:\Program Files
(x86)\Reference
Assemblies\Microsoft\Framework.NETFramework\v4.7.1\Microsoft.CSharp.dll"
/reference:"C:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework.NETFramework\v4.7.1\mscorlib.dll"
/reference:"C:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework.NETFramework\v4.7.1\System.Core.dll"
/reference:"C:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework.NETFramework\v4.7.1\System.Data.DataSetExtensions.dll"
/reference:"C:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework.NETFramework\v4.7.1\System.Data.dll"
/reference:"C:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework.NETFramework\v4.7.1\System.dll"
/reference:"C:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework.NETFramework\v4.7.1\System.Net.Http.dll"
/reference:"C:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework.NETFramework\v4.7.1\System.Xml.dll"
/reference:"C:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework.NETFramework\v4.7.1\System.Xml.Linq.dll"
/debug+ /debug:full /filealign:512 /optimize-
/out:obj\Debug\SomeClassLib.dll /subsystemversion:6.00 /target:library
/utf8output /deterministic+ Class1.cs Properties\AssemblyInfo.cs
"C:\TeamCity\buildAgent2\temp\buildTmp.NETFramework,Version=v4.7.1.AssemblyAttributes.cs"
[12:03:15][Csc] Using shared compilation with compiler from directory:
C:\Program Files (x86)\Microsoft Visual
Studio\2017\BuildTools\MSBuild\15.0\bin\Roslyn [12:03:15][Csc] CSC
error CS0041: Unexpected error writing debug information -- 'Unable to
load DLL 'Microsoft.DiaSymReader.Native.amd64.dll': The specified
module could not be found. (Exception from HRESULT: 0x8007007E)'
Found the issue. I edited my project file in a text editor and I removed the Deterministic element. The build succeeded after that.
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{GUID}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RootNS</RootNamespace>
<AssemblyName>RootNS</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic> <!--removed this line-->
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
I have a .NET Core solution that has two .NET Core projects and rest of the projects are old .NET projects. It builds fine locally with following entry in Nuget.Config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
<disabledPackageSources />
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="microsoft" value="https://www.nuget.org/api/v2/curated-feeds/microsoftdotnet/" />
</packageSources>
</configuration>
but fails in VSTS build and seems like that particular project can not use System.Net.Http and System.Net.Http.Headers though they are added as reference Here is the trace log:
2017-08-11T16:49:59.4475147Z C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:TRACE /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\Microsoft.CSharp.dll" /reference:d:\a\1\s\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\mscorlib.dll" /reference:d:\a\1\s\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Data.DataSetExtensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Net.Http.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Runtime.Serialization.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Web.dll" /reference:d:\a\1\s\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll /reference:d:\a\1\s\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll /reference:d:\a\1\s\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll /reference:d:\a\1\s\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll /reference:d:\a\1\s\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Xml.Linq.dll" /debug:pdbonly /filealign:512 /optimize+ /out:obj\Release\XXX.YYY.Web.Common.dll /ruleset:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Team Tools\Static Analysis Tools\\Rule Sets\MinimumRecommendedRules.ruleset" /subsystemversion:6.00 /target:library /utf8output ..\..\AssemblyInfoBase.cs Constants.cs Helpers\AntiCsrfHelper.cs Helpers\ErrorMessages.cs Interfaces\IRequestMessageProvider.cs Models\AuthState.cs Models\YYYCollectionDto.cs Models\YYYFileInfoDto.cs Models\YYYItemMetadataDto.cs Models\YYYProviderAuthRequestResponseDto.cs Models\YYYProviderDto.cs Models\YYYSearchResultDto.cs Models\YYYThumbnailDto.cs Properties\AssemblyInfo.cs "d:\a\_temp\.NETFramework,Version=v4.5.2.AssemblyAttributes.cs"
2017-08-11T16:49:59.4475147Z Using shared compilation with compiler from directory: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn
2017-08-11T16:49:59.4705140Z ##[error]src\XXX.YYY.Web.Common\Helpers\AntiCsrfHelper.cs(75,43): Error CS1061: 'HttpRequestHeaders' does not contain a definition for 'GetCookies' and no extension method 'GetCookies' accepting a first argument of type 'HttpRequestHeaders' could be found (are you missing a using directive or an assembly reference?)
2017-08-11T16:49:59.4705140Z Helpers\AntiCsrfHelper.cs(75,43): error CS1061: 'HttpRequestHeaders' does not contain a definition for 'GetCookies' and no extension method 'GetCookies' accepting a first argument of type 'HttpRequestHeaders' could be found (are you missing a using directive or an assembly reference?) [d:\a\1\s\src\XXX.YYY.Web.Common\XXX.YYY.Web.Common.csproj]
2017-08-11T16:49:59.4715145Z ##[error]src\XXX.YYY.Web.Common\Helpers\AntiCsrfHelper.cs(128,21): Error CS0246: The type or namespace name 'CookieHeaderValue' could not be found (are you missing a using directive or an assembly reference?)
2017-08-11T16:49:59.4715145Z Helpers\AntiCsrfHelper.cs(128,21): error CS0246: The type or namespace name 'CookieHeaderValue' could not be found (are you missing a using directive or an assembly reference?) [d:\a\1\s\src\XXX.YYY.Web.Common\XXX.YYY.Web.Common.csproj]
2017-08-11T16:49:59.4715145Z ##[error]src\XXX.YYY.Web.Common\Helpers\AntiCsrfHelper.cs(126,30): Error CS1061: 'HttpResponseHeaders' does not contain a definition for 'AddCookies' and no extension method 'AddCookies' accepting a first argument of type 'HttpResponseHeaders' could be found (are you missing a using directive or an assembly reference?)
2017-08-11T16:49:59.4715145Z Helpers\AntiCsrfHelper.cs(126,30): error CS1061: 'HttpResponseHeaders' does not contain a definition for 'AddCookies' and no extension method 'AddCookies' accepting a first argument of type 'HttpResponseHeaders' could be found (are you missing a using directive or an assembly reference?) [d:\a\1\s\src\XXX.YYY.Web.Common\XXX.YYY.Web.Common.csproj]
2017-08-11T16:49:59.4745135Z Done Building Project "d:\a\1\s\src\XXX.YYY.Web.Common\XXX.YYY.Web.Common.csproj" (default targets) -- FAILED.
2017-08-11T16:49:59.5605400Z ##[error]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets(92,5): Error : Cannot find project info for 'd:\a\1\s\src\XXX.YYY\XXX.YYY.csproj'. This can indicate a missing project reference.
2017-08-11T16:49:59.5605400Z C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets(92,5): error : Cannot find project info for 'd:\a\1\s\src\XXX.YYY\XXX.YYY.csproj'. This can indicate a missing project reference. [d:\a\1\s\src\XXX.AspNetCore.YYY\XXX.AspNetCore.YYY.csproj]
2017-08-11T16:49:59.5605400Z Done Building Project "d:\a\1\s\src\XXX.AspNetCore.YYY\XXX.AspNetCore.YYY.csproj" (default targets) -- FAILED.
2017-08-11T16:49:59.6755164Z Project "d:\a\1\s\XXX.YYY.sln" (1) is building "d:\a\1\s\src\XXX.AspNetCore.YYY.TestHost\XXX.AspNetCore.YYY.TestHost.csproj" (21) on node 1 (default targets).
2017-08-11T16:49:59.6755164Z PrepareForBuild:
2017-08-11T16:49:59.6755164Z Creating directory "bin\Release\net452\win7-x86\".
2017-08-11T16:49:59.6755164Z Creating directory "obj\Release\net452\win7-x86\".
2017-08-11T16:50:00.2025192Z ##[error]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets(92,5): Error : Cannot find project info for 'd:\a\1\s\src\XXX.AspNetCore.YYY\XXX.AspNetCore.YYY.csproj'. This can indicate a missing project reference.
2017-08-11T16:50:00.2025192Z C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets(92,5): error : Cannot find project info for 'd:\a\1\s\src\XXX.AspNetCore.YYY\XXX.AspNetCore.YYY.csproj'. This can indicate a missing project reference. [d:\a\1\s\src\XXX.AspNetCore.YYY.TestHost\XXX.AspNetCore.YYY.TestHost.csproj]
2017-08-11T16:50:00.2025192Z Done Building Project "d:\a\1\s\src\XXX.AspNetCore.YYY.TestHost\XXX.AspNetCore.YYY.TestHost.csproj" (default targets) -- FAILED.
2017-08-11T16:50:00.2025192Z Done Building Project "d:\a\1\s\XXX.YYY.sln" (default targets) -- FAILED.
2017-08-11T16:50:00.2045187Z
2017-08-11T16:50:00.2045187Z Build FAILED
I'm trying to add ARM platform support to an existing Visual C++ project. I want to ensure the project can build Windows Phone and Windows Store apps in addition to X86 and X64 programs.
Microsoft does not appear to provide official documentation on the subject matter (or I can't seem to find it). In the absence of official documentation, I'm following the discussion provided on Microsoft Blogs at A guide to .vcxproj and .props file structure. I think the blog is quite good, and I don't think it has any defects, errors or omissions.
lib.vcxproj is an MCVE and its shown below. When I build an X86 or X64 target using a Visual Studio C++ project file from a VS{2010|2012|2013} X86 or X64 Developer Command Prompt, then things work as expected:
c:\Users\Test>msbuild /t:Build /p:Configuration=Debug;Platform=x64 lib.vcxproj
Microsoft (R) Build Engine version 4.6.1055.0
[Microsoft .NET Framework, version 4.0.30319.42000]
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 10/7/2016 3:03:15 PM.
Project "c:\Users\Test\lib.vcxproj" on node 1 (Build target(s)).
...
Done Building Project "c:\Users\Test\lib.vcxproj" (Build target(s)).
Build succeeded.
0 Warning(s)
0 Error(s)
When I uncomment the ARM specific gear:
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
Then switch to a ARM Developer Command Prompt and attempt to build it, the result is a failure:
c:\Users\Test>msbuild /t:Build /p:Configuration=Debug;Platform=ARM lib.vcxproj
Microsoft (R) Build Engine version 4.6.1055.0
[Microsoft .NET Framework, version 4.0.30319.42000]
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 10/7/2016 7:43:12 PM.
Project "c:\Users\Test\lib.vcxproj" on node 1 (Build target(s)).
c:\Users\Test\lib.vcxproj : error MSB4057: The target "Build" does not exist in
the project.
Done Building Project "c:\Users\Test\lib.vcxproj" (Build target(s)) -- FAILED.
Build FAILED.
"c:\Users\Test\lib.vcxproj" (Build target) (1) ->
c:\Users\Test\lib.vcxproj : error MSB4057: The target "Build" does not exist i
n the project.
0 Warning(s)
1 Error(s)
All the ARM tools are installed correctly. I regularly build the project from the command line with Nmake using an ARM Developer Command Prompt.
According to the feedback at Can MSBuild be used to build a C++ project under ARM?, MSBuild does support ARM.
According to Difference between 2003 and current MSBuild schemas, I should continue to use the 2003 version of the schema.
How do I add ARM Platform support to existing Visual C++, MSBuild-based Project?
If you receive the "Compiling desktop applications for the ARM platform is not supported" error message, then add the following:
<ClCompile>
<PreprocessorDefinitions>WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
It can be added to the ItemDefinitionGroup for ARM, near the PrecomiledHeader option.
lib.cpp
// One symbol
static const int s_int = 1;
lib.vcxproj
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<!-- BEGIN Added for ARM -->
<!--
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
-->
<!-- END Added for ARM -->
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{111111-1111-1111-1111-111111111111}</ProjectGuid>
<RootNamespace>test</RootNamespace>
<PlatformToolset>v100</PlatformToolset>
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<!-- X86 Configurations -->
<ItemDefinitionGroup Condition="'$(Platform)'=='Win32'" Label="X86 Configuration">
<ClCompile>
<PrecompiledHeader />
</ClCompile>
<Lib>
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>true</ImageHasSafeExceptionHandlers>
</Lib>
</ItemDefinitionGroup>
<!-- X64 Configurations -->
<ItemDefinitionGroup Condition="'$(Platform)'=='x64'" Label="X64 Configuration">
<ClCompile>
<PrecompiledHeader />
</ClCompile>
<Lib>
<TargetMachine>MachineX64</TargetMachine>
</Lib>
</ItemDefinitionGroup>
<!-- ARM Configurations -->
<ItemDefinitionGroup Condition="'$(Platform)'=='ARM'" Label="ARM Configuration">
<ClCompile>
<PrecompiledHeader />
</ClCompile>
<Lib>
<TargetMachine>MachineARM</TargetMachine>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="lib.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>
No, this is not a duplicate. See the comment that explains why.
I have seen a few semi-related questions, but nothing that hits this on the head:
How can I build multiple Visual Studio projects at the same time?
The pattern is each solution contains several projects, each with several configurations. You can build all of those projects/configurations with the "Batch Build" feature.
Now I need a way to "Batch Build" several solutions at the same time (one command). My research seems to indicate that this is not directly possible. Any workarounds? I'm using VS 2013, if it matters.
I don't believe you can build multiple solutions within a single instance of Visual Studio; only projects.
However, I use msbuild to do just that. The following was tested with Visual Studio 2013 installed.
Create master.proj file.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Solution Include="../**/*.sln">
<Properties>Configuration=Debug;Platform=Any CPU</Properties>
</Solution>
<Solution Include="../**/*.sln">
<Properties>Configuration=Release;Platform=Any CPU</Properties>
</Solution>
</ItemGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
</PropertyGroup>
<Target Name="Build">
<MSBuild Projects="#(Solution)" BuildInParallel="true" Targets="Build" />
</Target>
<Target Name="Clean">
<MSBuild Projects="#(Solution)" BuildInParallel="true" Targets="Clean" />
</Target>
<Target Name="Rebuild">
<MSBuild Projects="#(Solution)" BuildInParallel="true" Targets="Rebuild" />
</Target>
</Project>
We're using the batching capability of msbuild to build different configurations (Release vs Debug) and platforms with one call. You can add other properties, like the architecture.
<ItemGroup>
<Solution Include="../**/*.sln">
<Properties>Configuration=Debug;Platform=Any CPU</Properties>
</Solution>
<Solution Include="../**/*.sln">
<Properties>Configuration=Release;Platform=Any CPU</Properties>
</Solution>
</ItemGroup>
To see how MSBuild resolves this, try the following:
<Target Name="Build">
<Message Text="%(Solution.Identity) -> %(Solution.Properties)" />
</Target>
You may see something like:
../ConsoleApplication1\ConsoleApplication1.sln -> Configuration=Debug;Platform=Any CPU
../ConsoleApplication2\ConsoleApplication2.sln -> Configuration=Debug;Platform=Any CPU
../ConsoleApplication3\ConsoleApplication3.sln -> Configuration=Debug;Platform=Any CPU
../ConsoleApplication1\ConsoleApplication1.sln -> Configuration=Release;Platform=Any CPU
../ConsoleApplication2\ConsoleApplication2.sln -> Configuration=Release;Platform=Any CPU
../ConsoleApplication3\ConsoleApplication3.sln -> Configuration=Release;Platform=Any CPU
In this case, the following
<Target Name="Build">
<MSBuild Projects="#(Solution)" BuildInParallel="true" Targets="Build" />
</Target>
Is almost like writing
<Target Name="Build">
<MSBuild Projects="../ConsoleApplication1\ConsoleApplication1.sln" BuildInParallel="true" Targets="Build" Properties="Configuration=Debug;Platform=Any CPU" />
<MSBuild Projects="../ConsoleApplication2\ConsoleApplication2.sln" BuildInParallel="true" Targets="Build" Properties="Configuration=Debug;Platform=Any CPU" />
<MSBuild Projects="../ConsoleApplication3\ConsoleApplication3.sln" BuildInParallel="true" Targets="Build" Properties="Configuration=Debug;Platform=Any CPU" />
<MSBuild Projects="../ConsoleApplication1\ConsoleApplication1.sln" BuildInParallel="true" Targets="Build" Properties="Configuration=Release;Platform=Any CPU" />
<MSBuild Projects="../ConsoleApplication2\ConsoleApplication2.sln" BuildInParallel="true" Targets="Build" Properties="Configuration=Release;Platform=Any CPU" />
<MSBuild Projects="../ConsoleApplication3\ConsoleApplication3.sln" BuildInParallel="true" Targets="Build" Properties="Configuration=Release;Platform=Any CPU" />
</Target>
Doing the latter isn't exactly the same. For example, the solutions will be built in serial, while the projects within those solutions will be built in parallel. But it gives you the idea of how batching works.
Here's the one command to build all the "Debug" and "Release" configurations.
msbuild master.proj /m:4 /ds
To ensure solutions (and not only their projects) are built in parallel, /m is required. The /ds will give you a detailed summary, so you can see whether its working or not.
The output on my machine is as follows:
Microsoft (R) Build Engine version 4.0.30319.33440
[Microsoft .NET Framework, version 4.0.30319.34011]
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 3/2/2014 12:56:38 PM.
1>Project "S:\msbuild\parallel\ConsoleApplication1\master.proj" on node 1 (default targets).
1>Project "S:\msbuild\parallel\ConsoleApplication1\master.proj" (1) is building "S:\msbuild\parallel\ConsoleApplication1\ConsoleApplication1.sln" (2) on node 1 (Build target(s)).
2>ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
1>Project "S:\msbuild\parallel\ConsoleApplication1\master.proj" (1) is building "S:\msbuild\parallel\ConsoleApplication2\ConsoleApplication2.sln" (3) on node 1 (Build target(s)).
3>ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
1>Project "S:\msbuild\parallel\ConsoleApplication1\master.proj" (1) is building "S:\msbuild\parallel\ConsoleApplication3\ConsoleApplication3.sln" (4) on node 1 (Build target(s)).
4>ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
1>Project "S:\msbuild\parallel\ConsoleApplication1\master.proj" (1) is building "S:\msbuild\parallel\ConsoleApplication1\ConsoleApplication1.sln" (2:2) on node 1 (Build target(s)).
2>ValidateSolutionConfiguration:
Building solution configuration "Release|Any CPU".
1>Project "S:\msbuild\parallel\ConsoleApplication1\master.proj" (1) is building "S:\msbuild\parallel\ConsoleApplication2\ConsoleApplication2.sln" (3:2) on node 1 (Build target(s)).
3>ValidateSolutionConfiguration:
Building solution configuration "Release|Any CPU".
1>Project "S:\msbuild\parallel\ConsoleApplication1\master.proj" (1) is building "S:\msbuild\parallel\ConsoleApplication3\ConsoleApplication3.sln" (4:2) on node 1 (Build target(s)).
4>ValidateSolutionConfiguration:
Building solution configuration "Release|Any CPU".
2>Project "S:\msbuild\parallel\ConsoleApplication1\ConsoleApplication1.sln" (2) is building "S:\msbuild\parallel\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.csproj" (5) on node 3 (default targets).
5>GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /platform:anycpu32bitpreferred /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Mi
crosoft\Framework\.NETFramework\v4.5\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.N
ETFramework\v4.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.DataSetExtensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFr
amework\v4.5\System.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.dll
" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\ConsoleApplication1.exe /subsystemversion:6.00 /target:exe /utf8out
put Program.cs Properties\AssemblyInfo.cs "C:\Users\werners\AppData\Local\Temp\.NETFramework,Version=v4.5.AssemblyAttributes.cs"
3>Project "S:\msbuild\parallel\ConsoleApplication2\ConsoleApplication2.sln" (3) is building "S:\msbuild\parallel\ConsoleApplication2\ConsoleApplication2\ConsoleApplication2.csproj" (7) on node 4 (default targets).
7>GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /platform:anycpu32bitpreferred /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Mi
crosoft\Framework\.NETFramework\v4.5\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.N
ETFramework\v4.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.DataSetExtensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFr
amework\v4.5\System.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.dll
" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\ConsoleApplication2.exe /subsystemversion:6.00 /target:exe /utf8out
put Program.cs Properties\AssemblyInfo.cs "C:\Users\werners\AppData\Local\Temp\.NETFramework,Version=v4.5.AssemblyAttributes.cs"
4:2>Project "S:\msbuild\parallel\ConsoleApplication3\ConsoleApplication3.sln" (4:2) is building "S:\msbuild\parallel\ConsoleApplication3\ConsoleApplication3\ConsoleApplication3.csproj" (6:2) on node 1 (default targets).
6>GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /platform:anycpu32bitpreferred /errorreport:prompt /warn:4 /define:TRACE /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Microsof
t\Framework\.NETFramework\v4.5\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFram
ework\v4.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.DataSetExtensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramewor
k\v4.5\System.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.dll" /ref
erence:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.Linq.dll" /debug:pdbonly /filealign:512 /optimize+ /out:obj\Release\ConsoleApplication3.exe /subsystemversion:6.00 /target:exe /utf8output Progr
am.cs Properties\AssemblyInfo.cs "C:\Users\werners\AppData\Local\Temp\.NETFramework,Version=v4.5.AssemblyAttributes.cs"
4>Project "S:\msbuild\parallel\ConsoleApplication3\ConsoleApplication3.sln" (4) is building "S:\msbuild\parallel\ConsoleApplication3\ConsoleApplication3\ConsoleApplication3.csproj" (6) on node 2 (default targets).
6>GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /platform:anycpu32bitpreferred /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Mi
crosoft\Framework\.NETFramework\v4.5\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.N
ETFramework\v4.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.DataSetExtensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFr
amework\v4.5\System.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.dll
" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\ConsoleApplication3.exe /subsystemversion:6.00 /target:exe /utf8out
put Program.cs Properties\AssemblyInfo.cs "C:\Users\werners\AppData\Local\Temp\.NETFramework,Version=v4.5.AssemblyAttributes.cs"
5>_CopyAppConfigFile:
Copying file from "App.config" to "bin\Debug\ConsoleApplication1.exe.config".
CopyFilesToOutputDirectory:
Copying file from "obj\Debug\ConsoleApplication1.exe" to "bin\Debug\ConsoleApplication1.exe".
ConsoleApplication1 -> S:\msbuild\parallel\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe
Copying file from "obj\Debug\ConsoleApplication1.pdb" to "bin\Debug\ConsoleApplication1.pdb".
5>Done Building Project "S:\msbuild\parallel\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.csproj" (default targets).
7>_CopyAppConfigFile:
Copying file from "App.config" to "bin\Debug\ConsoleApplication2.exe.config".
CopyFilesToOutputDirectory:
Copying file from "obj\Debug\ConsoleApplication2.exe" to "bin\Debug\ConsoleApplication2.exe".
ConsoleApplication2 -> S:\msbuild\parallel\ConsoleApplication2\ConsoleApplication2\bin\Debug\ConsoleApplication2.exe
Copying file from "obj\Debug\ConsoleApplication2.pdb" to "bin\Debug\ConsoleApplication2.pdb".
7>Done Building Project "S:\msbuild\parallel\ConsoleApplication2\ConsoleApplication2\ConsoleApplication2.csproj" (default targets).
3:2>Project "S:\msbuild\parallel\ConsoleApplication2\ConsoleApplication2.sln" (3:2) is building "S:\msbuild\parallel\ConsoleApplication2\ConsoleApplication2\ConsoleApplication2.csproj" (7:2) on node 3 (default targets).
7>GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /platform:anycpu32bitpreferred /errorreport:prompt /warn:4 /define:TRACE /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Microsof
t\Framework\.NETFramework\v4.5\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFram
ework\v4.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.DataSetExtensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramewor
k\v4.5\System.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.dll" /ref
erence:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.Linq.dll" /debug:pdbonly /filealign:512 /optimize+ /out:obj\Release\ConsoleApplication2.exe /subsystemversion:6.00 /target:exe /utf8output Progr
am.cs Properties\AssemblyInfo.cs "C:\Users\werners\AppData\Local\Temp\.NETFramework,Version=v4.5.AssemblyAttributes.cs"
6>_CopyAppConfigFile:
Copying file from "App.config" to "bin\Debug\ConsoleApplication3.exe.config".
CopyFilesToOutputDirectory:
Copying file from "obj\Debug\ConsoleApplication3.exe" to "bin\Debug\ConsoleApplication3.exe".
ConsoleApplication3 -> S:\msbuild\parallel\ConsoleApplication3\ConsoleApplication3\bin\Debug\ConsoleApplication3.exe
Copying file from "obj\Debug\ConsoleApplication3.pdb" to "bin\Debug\ConsoleApplication3.pdb".
6>Done Building Project "S:\msbuild\parallel\ConsoleApplication3\ConsoleApplication3\ConsoleApplication3.csproj" (default targets).
6>_CopyAppConfigFile:
Copying file from "App.config" to "bin\Release\ConsoleApplication3.exe.config".
CopyFilesToOutputDirectory:
Copying file from "obj\Release\ConsoleApplication3.exe" to "bin\Release\ConsoleApplication3.exe".
ConsoleApplication3 -> S:\msbuild\parallel\ConsoleApplication3\ConsoleApplication3\bin\Release\ConsoleApplication3.exe
Copying file from "obj\Release\ConsoleApplication3.pdb" to "bin\Release\ConsoleApplication3.pdb".
6>Done Building Project "S:\msbuild\parallel\ConsoleApplication3\ConsoleApplication3\ConsoleApplication3.csproj" (default targets).
2:2>Project "S:\msbuild\parallel\ConsoleApplication1\ConsoleApplication1.sln" (2:2) is building "S:\msbuild\parallel\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.csproj" (5:2) on node 4 (default targets).
5>GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /platform:anycpu32bitpreferred /errorreport:prompt /warn:4 /define:TRACE /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Microsof
t\Framework\.NETFramework\v4.5\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFram
ework\v4.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Data.DataSetExtensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramewor
k\v4.5\System.Data.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.dll" /ref
erence:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Xml.Linq.dll" /debug:pdbonly /filealign:512 /optimize+ /out:obj\Release\ConsoleApplication1.exe /subsystemversion:6.00 /target:exe /utf8output Progr
am.cs Properties\AssemblyInfo.cs "C:\Users\werners\AppData\Local\Temp\.NETFramework,Version=v4.5.AssemblyAttributes.cs"
2>Done Building Project "S:\msbuild\parallel\ConsoleApplication1\ConsoleApplication1.sln" (Build target(s)).
3>Done Building Project "S:\msbuild\parallel\ConsoleApplication2\ConsoleApplication2.sln" (Build target(s)).
4>Done Building Project "S:\msbuild\parallel\ConsoleApplication3\ConsoleApplication3.sln" (Build target(s)).
4>Done Building Project "S:\msbuild\parallel\ConsoleApplication3\ConsoleApplication3.sln" (Build target(s)).
7>_CopyAppConfigFile:
Copying file from "App.config" to "bin\Release\ConsoleApplication2.exe.config".
CopyFilesToOutputDirectory:
Copying file from "obj\Release\ConsoleApplication2.exe" to "bin\Release\ConsoleApplication2.exe".
ConsoleApplication2 -> S:\msbuild\parallel\ConsoleApplication2\ConsoleApplication2\bin\Release\ConsoleApplication2.exe
Copying file from "obj\Release\ConsoleApplication2.pdb" to "bin\Release\ConsoleApplication2.pdb".
7>Done Building Project "S:\msbuild\parallel\ConsoleApplication2\ConsoleApplication2\ConsoleApplication2.csproj" (default targets).
3>Done Building Project "S:\msbuild\parallel\ConsoleApplication2\ConsoleApplication2.sln" (Build target(s)).
5>_CopyAppConfigFile:
Copying file from "App.config" to "bin\Release\ConsoleApplication1.exe.config".
CopyFilesToOutputDirectory:
Copying file from "obj\Release\ConsoleApplication1.exe" to "bin\Release\ConsoleApplication1.exe".
ConsoleApplication1 -> S:\msbuild\parallel\ConsoleApplication1\ConsoleApplication1\bin\Release\ConsoleApplication1.exe
Copying file from "obj\Release\ConsoleApplication1.pdb" to "bin\Release\ConsoleApplication1.pdb".
5>Done Building Project "S:\msbuild\parallel\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.csproj" (default targets).
2>Done Building Project "S:\msbuild\parallel\ConsoleApplication1\ConsoleApplication1.sln" (Build target(s)).
1>Done Building Project "S:\msbuild\parallel\ConsoleApplication1\master.proj" (default targets).
Deferred Messages
Detailed Build Summary
======================
============================== Build Hierarchy (IDs represent configurations) =====================================================
Id : Exclusive Time Total Time Path (Targets)
-----------------------------------------------------------------------------------------------------------------------------------
0 : 0.053s 0.457s S:\msbuild\parallel\ConsoleApplication1\master.proj ()
| 1 : 0.027s 0.325s S:\msbuild\parallel\ConsoleApplication1\ConsoleApplication1.sln (Build)
| . 7 : 0.222s 0.222s S:\msbuild\parallel\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.csproj ()
| 2 : 0.012s 0.309s S:\msbuild\parallel\ConsoleApplication2\ConsoleApplication2.sln (Build)
| . 8 : 0.269s 0.269s S:\msbuild\parallel\ConsoleApplication2\ConsoleApplication2\ConsoleApplication2.csproj ()
| 3 : 0.009s 0.299s S:\msbuild\parallel\ConsoleApplication3\ConsoleApplication3.sln (Build)
| . 9 : 0.267s 0.267s S:\msbuild\parallel\ConsoleApplication3\ConsoleApplication3\ConsoleApplication3.csproj ()
| 4 : 0.012s 0.367s S:\msbuild\parallel\ConsoleApplication1\ConsoleApplication1.sln (Build)
| . 10 : 0.106s 0.106s S:\msbuild\parallel\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.csproj ()
| 5 : 0.011s 0.326s S:\msbuild\parallel\ConsoleApplication2\ConsoleApplication2.sln (Build)
| . 11 : 0.133s 0.133s S:\msbuild\parallel\ConsoleApplication2\ConsoleApplication2\ConsoleApplication2.csproj ()
. 6 : 0.010s 0.271s S:\msbuild\parallel\ConsoleApplication3\ConsoleApplication3.sln (Build)
| . 12 : 0.249s 0.249s S:\msbuild\parallel\ConsoleApplication3\ConsoleApplication3\ConsoleApplication3.csproj ()
============================== Node Utilization (IDs represent configurations) ====================================================
Timestamp: 1 2 3 4 Duration Cumulative
-----------------------------------------------------------------------------------------------------------------------------------
635293905985195918: 0 x x x 0.052s 0.052s #
635293905985714767: 1 x x x 0.018s 0.070s
635293905985894149: 2 x 7 x 0.010s 0.080s
635293905985993932: 3 x | 8 0.009s 0.089s
635293905986083729: 4 9 | | 0.011s 0.100s
635293905986193468: 5 | | | 0.010s 0.110s
635293905986293247: 6 | | | 0.009s 0.119s
635293905986383052: 12 | | | 0.174s 0.292s ###
635293905988119133: | | 11 | 0.057s 0.349s #
635293905988687942: | | | 10 0.007s 0.356s
635293905988757691: | x | | 0.012s 0.368s
635293905988877370: 1 x | | 0.009s 0.377s
635293905988967228: 2 x | | 0.002s 0.379s
635293905988987132: 6 x | | 0.046s 0.425s
635293905989446047: 5 x x | 0.001s 0.426s
635293905989456078: x x x | 0.029s 0.455s
635293905989745347: 4 x x x 0.001s 0.456s
635293905989755363: 0 x x x 0.001s 0.457s
-----------------------------------------------------------------------------------------------------------------------------------
Utilization: 83.6 72.6 91.7 99.5 Average Utilization: 86.9
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.61
There is a post that can help you discern what was built on what node.
You should also be aware that there are no dependencies between the solution. If there are, you'll have to be more creative. The MSDN documentation about using item metadata with task batching may help.
References:
Building Multiple Projects in Parallel with MSBuild
MSBuild not building with all cores
MSBuild 4 Detailed Build Summary
MSBuild Batching
Item Metadata in Task Batching
I am doing the following:
I have created a default class file project
Edited the csproj file to include Pre and Post BuildEvents
Uncomment the default commented out BeforeBuild and AfterBuild targets
The BeforeBuild and AfterBuild targets are not called form within Visual Studio but are from msbuild command line, why is that?
I would rather use msbuild targets rather than the PostBuildEvent as if gives me more power and flexibility, assuming it works.
Cheers,
adam
I shortened some of the paths in the output, so if they are inconsistent that is why
ClassLibrary1.csproj changes
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="BeforeBuild">
<Message Text="### BeforeBuild ###" />
</Target>
<Target Name="AfterBuild">
<Message Text="### AfterBuild ###" />
</Target>
<PropertyGroup>
<PreBuildEvent>echo PRE_BUILD</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>echo POST_BUILD</PostBuildEvent>
</PropertyGroup>
my build output from VS 2010 is
------ Rebuild All started: Project: ClassLibrary1, Configuration: Debug Any CPU ------
PRE_BUILD
ClassLibrary1 -> c:\ClassLibrary1\bin\Debug\ClassLibrary1.dll
POST_BUILD
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
and from the command line
#>msbuild ClassLibrary1.sln
Microsoft (R) Build Engine Version 4.0.30319.1
[Microsoft .NET Framework, Version 4.0.30319.239]
Copyright (C) Microsoft Corporation 2007. All rights reserved.
Build started 09/05/2012 13:27:42.
Project "c:.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
Project "c:.sln" (1) is building "c:\ClassLibrary1.csproj" (2) on node 1 (default targets).
BeforeBuild:
### BeforeBuild ###
PreBuildEvent:
echo PRE_BUILD
PRE_BUILD
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
CopyFilesToOutputDirectory:
ClassLibrary1 -> c:\bin\Debug\ClassLibrary1.dll
PostBuildEvent:
echo POST_BUILD
POST_BUILD
AfterBuild:
### AfterBuild ###
Done Building Project "c:\ClassLibrary1.csproj" (default targets).
Done Building Project "c:.sln" (default targets).
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.18
Your build events are firing, you're just not seeing them in Visual Studio.
By default VS sets the msbuild verbosity to minimal. You can get your message to show by changing the message importance to high
<Target Name="BeforeBuild">
<Message Text="### BeforeBuild ###" Importance="high" />
</Target>
<Target Name="AfterBuild">
<Message Text="### AfterBuild ###" Importance="high" />
</Target>
You can also change the verbosity setting in VS under Tools->Options then under Projects and Solutions->Build and Run.
Just for others help, when they encounter similar issue but the reason could be different.
If you have import after the target then also AfterBuild may not work.
Make sure all the import you have should be before Target Definition, Target Definition should be at the end