Show project indexes when building VS Solution with MSBuild - msbuild

When building a Soultion with Visual Studio, each line is marked with an index that corresponds to a particular procees project:
Build started...
1>------ Build started: Project: rootProject, Configuration: Debug Win32 ------
2>------ Build started: Project: SkypeDLAPI_IDL, Configuration: Debug Win32 ------
3>------ Build started: Project: NLHCLib, Configuration: Debug Win32 ------
4>------ Build started: Project: AprDLAPI_IDL, Configuration: Debug Win32 ------
5>------ Build started: Project: DLServiceCMN, Configuration: Debug Win32 ------
6>------ Build started: Project: SkypeProfile, Configuration: Debug Win32 ------
7>------ Build started: Project: DLRes, Configuration: Release Win32 ------
8>------ Build started: Project: DLMessages, Configuration: Debug Win32 ------
2>Processing .\RpcNetworkLock.idl
2>RpcNetworkLock.idl
6>spAccounts.cpp
6>spConversations.cpp
However, when I run MSBuild.exe
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\msbuild\Current\Bin\amd64\MSBuild.exe"
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\msbuild\Current\Bin\amd64\MSBuild.exe" "DeviceLock_vs2019.sln" /p:PreferredToolArchitecture=x64 /p:Configuration="Debug" /p:Platform="Win32" /t:build /maxcpucount:6 /verbosity:Minimal /fileLogger1 /fileloggerparameters1:ErrorsOnly;LogFile="C:/Users/sergey.kolesnik/dev/repos/DLP/main/src/all.log";Verbosity=Minimal;Encoding=ASCII; /fileLogger2 /fileloggerparameters2:ErrorsOnly;Append;LogFile="C:/Users/sergey.kolesnik/dev/repos/DLP/main/src/\all_Debug_Win32.err";Encoding=ASCII; /filelogger4 /fileloggerparameters4:LogFile="C:/Users/sergey.kolesnik/dev/repos/DLP/main/src/\all_Debug_Win32.det";Verbosity=normal;ShowCommandLine=no /ds
I don't get such formating. Lines are not indexed and it is very hard to understand which project a processed source file belongs to:
FileTypeDetector_vs2019.vcxproj -> C:\Users\sergey.kolesnik\dev\repos\DLP\main\src\Out_2019\x86\Debug\FileTypeDetecto
r\FileTypeDetector.lib
ElasticClient_vs2019.vcxproj -> C:\Users\sergey.kolesnik\dev\repos\DLP\main\src\Out_2019\x86\Debug\ElasticClient\Elas
ticClient.lib
RemoteInstall_vs2019.vcxproj -> C:\Users\sergey.kolesnik\dev\repos\DLP\main\src\Out_2019\x86\Debug\RemoteInstall\Remo
teInstall.lib
TextUtils_vs2019.vcxproj -> C:\Users\sergey.kolesnik\dev\repos\DLP\main\src\Out_2019\x86\Debug\TextUtils\TextUtils.li
b
AlertSenderSmtp.cpp
FontGetter.cpp
PdfShadower.cpp
PrinterEnumCallbacks.cpp
PrinterHlp.cpp
EventLog.cpp
PrinterHook.cpp
netresident.cpp
AuditRecord.cpp
PrinterNameCache.cpp
RemoteDataProcess.cpp
PrinterProcessor.cpp
hooks_srv_utils.cpp
hooks_utils.cpp
ShadowPdfMerger.cpp
iphone_cfbinary.cpp
ClipboardData.cpp
settings.cpp
ClipboardDevice.cpp
ClipboardResCache.cpp
Are there any CLI parameters for MSBuild.exe that would make the logging output like when a Solution is built with Visual Studio?
Is there an option to print a list of failed projects at the end?

