Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Solutions/before.targets
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<PlatformToolset Condition="'$(PlatformToolset)' == '' AND '$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
<PlatformToolset Condition="'$(PlatformToolset)' == '' AND '$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
<PlatformToolset Condition="'$(PlatformToolset)' == '' AND '$(VisualStudioVersion)' == '17.0'">v143</PlatformToolset>
<PlatformToolset Condition="'$(PlatformToolset)' == '' AND '$(VisualStudioVersion)' == '18.0'">v145</PlatformToolset>
<!-- Fallback to Visual Studio 2017 (v141) toolset by default -->
<PlatformToolset Condition="'$(PlatformToolset)' == ''">v141</PlatformToolset>
<PlatformToolset Condition="'$(PlatformToolset)' != ''">$(PlatformToolset)</PlatformToolset>
Expand Down
1 change: 1 addition & 0 deletions build-all-v143.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

set VSTOOLS_VERSION=vs2022
set PlatformToolset=v143
set SKIP_NET40_BUILD=1
call build-all.bat
6 changes: 6 additions & 0 deletions build-all-v145.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@echo off

set VSTOOLS_VERSION=vs2026
set PlatformToolset=v145
set SKIP_NET40_BUILD=1
call build-all.bat
16 changes: 12 additions & 4 deletions build-all.bat
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ exit /b 1
:after_custom_props_validation
call tools\gen-version.cmd

set NET40_MD_TARGETS=,net40:Rebuild
set NET40_SAMPLE_TARGETS=,Samples\cs\SampleCsNet40:Rebuild
if DEFINED SKIP_NET40_BUILD (
echo Skipping legacy .NET Framework 4.0 targets.
set NET40_MD_TARGETS=
set NET40_SAMPLE_TARGETS=
)

echo Update all public submodules...
git -c submodule."lib/modules".update=none submodule update --init --recursive

