Jenkins windows slave not able build COM dll using command line option - c++

I have configure jenkins on Ubuntu, I am trying to build Windows COM object on windows slave node.
First issue i have face for MSBuild.exe : - I am able to resolve path error after installing MSBuild Plugin and setting MSbuild path in jenkins.
It is giving below error even after setting MSBuild location
" error MSB3411: Could not load the Visual C++ component "VCBuild.exe""
Please see below error statement:
Path To MSBuild.exe: C:\Windows\Microsoft.NET\Framework64\v3.5\MSBuild.exe
Executing the command cmd.exe /C " C:\Windows\Microsoft.NET\Framework64\v3.5\MSBuild.exe /t:Rebuild /p:Configuration=Release C:\Jenkins_Home\workspace\test\test.sln " && exit %%ERRORLEVEL%% from C:\Jenkins_Home\workspace\test
[test] $ cmd.exe /C " C:\Windows\Microsoft.NET\Framework64\v3.5\MSBuild.exe /t:Rebuild /p:Configuration=Release C:\Jenkins_Home\workspace\test\test.sln " && exit %%ERRORLEVEL%%
Microsoft (R) Build Engine Version 3.5.30729.5420
[Microsoft .NET Framework, Version 2.0.50727.5485]
Copyright (C) Microsoft Corporation 2007. All rights reserved.
Build started 11/30/2015 3:34:35 PM.
Project "C:\Jenkins_Home\workspace\test\test.sln" on node 0 (Rebuild target(s)).
Building solution configuration "Release|Win32".
C:\Jenkins_Home\workspace\test\test.sln.cache(64,5): error MSB3411: Could not load the Visual C++ component "VCBuild.exe". If the component is not installed, either 1) install the Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5, or 2) install Microsoft Visual Studio 2008.
Done Building Project "C:\Jenkins_Home\workspace\test\test.sln" (Rebuild target(s)) -- FAIL
Same project i am able to build on windows command line, I am not able to figure out issue with jenkins. -- Any suggestion to resolve this issue

I have resolve this issue by setting path in jenkins slave node configuration.
I have taken path environment variable details by running set command on command line where i am able to build this project.
go to http://server_name:8080/computer/win_slave_name/configure and add path as show in image

Related

Docker not running .exe file