The 'index' is a 'project key'. Project keys are generated per build and within a build are unique per project. (See related "Do the 1>, 2>, 3> symbols in msbuild output stand for threads?")
There doesn't seem to be a documented switch to enable showing the project keys.
However I did some quick tests that are summarized in the following table:
Cmd
OS
Project Ids in the Log?
MSBuild version
msbuild
Windows
No
17.3
dotnet msbuild
Windows
Yes
17.3
msbuild
macOS
Yes
16.10
dotnet msbuild
macOS
Yes
16.10
This shows that a work-around is to run MSBuild via the dotnet command. This doesn't require any changes in your code. The dotnet tool is just a host for the MSBuild engine. The same is true of Visual Studio (devenv.exe). As hosts for MSBuild, dotnet and devenv are enabling the Project key in the logging.
MSBuild will list all warnings and errors at the end of the log but there is no option to generate a list of the failed projects.
The summary line that appears in the Visual Studio build output (like the following example) is generated by Visual Studio and doesn't come from MSBuild.
========== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

Related

Error compile Visual Studio 2019 Project dll with MSBuild 2019, obfuscating with Eazfuscator NET 2018.2 in TeamCity 2020.2.2

I have this error when TeamCity Build Step compile with obfuscating a Visual Studio dll Project with MSBuild:
EXEC: error: Error occurred during processing of input file '.dll' -> Cannot load file or assembly 'zx_2cba06c4237a413ea1e8116e71ad61dc, PublicKeyToken = 6205972ab2f0fc68' or one of its dependencies. The system cannot find the specified file. C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets (5473,5): error MSB3073: The command "if /I "Release" == "Release" "C:\Program Files (x86)\Eazfuscator.NET\Eazfuscator.NET.exe" "E:\Builds\MyDll\bin\Release\MyDll.dll" --msbuild-project-path "E:\Builds\MyDll\MyDll.csproj" --msbuild-project-configuration "Release" --msbuild-project-platform "AnyCPU" --msbuild-solution-path "*Undefined*" -n --newline-flush -v 2018.2" exit with code 1.
Eazfuscator-.NET-2018.2.2 is not compatible with MSBuild 2019, the solution is use Eazfuscator-.NET-2019.1 as minimun version.

nvcc error : 'cicc' died with status 0xC0000005 (ACCESS_VIOLATION) when building tensorflow with bazel

I am trying to build Tensorflow 1.14.0 dll. I am using bazel 0.24.1 to do it. I also use cuDNN 7.1.4 and CUDA 9.0.I want it to use Visual C++ Build Tools 2015, but when running bazel to build dll:
bazel build --config=cuda tensorflow:tensorflow.dll,
by default in LIB and INCLUDE variables path C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023 is set. I then get bunch of errors like C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include\xutility(796): error: expression must have a constant value. Build failes with error: nvcc error : 'cicc' died with status 0xC0000005 (ACCESS_VIOLATION).
I tried to set:
set BAZEL_VS=C:\Program Files (x86)\Microsoft Visual Studio 14.0
set BAZEL_VC=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
but error still occurs. Any ideas?
I finally got a solution. You can force correct paths by setting following environment variables:
CPU_COMPILER = ('C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe')
GCC_HOST_COMPILER_PATH = ('C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe')
just before running
bazel build --config=cuda tensorflow:tensorflow.dll
in commandline. It's best to do it in Powershell, as there is a problem with spaces/apostrophes in paths when using Windows commandline.

Continuous Integration with .Net Core App and Database Project (VS2017)