Expand All @@ -49,12 +57,12 @@ if NOT EXIST %GTEST_PATH%\CMakeLists.txt (
if NOT DEFINED SKIP_MD_BUILD (
REM DLL and static /MD build
REM Release
call tools\RunMsBuild.bat Win32 Release "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild,net40:Rebuild,win10-cs:Rebuild,win10-dll:Rebuild,win10-lib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild,Samples\cs\SampleCsNet40:Rebuild" %CUSTOM_PROPS%
call tools\RunMsBuild.bat x64 Release "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild,net40:Rebuild,win10-cs:Rebuild,win10-dll:Rebuild,win10-lib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild,Samples\cs\SampleCsNet40:Rebuild" %CUSTOM_PROPS%
call tools\RunMsBuild.bat Win32 Release "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild%NET40_MD_TARGETS%,win10-cs:Rebuild,win10-dll:Rebuild,win10-lib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild%NET40_SAMPLE_TARGETS%" %CUSTOM_PROPS%
call tools\RunMsBuild.bat x64 Release "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild%NET40_MD_TARGETS%,win10-cs:Rebuild,win10-dll:Rebuild,win10-lib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild%NET40_SAMPLE_TARGETS%" %CUSTOM_PROPS%
REM Debug
if NOT DEFINED SKIP_DEBUG_BUILD (
call tools\RunMsBuild.bat Win32 Debug "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild,net40:Rebuild,win10-cs:Rebuild,win10-dll:Rebuild,win10-lib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild" %CUSTOM_PROPS%
call tools\RunMsBuild.bat x64 Debug "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild,net40:Rebuild,win10-cs:Rebuild,win10-dll:Rebuild,win10-lib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild" %CUSTOM_PROPS%
call tools\RunMsBuild.bat Win32 Debug "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild%NET40_MD_TARGETS%,win10-cs:Rebuild,win10-dll:Rebuild,win10-lib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild" %CUSTOM_PROPS%
call tools\RunMsBuild.bat x64 Debug "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild%NET40_MD_TARGETS%,win10-cs:Rebuild,win10-dll:Rebuild,win10-lib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild" %CUSTOM_PROPS%
)
)

Expand Down
11 changes: 9 additions & 2 deletions docs/cpp-start-windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,20 @@ If your project requires the Universal Telemetry Client (a.k.a. UTC) to send tel

## **Windows prerequisites and dependencies for building from source**

* Visual Studio 2019 or 2022 (2022 is recommended).
* Visual Studio 2019, 2022, or 2026 (2022 or newer is recommended).
* C++ Dev Tools

## **Option 1: Build the SDK from source using Visual Studio**

* Open the *cpp_client_telemetry/Solutions/MSTelemetrySDK.sln* solution in Visual Studio.
* Alternatively you can use *build-all.bat* located in workspace root folder to build from command line
* Alternatively, build from the workspace root with the script that matches your Visual Studio toolset:
* Visual Studio 2019: `build-all-v142.bat`
* Visual Studio 2022: `build-all-v143.bat`
* Visual Studio 2026: `build-all-v145.bat`

The version-specific scripts set `VSTOOLS_VERSION` and `PlatformToolset` before calling `build-all.bat`. If you call `build-all.bat` directly, set both values yourself so `tools\vcvars.cmd` selects the same Visual Studio installation as your requested toolset.

Visual Studio 2022 and newer may report the legacy .NET Framework 4.0 projects (`net40`, `win32-cs`, and `SampleCsNet40`) as unsupported. They are only needed for the legacy .NET Framework wrapper; the VS2022 and VS2026 command-line wrappers skip those projects, and you can unload them in the IDE when building the native SDK.

If your build fails, then you most likely missing the following optional Visual Studio components:

Expand Down
22 changes: 22 additions & 0 deletions tools/.vsconfig.vs2022
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Component.Windows10SDK",
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
"Microsoft.VisualStudio.Component.VC.Tools.ARM",
"Microsoft.VisualStudio.Component.VC.Tools.ARM64",
"Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
"Microsoft.VisualStudio.Component.VC.CMake.Project",
"Microsoft.VisualStudio.Component.VC.ATL",
"Microsoft.VisualStudio.Component.VC.ATL.ARM",
"Microsoft.VisualStudio.Component.VC.ATL.ARM64",
"Microsoft.VisualStudio.Component.VC.ATLMFC",
"Microsoft.VisualStudio.Component.VC.CLI.Support",
"Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset",
"Microsoft.VisualStudio.Component.VC.Llvm.Clang",
"Microsoft.Component.VC.Runtime.UCRTSDK",
"Microsoft.VisualStudio.Workload.NativeDesktop",
"Microsoft.VisualStudio.ComponentGroup.UWP.VC",
"Microsoft.VisualStudio.Workload.Universal"
]
}
22 changes: 22 additions & 0 deletions tools/.vsconfig.vs2026
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Component.Windows10SDK",
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
"Microsoft.VisualStudio.Component.VC.Tools.ARM",
"Microsoft.VisualStudio.Component.VC.Tools.ARM64",
"Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
"Microsoft.VisualStudio.Component.VC.CMake.Project",
"Microsoft.VisualStudio.Component.VC.ATL",
"Microsoft.VisualStudio.Component.VC.ATL.ARM",
"Microsoft.VisualStudio.Component.VC.ATL.ARM64",
"Microsoft.VisualStudio.Component.VC.ATLMFC",
"Microsoft.VisualStudio.Component.VC.CLI.Support",
"Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset",
"Microsoft.VisualStudio.Component.VC.Llvm.Clang",
"Microsoft.Component.VC.Runtime.UCRTSDK",
"Microsoft.VisualStudio.Workload.NativeDesktop",
"Microsoft.VisualStudio.ComponentGroup.UWP.VC",
"Microsoft.VisualStudio.Workload.Universal"
]
}
22 changes: 20 additions & 2 deletions tools/RunMsBuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
set TARGETPLATFORM=%1
set CONFIGURATION=%2
set TARGETS=%~3
call :NormalizeTargets "%TARGETS%"