I have a question regarding dockerizing C/C++ project. I am using visual studio compiler image because I have a lot of environment trouble with running MinGW compiler.
I confirmed project using visual studio compiler image and building solution perfectly, but I'm seeing problem with actually running generated .exe file in docker container environment.
Following is my dockerfile code :
# escape=`
# Copyright (C) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license. See LICENSE.txt in the project root for license information.
ARG FROM_IMAGE=microsoft/dotnet-framework:3.5-sdk-windowsservercore-1709
FROM ${FROM_IMAGE}
# Reset the shell.
SHELL ["cmd", "/S", "/C"]
# Set up environment to collect install errors.
COPY Install.cmd C:\TEMP\
ADD https://aka.ms/vscollect.exe C:\TEMP\collect.exe
# Install Node.js LTS
ADD https://nodejs.org/dist/v8.11.3/node-v8.11.3-x64.msi C:\TEMP\node-install.msi
RUN start /wait msiexec.exe /i C:\TEMP\node-install.msi /l*vx "%TEMP%\MSI-node-install.log" /qn ADDLOCAL=ALL
# Download channel for fixed install.
ARG CHANNEL_URL=https://aka.ms/vs/15/release/channel
ADD ${CHANNEL_URL} C:\TEMP\VisualStudio.chman
# Download and install Build Tools for Visual Studio 2017 for native desktop workload.
ADD https://aka.ms/vs/15/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe
RUN C:\TEMP\Install.cmd C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
--channelUri C:\TEMP\VisualStudio.chman `
--installChannelUri C:\TEMP\VisualStudio.chman `
--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended`
--installPath C:\BuildTools
# Execute commands once container runs
# Build solution using MSVC
ENTRYPOINT C:\BuildTools\Common7\Tools\VsDevCmd.bat &&
I copied it from microsoft official website here : https://devblogs.microsoft.com/cppblog/using-msvc-in-a-docker-container-for-your-c-projects/
and following is my output
C:\Users\cshim31\smarts-pxie-executive>docker run -v C:\Users\cshim31\smarts-pxie-executive:c:\smarts-pxie-executive -it buildtools2017native:2017 msbuild C:\smarts-pxie-executive\Project4.sln /p:Configuration=Debug /p:Platform=x64
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 3/10/2021 6:07:46 PM.
Project "C:\smarts-pxie-executive\Project4.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Debug|x64".
Project "C:\smarts-pxie-executive\Project4.sln" (1) is building "C:\smarts-pxie-executive\Project4.vcxproj" (2) on node 1 (default targets).
InitializeBuildStatus:
Creating "x64\Debug\Project4.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
All outputs are up-to-date.
Link:
All outputs are up-to-date.
Project4.vcxproj -> C:\smarts-pxie-executive\x64\Debug\Project4.exe
FinalizeBuildStatus:
Deleting file "x64\Debug\Project4.tlog\unsuccessfulbuild".
Touching "x64\Debug\Project4.tlog\Project4.lastbuildstate".
Done Building Project "C:\smarts-pxie-executive\Project4.vcxproj" (default targets).
Done Building Project "C:\smarts-pxie-executive\Project4.sln" (default targets).
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:01.12
C:\Users\cshim31\smarts-pxie-executive>
After building, it instantly terminated without printing out program output.
Instead, I tried going into docker environment and running .exe by myself.
and following is output :
C:\smarts-pxie-executive\x64\Debug>Project4.exe
C:\smarts-pxie-executive\x64\Debug>
it didn't print out error messages. It works perfectly fine when I opened .exe file on local computer. I am not sure how I should resolve problem since there isn't error message that I can see and fix.
I had the same issue with a Rust executable on a Docker image based on windows/servercore:ltsc2019. I used Dependency Walker to open the executable and saw that it depended on vcruntime140.dll. Then after downloading and installing the Visual C++ 2015 Redistributable package within the Docker container, my executable ran correctly.

CMake can't get the value of VCTargetsPath when generating for UWP

I'm trying to use CMake to build a Universal Windows App, but I get the following build error (latest Visual Studio 2019 and Windows 10 SDK are installed):
› cmake -B. -H<my source dir> -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.
CMake Error at CMakeLists.txt:3 (project):
Failed to run MSBuild command:
C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe
to get the value of VCTargetsPath:
Microsoft (R) Build Engine version 16.5.1+4616136f8 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 5/16/2020 9:52:00 PM.
Project "C:\test\CMakeFiles\3.17.2\VCTargetsPath.vcxproj" on node 1 (default targets).
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(777,5): error : The OutputPath property is not set for project 'VCTargetsPath.vcxproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='x64'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project. [C:\test\CMakeFiles\3.17.2\VCTargetsPath.vcxproj]
Done Building Project "C:\test\CMakeFiles\3.17.2\VCTargetsPath.vcxproj" (default targets) -- FAILED.
Build FAILED.
"C:\test\CMakeFiles\3.17.2\VCTargetsPath.vcxproj" (default target) (1) ->
(_CheckForInvalidConfigurationAndPlatform target) ->
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(777,5): error : The OutputPath property is not set for project 'VCTargetsPath.vcxproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='x64'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project. [C:\test\CMakeFiles\3.17.2\VCTargetsPath.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.07
Exit code: 1
-- Configuring incomplete, errors occurred!
What does that mean? I've also tried to specify the exact Windows SDK version for CMAKE_SYSTEM_VERSION, but no luck.
I solved the problem. I did many things, therefore I cannot tell which one exactly solved the problem. But try the following.
From VisualStudio Installer app, click Modify and install C++ Universal Windows Platform support for v142 build tools (ARM64) individual component.

Data collector 'Code Coverage' failed to provide initialization information

I'm trying to create a code coverage report using the Build pipeline.
I have added the task of typeVisual Studio code in the build pipeline and have enabled the Code Coverage.
When the build is triggered. I'm getting :
Data collector 'Code Coverage' message: Data collector 'Code Coverage' failed to provide initialization information. Error: System.TypeInitializationException: The type initializer for 'Microsoft.VisualStudio.Diagnostics.Logging.ProfilerInterop' threw an exception. ---> Microsoft.VisualStudio.Diagnostics.Common.InvariantException: Failed to load IntelliTrace Profiler binary or failed to locate functions.
and
---> System.ComponentModel.Win32Exception: The system cannot find the path specified
This is running the tests and all the tests are passed. However I'm not able to view the code coverage report. The report which it has created contains only information about the tests
Any input on where we specify the path will be useful.
You basically need Visual Studio Test Agent for Code Coverage.
There are 2 possible ways to install for this:
Option 1
Install Agents for Visual Studio 2019 on the Build server (download from here, see under Tools for Visual Studio 2019).
In the build pipeline edit the Visual Studio Test Assemblies task. Set Select test platform using to Specific location and set Path to vstest.console.exe to for example C:\Program Files (x86)\Microsoft Visual Studio\2019\TestAgent\Common7\IDE\Extensions\TestPlatform\vstest.console.exe.
Option 2
Add the Visual Studio test platform installer build task to your pipeline. (Add this task before the testing task).
In the Visual Studio Test Assemblies task you have to select Installed by Tools Installer as the Test platform version
Note: in my experience I had some tests who succeeded with option 1, but failed in option2. Sadly I don't have the time to figure out why...
I faced this issue when configuring a build container.
1 To install the Visual Studio 2019 Test Agent, I used Chocolatey
1.2 Install Chocolatey
ENV chocolateyUseWindowsCompression = false
SHELL ["powershell.exe", "-ExecutionPolicy", "Bypass", "-Command"]
RUN Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')); `
[System.Environment]::SetEnvironmentVariable('PATH', "\"${env:PATH};%ALLUSERSPROFILE%\chocolatey\bin\"", 'Machine'); `
choco feature enable -n allowGlobalConfirmation;
1.2 Install the TestAgent with chocolatey
RUN choco install visualstudio2019testagent -y
2. Edit the VSTest task on your pipeline to use a specific location.
In my case, I've installed into the container the VSBuildTools. The VSTest task used the VSBuildTools vstest.console.exe but the execution needs some libraries that are located at the TestAgent folders.
vstestLocationMethod: location
vstestLocation: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\TestAgent\Common7\IDE\Extensions\TestPlatform\vstest.console.exe'
Had a similar problem after updating build agent and adding VS2017 capabilities.
Downloaded (from https://www.opendll.com): microsoft.intellitrace.profiler.dll
Add to folder C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\Extensions\TestPlatform\x64​
Good luck

Unable to build Qtsvg in windows using VS 2012 Express

i am using qt 5.5.0 for which I am trying to build qtsvg submodule
i am using the following steps.
PROCESS:-
1.Download Reqirements
Qt source code http://www.qt.io/download-open-source/#section- (here i am using Qt 5.5.0)
Visual Studio 2012 express
ActivePerl-5.20.2.2002-MSWin32-x64
Python 3.5.0 (for x64) through the installer
Jom
Rubyinstaller-2.2.3-x64 or later
Extract the source code in a directory( I’ve done it in “C:\Qt\5.5.0”)
Extract jom in a directory.(i’ve extract in “c:\”)
Set the environment variables(set them from properties of Computer->advanced System Settings->Advanced tabs->Environment Variables-> User Variables)
QTDIR=C:\Qt\qt-5.5.0\vs2011
QMAKESPEC=win32-msvc2012
Add below in PATH
%QTDIR%\bin;
C:\Qt\5.0.0\gnuwin32\bin;
C:\icu\bin64;
C:\Python27\DLLs;
C:\Python27
C:\Perl64\site\bin
C:\Perl64\bin
Restart or log off/on your computer in order to let environment variables changes take place.
Open VS2012 x64 Cross Tools Win64 Command Prompt (2012) (In case of 64 bit build) or Visual Studio x86 Native Tools Command Prompt (2012) (In case of 32 bit build) in Administrator mode for msvc 2011 compiler.
[You will find command prompt here - ( C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Visual Studio 2012\Visual Studio Tools )]
On visual studio command prompt run the following commands
cd C:\Qt\build\
C:\Qt\5.5.0\configure -debug-and-release -shared -opensource -platform win32-msvc2012
C:\jom_1_1_0\jom.exe
After following all the above Steps, I found that qtsvg DIR is present in build, but as I am trying to use it in CMake, it is generating an Error, at Qtsvg is not found.
On Manually Coppying the Dir. The error is still Generate as:
CMake Error at C:/Qt/build/lib/cmake/Qt5Core/Qt5CoreMacros.cmake:327 (message):
Can not use "Svg" module which has not yet been found.
Call Stack (most recent call first):
CMakeLists.txt:50 (qt5_use_modules)
Can someone Help me or guide me what I am doing wrong?????
while Building Qt using the above mentioned method, I skipped to notice that for building all the modules of QT the build is obtained at Qbase directory any in CMake I was using the outer Directory which does not exist in this case
the build is in C:\Qt\5.5.0\build-5.5.0\qtbase\lib\cmake\Qt5
however I was checking in C:\Qt\5.5.0\build-5.5.0\lib\cmake\Qt5 hence Cmake was not able to find the correct path

devenv fails on build machine

Our .vdproj setup project contains a few .dbproj projects. We are going to use devenv since MSBuild does not support the creation of MSIs from .vdproj setup install projects. When I run devenv.com from the command line on a build machine I receive the following error:
The project 'UserManagement.dbproj' will close once model building has paused.
Serializing the project state for project 'UserManagement.dbproj'...
Project `UserManagement.dbproj' was successfully serialized to file 'C:\Builds\Test\Sources\UserManagement\UserManagement.dbmdl'.
C:\Builds\Test\Sources\UserManagement\UserManagement.dbproj : error : Error HRESULT E_FAIL has been returned from a call to a COM component.
It works great from my local machine.
We have installed Visual Studio 2010 SP1 on our build box.