I have a .net Core app in VS2017 that also has a Database Project in the solution as well.
I want to set up continuous integration within Visual Studio Team Services to Build and Publish both the app and the database project. I have been able to get either the database project or app in the Publish Artifacts, but can't get them both at the same time. I am assuming I have set up my paths up wrong, but I have not had an luck with any of the combinations I have tried and there is very little documentation that I can find on having both an .net core app and a database project build and deploy together. How do I build and publish both the .net core app and the database project together in VSTS?
Below is the current set up I have in VSTS for the Build. I currently was trying to put the database project in one folder ($(build.artifactstagingdirectory)) and the app in another folder since resulted in
List of current steps
Below is the output from the current setup as seen in the image above
Starting: Build
******************************************************************************
Task : .NET Core
Description : Build, test and publish using dotnet core command-line.
Version : 1.0.2
Author : Microsoft Corporation
"C:\Program Files\dotnet\dotnet.exe" build d:\a\1\s\DatabaseDeploymentTest.web\DatabaseDeploymentTest.web.csproj --configuration release
Microsoft (R) Build Engine version 15.1.1012.6693
Copyright (C) Microsoft Corporation. All rights reserved.
DatabaseDeploymentTest.web -> d:\a\1\s\DatabaseDeploymentTest.web\bin\release\netcoreapp1.1\DatabaseDeploymentTest.web.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:07.50
Finishing: Build
Starting: Build solution **/*.sln
******************************************************************************
Task : MSBuild
Description : Build with MSBuild
Version : 1.120.0
Author : Microsoft Corporation
"D:\a_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824\1.120.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [15.0,16.0) -latest -format json
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" "d:\a\1\s\DatabaseDeploymentTest.sln" /nologo /nr:false /dl:CentralLogger,"D:\a_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824\1.120.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=|SolutionDir=d:\a\1\s"*ForwardingLogger,"D:\a_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824\1.120.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /t:build /p:CmdLineInMemoryStorage=True /p:_MSDeployUserAgent="VSTS_8786b412-4ab0-4ae3-aa96-af0394363b64_build_32_835"
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 8/7/2017 6:40:49 PM.
Project "d:\a\1\s\DatabaseDeploymentTest.sln" on node 1 (build target(s)).
ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
Project "d:\a\1\s\DatabaseDeploymentTest.sln" (1) is building "d:\a\1\s\DatabaseDeploymentTest\DatabaseDeploymentTest.sqlproj" (2) on node 1 (default targets).
PrepareForBuild:
Creating directory "bin\Debug\".
Creating directory "obj\Debug\".
CoreCompile:
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:DEBUG;TRACE /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.2\mscorlib.dll" /debug+ /debug:full /optimize- /out:obj\Debug\DatabaseDeploymentTest.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 /warnaserror- /utf8output "d:\a_temp.NETFramework,Version=v4.5.2.SqlClrAttributes.cs"
Using shared compilation with compiler from directory: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn
SqlBuild:
Creating a model to represent the project...
Loading project references...
Loading project files...
Building the project model and resolving object interdependencies...
Validating the project model...
Writing model to d:\a\1\s\DatabaseDeploymentTest\obj\Debug\Model.xml...
DatabaseDeploymentTest\dbo\Stored Procedures\LoadEmployees.sql(1,1): Warning SQL71558: The object reference [dbo].[Employees].[HKSEmployeeId] differs only by case from the object definition [dbo].[Employees].[HKSEmployeeID].
d:\a\1\s\DatabaseDeploymentTest\dbo\Stored Procedures\LoadEmployees.sql(1,1,1,1): Build warning SQL71558: The object reference [dbo].[Employees].[HKSEmployeeId] differs only by case from the object definition [dbo].[Employees].[HKSEmployeeID]. [d:\a\1\s\DatabaseDeploymentTest\DatabaseDeploymentTest.sqlproj]
CopyFilesToOutputDirectory:
Copying file from "obj\Debug\DatabaseDeploymentTest.dll" to "bin\Debug\DatabaseDeploymentTest.dll".
DatabaseDeploymentTest -> d:\a\1\s\DatabaseDeploymentTest\bin\Debug\DatabaseDeploymentTest.dll
Copying file from "obj\Debug\DatabaseDeploymentTest.pdb" to "bin\Debug\DatabaseDeploymentTest.pdb".
SqlPrepareForRun:
DatabaseDeploymentTest -> d:\a\1\s\DatabaseDeploymentTest\bin\Debug\DatabaseDeploymentTest.dacpac
Done Building Project "d:\a\1\s\DatabaseDeploymentTest\DatabaseDeploymentTest.sqlproj" (default targets).
Project "d:\a\1\s\DatabaseDeploymentTest.sln" (1) is building "d:\a\1\s\DatabaseDeploymentTest.web\DatabaseDeploymentTest.web.csproj" (3) on node 1 (default targets).
PrepareForBuild:
Creating directory "bin\Debug\netcoreapp1.1\".
Creating directory "obj\Debug\netcoreapp1.1\".
PreComputeCompileTypeScript:
C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.2\tsc.exe --noEmitOnError --listEmittedFiles
CompileTypeScript:
C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.2\tsc.exe --noEmitOnError --listEmittedFiles
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\csc.exe /noconfig /unsafe- /checked- /nowarn:1701,1702,1705 /nostdlib+ /errorreport:prompt /warn:4 /define:TRACE;DEBUG;NETCOREAPP1_1 /reference:C:\Users\buildguest.nuget\packages\microsoft.applicationinsights.aspnetcore\2.0.0\lib\netstandard1.6\Microsoft.ApplicationInsights.AspNetCore.dll /reference:C:\Users\buildguest.nuget\packages\microsoft.applicationinsights\2.2.0\lib\netstandard1.5\Microsoft.ApplicationInsights.dll /reference:C:\Users\buildguest.nuget\packages\microsoft.aspnetcore.antiforgery\1.1.1\lib\netstandard1.3\Microsoft.AspNetCore.Antiforgery.dll /reference:C:\Users\buildguest.nuget\packages\microsoft.aspnetcore.authorization\1.1.1\lib\netstandard1.3\Microsoft.AspNetCore.Authorization.dll /reference:C:\Users\buildguest.nuget\packages\microsoft.aspnetcore.cors\1.1.1\lib\netstandard1.3\Microsoft.AspNetCore.Cors.dll /reference:C:\Users\buildguest.nuget\packages\microsoft.aspnetcore.cryptography.internal\1....
Using shared compilation with compiler from directory: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn
GetTypeScriptCopyToOutputDirectoryItems:
Adding items with BuildAction=TypeScriptCompile to the same collections that will be populated (with items of other BuildActions) by the GetCopyToOutputDirectoryItems target
CopyFilesToOutputDirectory:
Copying file from "obj\Debug\netcoreapp1.1\DatabaseDeploymentTest.web.dll" to "bin\Debug\netcoreapp1.1\DatabaseDeploymentTest.web.dll".
DatabaseDeploymentTest.web -> d:\a\1\s\DatabaseDeploymentTest.web\bin\Debug\netcoreapp1.1\DatabaseDeploymentTest.web.dll
Copying file from "obj\Debug\netcoreapp1.1\DatabaseDeploymentTest.web.pdb" to "bin\Debug\netcoreapp1.1\DatabaseDeploymentTest.web.pdb".
Done Building Project "d:\a\1\s\DatabaseDeploymentTest.web\DatabaseDeploymentTest.web.csproj" (default targets).
Done Building Project "d:\a\1\s\DatabaseDeploymentTest.sln" (build target(s)).
Build succeeded.
"d:\a\1\s\DatabaseDeploymentTest.sln" (build target) (1) ->
"d:\a\1\s\DatabaseDeploymentTest\DatabaseDeploymentTest.sqlproj" (default target) (2) ->
(SqlBuild target) ->
d:\a\1\s\DatabaseDeploymentTest\dbo\Stored Procedures\LoadEmployees.sql(1,1,1,1): Build warning SQL71558: The object reference [dbo].[Employees].[HKSEmployeeId] differs only by case from the object definition [dbo].[Employees].[HKSEmployeeID]. [d:\a\1\s\DatabaseDeploymentTest\DatabaseDeploymentTest.sqlproj]
1 Warning(s)
0 Error(s)
Time Elapsed 00:00:12.94
Finishing: Build solution **/*.sln
Starting: Copy Files to: $(build.artifactstagingdirectory)
******************************************************************************
Task : Copy Files
Description : Copy files from source folder to target folder using match patterns (The match patterns will only match file paths, not folder paths)
Version : 2.117.0
Author : Microsoft Corporation
found 0 files
Finishing: Copy Files to: $(build.artifactstagingdirectory)
Starting: Publish
******************************************************************************
Task : .NET Core
Description : Build, test and publish using dotnet core command-line.
Version : 1.0.2
Author : Microsoft Corporation
"C:\Program Files\dotnet\dotnet.exe" publish d:\a\1\s\DatabaseDeploymentTest.web\DatabaseDeploymentTest.web.csproj --configuration release --output d:\a\1\a\DatabaseDeploymentTest.web
Microsoft (R) Build Engine version 15.1.1012.6693
Copyright (C) Microsoft Corporation. All rights reserved.
DatabaseDeploymentTest.web -> d:\a\1\s\DatabaseDeploymentTest.web\bin\release\netcoreapp1.1\DatabaseDeploymentTest.web.dll
Finishing: Publish
Starting: Publish Artifact
******************************************************************************
Task : Publish Build Artifacts
Description : Publish Build artifacts to the server or a file share
Version : 1.120.1
Author : Microsoft Corporation
Async Command Start: Upload Artifact
Uploading 1 files
File upload succeed.
Upload 'd:\a\1\a' to file container: '#/677588/DatabaseDeploymentTest'
Associated artifact 724 with build 835
Async Command End: Upload Artifact
Finishing: Publish Artifact
Specify $(build.sourcesdirectory) in Source Folder and **\*.dacpac in Contents of Copy files task.