set CUSTOM_PROPS=
if ("%~4" == "") goto endCustomProps
if "%~4" == "" goto endCustomProps
set CUSTOM_PROPS=%4
echo Using custom properties file for the build:
echo %CUSTOM_PROPS%
Expand All @@ -18,4 +19,21 @@ set MAXCPUCOUNT=%NUMBER_OF_PROCESSORS%
set platform=
set SOLUTION=Solutions\MSTelemetrySDK.sln

msbuild %SOLUTION% /target:%TARGETS% /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /detailedsummary /p:Configuration=%CONFIGURATION% /p:Platform=%TARGETPLATFORM% %CUSTOM_PROPS%
msbuild %SOLUTION% /target:%TARGETS% /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /detailedsummary /p:Configuration=%CONFIGURATION% /p:Platform=%TARGETPLATFORM% %CUSTOM_PROPS%
exit /b %ERRORLEVEL%

:NormalizeTargets
setlocal ENABLEDELAYEDEXPANSION
set "TARGETS_IN=%~1"
set "NORMALIZED_TARGETS="
for %%T in ("!TARGETS_IN:,=" "!") do (
set "TARGET=%%~T"
if /I "!TARGET:~-6!"==":Build" set "TARGET=!TARGET:~0,-6!"
if defined NORMALIZED_TARGETS (
set "NORMALIZED_TARGETS=!NORMALIZED_TARGETS!,!TARGET!"
) else (
set "NORMALIZED_TARGETS=!TARGET!"
)
)
endlocal & set "TARGETS=%NORMALIZED_TARGETS%"
exit /b 0
4 changes: 2 additions & 2 deletions tools/setup-buildtools.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ if NOT exist "%VSINSTALLER%" (
echo Visual Studio installer:
echo %VSINSTALLER%

REM Install optional components required for ARM build - vs2017-BuildTools
REM Install optional components required for supported Windows build targets.
if exist "%VSINSTALLDIR%" (
echo Running Visual Studio installer..
"%VSINSTALLER%" modify --installPath "%VSINSTALLDIR%" --config "%~dp0\.vsconfig.%VSVERSION%" --force --quiet --norestart
"%VSINSTALLER%" modify --installPath "%VSINSTALLDIR%" --config "%~dp0\.vsconfig.vs%VSVERSION%" --force --quiet --norestart
)

where /Q vcpkg.exe
Expand Down
101 changes: 101 additions & 0 deletions tools/vcvars.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ REM 2. Visual Studio 2017 BuildTools
REM 3. Visual Studio 2019 Enterprise
REM 4. Visual Studio 2019 Community
REM 5. Visual Studio 2019 BuildTools
REM 6. Visual Studio 2022 Enterprise
REM 7. Visual Studio 2022 Professional
REM 8. Visual Studio 2022 Community
REM 9. Visual Studio 2022 BuildTools
REM 10. Visual Studio 2026 Enterprise
REM 11. Visual Studio 2026 Professional
REM 12. Visual Studio 2026 Community
REM 13. Visual Studio 2026 BuildTools
REM

REM 1st parameter - Visual Studio version
Expand Down Expand Up @@ -84,6 +92,16 @@ if exist "%VSDEVCMD%" (
goto tools_configured
)

:vs2022_professional
SET VSVERSION=2022
set "VSDEVCMD=%ProgramFiles%\Microsoft Visual Studio\2022\Professional\Common7\Tools\VsDevCmd.bat"
if exist "%VSDEVCMD%" (
set "VSINSTALLDIR=%ProgramFiles%\Microsoft Visual Studio\2022\Professional"
echo Building with vs2022 Professional...
call "%VSDEVCMD%"
goto tools_configured
)

:vs2022_community
SET VSVERSION=2022
set "VSDEVCMD=%ProgramFiles%\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat"
Expand All @@ -94,6 +112,89 @@ if exist "%VSDEVCMD%" (
goto tools_configured
)

:vs2022_buildtools
SET VSVERSION=2022
set "VSDEVCMD=%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\VsDevCmd.bat"
if exist "%VSDEVCMD%" (
set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools"
echo Building with vs2022 BuildTools...
call "%VSDEVCMD%"
goto tools_configured
)

:vs2026
:vs2026_enterprise
SET VSVERSION=2026
set "VSDEVCMD=%ProgramFiles%\Microsoft Visual Studio\2026\Enterprise\Common7\Tools\VsDevCmd.bat"
if exist "%VSDEVCMD%" (
set "VSINSTALLDIR=%ProgramFiles%\Microsoft Visual Studio\2026\Enterprise"
echo Building with vs2026 Enterprise...
call "%VSDEVCMD%"
goto tools_configured
)

set "VSDEVCMD=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise\Common7\Tools\VsDevCmd.bat"
if exist "%VSDEVCMD%" (
set "VSINSTALLDIR=%ProgramFiles%\Microsoft Visual Studio\18\Enterprise"
echo Building with vs2026 Enterprise...
call "%VSDEVCMD%"
goto tools_configured
)

:vs2026_professional
SET VSVERSION=2026
set "VSDEVCMD=%ProgramFiles%\Microsoft Visual Studio\2026\Professional\Common7\Tools\VsDevCmd.bat"
if exist "%VSDEVCMD%" (
set "VSINSTALLDIR=%ProgramFiles%\Microsoft Visual Studio\2026\Professional"
echo Building with vs2026 Professional...
call "%VSDEVCMD%"
goto tools_configured
)

set "VSDEVCMD=%ProgramFiles%\Microsoft Visual Studio\18\Professional\Common7\Tools\VsDevCmd.bat"
if exist "%VSDEVCMD%" (
set "VSINSTALLDIR=%ProgramFiles%\Microsoft Visual Studio\18\Professional"
echo Building with vs2026 Professional...
call "%VSDEVCMD%"
goto tools_configured
)

:vs2026_community
SET VSVERSION=2026
set "VSDEVCMD=%ProgramFiles%\Microsoft Visual Studio\2026\Community\Common7\Tools\VsDevCmd.bat"
if exist "%VSDEVCMD%" (
set "VSINSTALLDIR=%ProgramFiles%\Microsoft Visual Studio\2026\Community"
echo Building with vs2026 Community...
call "%VSDEVCMD%"
goto tools_configured
)

set "VSDEVCMD=%ProgramFiles%\Microsoft Visual Studio\18\Community\Common7\Tools\VsDevCmd.bat"
if exist "%VSDEVCMD%" (
set "VSINSTALLDIR=%ProgramFiles%\Microsoft Visual Studio\18\Community"
echo Building with vs2026 Community...
call "%VSDEVCMD%"
goto tools_configured
)

:vs2026_buildtools
SET VSVERSION=2026
set "VSDEVCMD=%ProgramFiles(x86)%\Microsoft Visual Studio\2026\BuildTools\Common7\Tools\VsDevCmd.bat"
if exist "%VSDEVCMD%" (
set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2026\BuildTools"
echo Building with vs2026 BuildTools...
call "%VSDEVCMD%"
goto tools_configured
)

set "VSDEVCMD=%ProgramFiles(x86)%\Microsoft Visual Studio\18\BuildTools\Common7\Tools\VsDevCmd.bat"
if exist "%VSDEVCMD%" (
set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\18\BuildTools"
echo Building with vs2026 BuildTools...
call "%VSDEVCMD%"
goto tools_configured
)

echo WARNING:*********************************************
echo WARNING: cannot auto-detect Visual Studio version !!!
echo WARNING:*********************************************
Expand Down
Loading