How can I use Mono's xbuild to build a TypeScript project on Linux?

I'm developing this project with Visual Studio on Windows, but I've had no problems compiling it with xbuild on Linux until I added some files that need to be built with TypeScript. Specifically, a set of .ts files are compiled to produce app.js, which is then included as an embedded resource. The build works in VS, but with xbuild I get this:
$ xbuild Guncho.sln
XBuild Engine Version 12.0
Mono, Version 3.10.0.0
Copyright (C) 2005-2013 Various Mono authors
Build started 12/23/2014 13:00:53.
__________________________________________________
Project "/home/guncho/test-guncho/Guncho.sln" (default target(s)):
Target ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
Target Build:
Project "/home/guncho/test-guncho/Guncho.Site/Guncho.Site.csproj" (default target(s)):
Target PrepareForBuild:
Configuration: Debug Platform: AnyCPU
Target CopyNonResxEmbeddedResources:
/usr/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets: error : Cannot copy /home/guncho/test-guncho/Guncho.Site/app/app.js to /home/guncho/test-guncho/Guncho.Site/obj/Debug/Guncho.Site.app.app.js, as the source file doesn't exist.
/usr/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets: error : Cannot copy /home/guncho/test-guncho/Guncho.Site/app/app.js.map to /home/guncho/test-guncho/Guncho.Site/obj/Debug/Guncho.Site.app.app.js.map, as the source file doesn't exist.
Task "Copy" execution -- FAILED
Done building target "CopyNonResxEmbeddedResources" in project "/home/guncho/test-guncho/Guncho.Site/Guncho.Site.csproj".-- FAILED
Done building project "/home/guncho/test-guncho/Guncho.Site/Guncho.Site.csproj".-- FAILED
Task "MSBuild" execution -- FAILED
Done building target "Build" in project "/home/guncho/test-guncho/Guncho.sln".-- FAILED
Done building project "/home/guncho/test-guncho/Guncho.sln".-- FAILED
Build FAILED.
It's not even attempting the TypescriptCompile step. The build works if I manually run tsc to generate app.js, but what do I need to do to get it working automatically?

Visual C++ Express 2010: "attempting to build a Win32 application from an x64-environment"

1) ran "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd /x64 /Debug" to set environment variables.
2) ran "vcexpress" from that command prompt. The reason for starting from the command prompt is so that the correct compiler and linker are detected. Otherwise they defaulted to x86_amd64 when vcexpress is run from the start menu.
3) attempted to build my project, a SuperBuild generated by CMake which calls msbuild to compile some static solution files. Received this error:
You are attempting to build a Win32 application from an x64-environment.
If using the Windows 7.1 SDK build environment, type setenv / x86
The solution was to change the TARGET_CPU variable. When setenv /x64 /debug was run, it set:
C:\Temp\cmakeex\build>echo %TARGET_CPU%
x64
I changed this to amd64, and the project now builds successfully:
>set TARGET_CPU=amd64