I'm trying to build a very simple C program using MSBuild. Previously this was put together by an intern using Visual Studio but we are not going to be using VS here and I want this built with MSBuild so I can automate it.
I have constructed my vcxproj file from scratch following the walkthrough on MSDN and the other reference docs there. I am able to compile the obj files no problem but the Link step never seems to run so I am not getting an executable output.
There is a function called main in AppDrv.c files, is it safe to assume that will be detected by the linker as the entry point, or do I need to tell msbuild manually some how that this is there?
Here is the entirety of my vcxproj. I can't find anything in the docs that says I need to tell it to link, shouldn't it happen automatically if the CL step completes OK? Do I need to somehow explicitly list the obj files to link, or can MSBuild figure that out on its own?
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.default.props" />
<PropertyGroup>
<ConfigurationType>Console</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<!--Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /-->
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(UniversalCRT_IncludePath)$(ProjectDir)helper\include;$(WindowsSDK_IncludePath)$(VC_IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<CompileAs>CompileAsC</CompileAs>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OutputFile>slip_windows_helper.exe</OutputFile>
<ShowProgress>LinkVerbose</ShowProgress>
</Link>
</ItemDefinitionGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(UniversalCRT_IncludePath)$(ProjectDir)helper\include;$(WindowsSDK_IncludePath)$(VC_IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<CompileAs>CompileAsC</CompileAs>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="$(ProjectDir)helper\src\AppDrv.c" />
<ClCompile Include="$(ProjectDir)helper\src\Buffers.c" />
<ClCompile Include="$(ProjectDir)helper\src\SingleThreadAsync.c" />
<ClCompile Include="$(ProjectDir)helper\src\Slip.c" />
<ClCompile Include="$(ProjectDir)helper\src\Utils.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(ProjectDir)helper\include\AppDrv.h" />
<ClInclude Include="$(ProjectDir)helper\include\Buffers.h" />
<ClInclude Include="$(ProjectDir)helper\include\SingleThreadAsync.h" />
<ClInclude Include="$(ProjectDir)helper\include\Slip.h" />
<ClInclude Include="$(ProjectDir)helper\include\Utils.h" />
<ClInclude Include="$(ProjectDir)helper\include\SharedHeader.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Targets" />
<Target Name="Info">
<Message Text="Target to output MSBuild information" />
<Message Text="OutputAssembly: $(OutputAssembly)" />
<Message Text="VCTargetsPath: $(VCTargetsPath)" />
<Message Text="Includes: $(IncludePath)" />
<Message Text="VC_IncludePath:$(VC_IncludePath)" />
<Message Text="WindowsSDK_IncludePath:$(WindowsSDK_IncludePath)" />
<Message Text="the property config is: $(Configuration)" />
<Message Text="final output directory: $(OutDir)" />
</Target>
</Project>
Here is the command I'm using to launch the build:
MSBuild.exe slipwinhelper.vcxproj /p:configuration=Debug /p:platform=Win32 /p:OutDir=target\ /nologo /t:Clean;Build;Info
UPDATE:
I got it to run the link task by overriding the AfterBuild event:
<Target Name="AfterBuild">
<Link Sources="Debug\AppDrv.obj;Debug\Buffers.obj;Debug\SingleThreadAsync.obj;Debug\Slip.obj;Debug\Utils.obj" />
</Target>
But now it is giving me unresolved externals on SetupApi calls in the code. I have tried changing the SubSystem to Windows, that doesn't seem to work.
A quick comparision with a VS generated files shows a bunch of differences/lacking properties, including the file from VS having
<ConfigurationType>Application</ConfigurationType>
whereas you are speciyfing Console which is not something msbuild recognizes.
Related
I have a basic MSBuild project in c++ for Linux. I was able to compile and debug it without any problems until I re-installed Debian on the server. I have since installed g++, GCC, gdb, gdbserver, make, rsync, and zip.
Visual-Studio compiles the project remotely without any problems, but when it tries to start it, I get the following prompt.
I tried using different versions of Visual-Studio, like prev2022 and 2019, and installing Linux on a completely different machine in my network.
Here is the content of the .vcxproj file:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x86">
<Configuration>Debug</Configuration>
<Platform>x86</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x86">
<Configuration>Release</Configuration>
<Platform>x86</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{63047eae-971e-48d1-b78a-91ea7faeda86}</ProjectGuid>
<Keyword>Linux</Keyword>
<RootNamespace>xy</RootNamespace>
<MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion>
<ApplicationType>Linux</ApplicationType>
<ApplicationTypeRevision>1.0</ApplicationTypeRevision>
<TargetLinuxPlatform>Generic</TargetLinuxPlatform>
<LinuxProjectType>{D51BCBC9-82E9-4017-911E-C93873C4EA2B}</LinuxProjectType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
<UseOfStl>libstdc++_shared</UseOfStl>
<RemoteRootDir>~/debug</RemoteRootDir>
<PlatformToolset>Remote_GCC_1_0</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Label="Shared" />
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<RemoteCopySourceMethod>rsync</RemoteCopySourceMethod>
<RemoteCCompileToolExe>g++</RemoteCCompileToolExe>
<RemoteCppCompileToolExe>g++</RemoteCppCompileToolExe>
<ValidateArchitecture>true</ValidateArchitecture>
<MultiProcNumber>4</MultiProcNumber>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="AuthorizationManager.cpp" />
<ClCompile Include="Cookie.cpp" />
<ClCompile Include="CreateDirectoryModule.cpp" />
<ClCompile Include="DeleteDirectoryModule.cpp" />
<ClCompile Include="Directory.cpp" />
<ClCompile Include="FileHelper.cpp" />
<ClCompile Include="FileSystemManager.cpp" />
<ClCompile Include="FileUploadManager.cpp" />
<ClCompile Include="FinishModule.cpp" />
<ClCompile Include="HttpRequest.cpp" />
<ClCompile Include="HttpRequestCreator.cpp" />
<ClCompile Include="HttpResponse.cpp" />
<ClCompile Include="HttpServer.cpp" />
<ClCompile Include="LoginModule.cpp" />
<ClCompile Include="LogoffModule.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="MoveDirectoryModule.cpp" />
<ClCompile Include="NavModule.cpp" />
<ClCompile Include="ParentModule.cpp" />
<ClCompile Include="PathHelper.cpp" />
<ClCompile Include="PauseModule.cpp" />
<ClCompile Include="RefreshModule.cpp" />
<ClCompile Include="RenameDirectoryModule.cpp" />
<ClCompile Include="ResumeModule.cpp" />
<ClCompile Include="SocketListener.cpp" />
<ClCompile Include="StartModule.cpp" />
<ClCompile Include="StopModule.cpp" />
<ClCompile Include="StringCompairer.cpp" />
<ClCompile Include="StringConverter.cpp" />
<ClCompile Include="Timer.cpp" />
<ClCompile Include="UserManager.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="AuthorizationManager.h" />
<ClInclude Include="byte.h" />
<ClInclude Include="byteSection.h" />
<ClInclude Include="Cookie.h" />
<ClInclude Include="CreateDirectoryModule.h" />
<ClInclude Include="DeleteDirectoryModule.h" />
<ClInclude Include="Directory.h" />
<ClInclude Include="FileHelper.h" />
<ClInclude Include="FileInfo.h" />
<ClInclude Include="FileSystemManager.h" />
<ClInclude Include="FileUploadManager.h" />
<ClInclude Include="FinishModule.h" />
<ClInclude Include="HttpMethod.h" />
<ClInclude Include="HttpModule.h" />
<ClInclude Include="HttpRequest.h" />
<ClInclude Include="HttpRequestCreator.h" />
<ClInclude Include="HttpRequestHandler.h" />
<ClInclude Include="HttpResponse.h" />
<ClInclude Include="HttpServer.h" />
<ClInclude Include="LoginModule.h" />
<ClInclude Include="loginResult.h" />
<ClInclude Include="LogoffModule.h" />
<ClInclude Include="MoveDirectoryModule.h" />
<ClInclude Include="NavModule.h" />
<ClInclude Include="ParentModule.h" />
<ClInclude Include="PathHelper.h" />
<ClInclude Include="PauseModule.h" />
<ClInclude Include="RefreshModule.h" />
<ClInclude Include="RenameDirectoryModule.h" />
<ClInclude Include="RequestHandler.h" />
<ClInclude Include="ResumeModule.h" />
<ClInclude Include="serverSettings.h" />
<ClInclude Include="SocketListener.h" />
<ClInclude Include="SortedVectorHelper.h" />
<ClInclude Include="StartModule.h" />
<ClInclude Include="StopModule.h" />
<ClInclude Include="StringCompairer.h" />
<ClInclude Include="StringConverter.h" />
<ClInclude Include="Timer.h" />
<ClInclude Include="uid.h" />
<ClInclude Include="UploadFile.h" />
<ClInclude Include="User.h" />
<ClInclude Include="UserCredentials.h" />
<ClInclude Include="UserManager.h" />
</ItemGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Link>
<OptimizeforMemory>false</OptimizeforMemory>
<AdditionalOptions>-pthread %(AdditionalOptions)</AdditionalOptions>
</Link>
<ClCompile>
<CppLanguageStandard>c++17</CppLanguageStandard>
<CLanguageStandard>c11</CLanguageStandard>
<AdditionalOptions>
</AdditionalOptions>
<PreprocessorDefinitions>
</PreprocessorDefinitions>
</ClCompile>
<PostBuildEvent>
<Message>xy</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Link>
<AdditionalOptions>-pthread %(AdditionalOptions)</AdditionalOptions>
</Link>
<ClCompile>
<UnrollLoops>true</UnrollLoops>
</ClCompile>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>
...and of the .vcxproj.user file:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DebuggerFlavor>LinuxDebugger</DebuggerFlavor>
<RemoteDebuggerWorkingDirectory>{the-path}</RemoteDebuggerWorkingDirectory>
<RemoteDebuggingTarget>{my-ip}(username={my-user-name}, port=22, authentication=None)</RemoteDebuggingTarget>
<RemoteGDBPath>
</RemoteGDBPath>
</PropertyGroup>
</Project>
I have been facing this issue since long, I am trying to build a project in VS 2019 which has previously built fine in vs 2013. I am facing this error which has no definition anywhere on Microsoft forums.
I have tried doing all the retargeting with the 2019 toolset as well as changing the toolset version to current in the project configuration file with no success at all.
I am not sure why even microsoft forums doesnot have any explanation for this error code (error MSB8052)
Also, the project still shows visual studio 2013 written in brackets in front of the project name. I have changed all the toolset to use the 2019 version but this is not changing.
The error is as follows : error MSB8052: MSVC Toolset Version '14.28.29333' is not compatible with 'v120' Platform Toolset. Please either change Platform Toolset to v142 or MSVC Toolset Version (VCToolsVersion property) to the version with the format '12.0*.*'. To use default MSVC Toolset Version for a given Platform Toolset don't set VCToolsVersion property.
I don't know somehow, it is still using the old platform toolset. Can somebody help me with this ?
enter code here
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Matrix">
<MatrixProjectDir>..\..\..</MatrixProjectDir>
</PropertyGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{173A4A3E-C861-4013-9366-08716BF7BCCD}</ProjectGuid>
<RootNamespace>LogicNpcUnmanagedSupport</RootNamespace>
<SccProjectName>SAK</SccProjectName>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
<SccProvider>SAK</SccProvider>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseOfMfc>Dynamic</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseOfMfc>Dynamic</UseOfMfc>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\Build\PropertySheets\MatrixReleaseSettings.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\Build\PropertySheets\MatrixDebugSettings.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..\Include;$(ProjectDir)\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_COMPILING_NPC_LIB_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Lib>
<OutputFile>$(OutDir)ag$(ProjectName).lib</OutputFile>
<TargetMachine>MachineX64</TargetMachine>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..\Include;$(ProjectDir)\..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_COMPILING_NPC_LIB_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Lib>
<OutputFile>$(Configuration)\ag$(ProjectName).lib</OutputFile>
<TargetMachine>MachineX64</TargetMachine>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="agGuid.cpp" />
<ClCompile Include="agLogicNpcBuffer.cpp" />
<ClCompile Include="agLogicNpcCallForwarder.cpp" />
<ClCompile Include="agLogicNpcClient.cpp" />
<ClCompile Include="agLogicNpcDispatcher.cpp" />
<ClCompile Include="agLogicNpcException.cpp" />
<ClCompile Include="agLogicNpcHeader.cpp" />
<ClCompile Include="agLogicNpcServer.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="agArrayWrapper.h" />
<ClInclude Include="agArrayWrapperComposite.h" />
<ClInclude Include="agArrayWrapperPrimitive.h" />
<ClInclude Include="agGuid.h" />
<ClInclude Include="agLogicNpcBuffer.h" />
<ClInclude Include="agLogicNpcCallForwarder.h" />
<ClInclude Include="agLogicNpcClient.h" />
<ClInclude Include="agLogicNpcContentFlags.h" />
<ClInclude Include="agLogicNpcDispatcher.h" />
<ClInclude Include="agLogicNpcException.h" />
<ClInclude Include="agLogicNpcHeader.h" />
<ClInclude Include="agLogicNpcServer.h" />
<ClInclude Include="agLogicNpcServerInfo.h" />
<ClInclude Include="agLogicNpcTransport.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
enter code here - MatrixDebugSettings.props
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets">
<Import Project="MatrixBaseSettings.props" />
<Import Project="MatrixMultiProcessorOptionSetting.props" />
<Import Project="MatrixDebugBaseSettings.props" />
</ImportGroup>
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
</PropertyGroup>
</Project>
enter code here - Microsoft.Cpp.x64.user.props
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets">
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup />
<ItemGroup />
</Project>
You can directly open vcxproj file, then confirm and modify Platform Toolset to V142
If it doesn't work, you could try to delete .vs folder which is next to your sln file.
My C++ Win32/64 app does not recognize the manifest file. I keep receiving "Hello World!" and not "Hello World from Windows 10!"
I did research but I appear to be doing everything.
Linker Manifest Properties
Linker Manifest Tool Properties
Output
Solution Explorer
Source
int main()
{
if (IsWindows10OrGreater())
{
std::cout << "Hello World from Windows 10!\n";
int diskOs = GetOsDisk();
EnumerateVolumes(diskOs);
}
else
std::cout << "Hello World!\n";
}
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MidLevelConsole.exe"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Specifying requestedExecutionLevel element will disable file and registry virtualization.
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on
and is designed to work with. Uncomment the appropriate elements
and Windows will automatically select the most compatible environment. -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
-->
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>
Opening Up Exe in VS:
Opening Exe as a Project/Solution in VS:
Notes:
The GetVersionInfoEx API is deprecated. Windows based applications are advised to use the IsWindows* functions, but that requires a manifest file. Even if it did not, which it does, I still would like to know what I am doing wrong.
I use Visual Studio 2017 Enterprise
My OS: Windows 10 Pro 1809 with all updates
EXE Link:
EXE Download
A few of the links that I looked at using SO and Google.
1
2
3
4
Thoughts? No matter what I try, I get IsWindows10OrGreater() to always return false, signaling that there is no manifest file or an issue with it.
Required Settings From Default:
Configuration Properties > Linker > Manifest File
Generate Manifest: Yes (/MANIFEST)
Configuration Properties > Manifest Tool > Input and Output
Additional Manifest Files: $(ProjectDir)$(TargetName)$(TargetExt).manifest
Output Manifest File: $(TargetName).manifest
My Problem After Setting the Required Settings:
The problem was the empty <ManifestFile /> node within the <ItemDefintionGroup...> node.
Good Project File Fragment 1:
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Manifest>
<AdditionalManifestFiles>manifest.xml</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
Bad Project File Fragment 1:
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ManifestFile>
</ManifestFile>
</Link>
<Manifest>
<AdditionalManifestFiles>$(ProjectDir)$(TargetName)$(TargetExt).manifest</AdditionalManifestFiles>
<OutputManifestFile>$(TargetName).manifest</OutputManifestFile>
</Manifest>
</ItemDefinitionGroup>
The meaningful line, which my tinkering with the settings created inadvertently was:
<ManifestFile>
</ManifestFile>
That is inside the <Link> ... </Link> node. Deleting the Manifest File node resolved the problem. I had to do that for each configuration and platform.
Good Project File Fragment 2:
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
<OutDir>$(ProjectDir)bin\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(ProjectDir)obj\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
Bad Project File Fragment 2:
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
<OutDir>$(ProjectDir)bin\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(ProjectDir)obj\$(Platform)\$(Configuration)\</IntDir>
<EmbedManifest />
</PropertyGroup>
Like before, I had to remove the empty manfest section, namely <EmbedManifest /> from each of the Property Group platform/configuration sections.
I added and then removed items from these property groups. Visually, the change was nothing, adding and then removing, however Visual Studio 2017 leaves the sections as an empty group, which prevents the manifest from loading.
Here is the complete working project file:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.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="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{64BA277A-6ED7-445D-B807-A7DD6B8FE458}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>VersionHelpersTest</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
<OutDir>$(ProjectDir)bin\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(ProjectDir)obj\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
<OutDir>$(ProjectDir)bin\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(ProjectDir)obj\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<GenerateManifest>true</GenerateManifest>
<OutDir>$(ProjectDir)bin\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(ProjectDir)obj\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(ProjectDir)bin\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(ProjectDir)obj\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Manifest>
<AdditionalManifestFiles>$(ProjectDir)$(TargetName)$(TargetExt).manifest</AdditionalManifestFiles>
<OutputManifestFile>$(TargetName).manifest</OutputManifestFile>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Manifest>
<AdditionalManifestFiles>$(ProjectDir)$(TargetName)$(TargetExt).manifest</AdditionalManifestFiles>
<OutputManifestFile>$(TargetName).manifest</OutputManifestFile>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Manifest>
<AdditionalManifestFiles>$(ProjectDir)$(TargetName)$(TargetExt).manifest</AdditionalManifestFiles>
<OutputManifestFile>$(TargetName).manifest</OutputManifestFile>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Manifest>
<AdditionalManifestFiles>$(ProjectDir)$(TargetName)$(TargetExt).manifest</AdditionalManifestFiles>
<OutputManifestFile>$(TargetName).manifest</OutputManifestFile>
</Manifest>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="VersionHelpersTest.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
That to me is a HUGE bug in Visual Studio, and totally not obvious. Another bug is that by VS2019, manifests inside a C++ app should be as easy as it is with a C# application and come automatically.
Simpler solution:
inline bool isWindows11OrGreater()
{
NTSTATUS (NTAPI * RtlGetVersion)(PRTL_OSVERSIONINFOW lpVersionInformation) = nullptr;
HMODULE ntdll = GetModuleHandle(L"ntdll.dll");
if (ntdll == NULL)
return false;
*reinterpret_cast<FARPROC*>(&RtlGetVersion) = GetProcAddress(ntdll, "RtlGetVersion");
if (RtlGetVersion == nullptr)
return false;
OSVERSIONINFOEX versionInfo{ sizeof(OSVERSIONINFOEX) };
if (RtlGetVersion(reinterpret_cast<LPOSVERSIONINFO>(&versionInfo)) < 0)
return false;
if (versionInfo.dwMajorVersion > HIBYTE(_WIN32_WINNT_WIN10))
return true;
if (versionInfo.dwMajorVersion == HIBYTE(_WIN32_WINNT_WIN10))
{
if (versionInfo.dwMinorVersion > LOBYTE(_WIN32_WINNT_WIN10))
return true;
if (versionInfo.dwMinorVersion == LOBYTE(_WIN32_WINNT_WIN10) && versionInfo.dwBuildNumber >= 22000)
return true;
}
return false;
}
I am upgrading some big solution files (80 projects) from Visual Studio 2010 to Visual Studio 2017. I allowed VS to upgrade the solution and project files (they are all VC++ projects).
If you go to the "Linker" settings for the project, they are all set to generate an intermediate manifest.
I am running VS2017 as Administrator, and for each of the projects I try to build, I get an error similar to:
LINK : fatal error LNK1104: cannot open file 'D:...\intel_win32_Debug\bundle_creator\bundle_creator.exe.intermediate.manifest'
This works fine building the projects in VS2010. In VS 2010, the intermediate manifest is produced and feeds the manifest tool, and the projects build. The output directory exists and has intermediate .obj files, as well as a .pdb file. I also checked the directory privileges and ownership, and they appear to be in order.
This error happens for both debug/release builds.
Does anyone know why this would work in 2010 but not in 2017?
EDIT: There is NO content in the linker trace log files. (Whereas plenty when done in VS2017). Here is a sample project file.
EDIT 2: One huge difference I see is that in the VS2010 case I see trace logs for the mt.ext manifest tool, whereas in 2017 I don't. So it appears like the manifest tool isn't running for some reason. The manifest settings haven't changed - is there some setting in VS2017 for running the manifest tool before the linker?
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.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="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Template|Win32">
<Configuration>Template</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{FAA8F144-2DE8-4397-B694-FDA2BF43E610}</ProjectGuid>
<RootNamespace>bundle_creator</RootNamespace>
<SccProjectName>
</SccProjectName>
<SccAuxPath>
</SccAuxPath>
<SccLocalPath>
</SccLocalPath>
<SccProvider>
</SccProvider>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">
<PlatformToolset>v141</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\..\build\properties\release.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\..\build\properties\debug.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(CORE_LIBRARIES_DIR)\3rdParty\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>CONSOLE_MODE;OMIT_CRYPTO_SUPPORT=t;OMIT_SYSTEM_VALUES=t;_CONSOLE;__BUILD_STATIC_APPLICATION__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>CONSOLE_MODE;OMIT_CRYPTO_SUPPORT=t;OMIT_SYSTEM_VALUES=t;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(CORE_LIBRARIES_DIR)\3rdparty\zlib\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(CORE_LIBRARIES_DIR)\3rdparty\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>CONSOLE_MODE;OMIT_CRYPTO_SUPPORT=t;OMIT_SYSTEM_VALUES=t;_CONSOLE;__BUILD_STATIC_APPLICATION__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>CONSOLE_MODE;OMIT_CRYPTO_SUPPORT=t;OMIT_SYSTEM_VALUES=t;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(CORE_LIBRARIES_DIR)\3rdparty\zlib\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="bundle_creator.cpp" />
<ClCompile Include="common_bundle.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="bundler_version.rc" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\libraries\core\library\basis\basis.vcxproj">
<Project>{571b0731-ed86-476a-a723-9ecf75cb0d51}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\build_prerequisites.csproj">
<Project>{28ba1c03-7e39-4ce2-993f-72a7772fa758}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties RESOURCE_FILE="bundler_version.rc" />
</VisualStudio>
</ProjectExtensions>
</Project>
And here is the debug property sheet
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="UserMacros">
<REPOSITORY_DIR Condition="'$(REPOSITORY_DIR)'==''">$(SolutionDir)</REPOSITORY_DIR>
<BUILDER_DIR>$(REPOSITORY_DIR)\..\..\build\</BUILDER_DIR>
<BUILD_TOP>$(REPOSITORY_DIR)\..\..\</BUILD_TOP>
<LIBRARIES_DIR>$(REPOSITORY_DIR)\..\..\libraries\</LIBRARIES_DIR>
<CORE_LIBRARIES_DIR>$(REPOSITORY_DIR)\..\..\libraries\core\</CORE_LIBRARIES_DIR>
<SHARED_LIBRARIES_DIR>$(REPOSITORY_DIR)\..\..\libraries\shared\</SHARED_LIBRARIES_DIR>
</PropertyGroup>
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir>$(REPOSITORY_DIR)\binaries\</OutDir>
</PropertyGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(BUILDER_DIR)\properties\vcoptions.props" />
</ImportGroup>
<ItemDefinitionGroup>
<Midl>
<PreprocessorDefinitions>DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PreprocessorDefinitions>_DEBUG;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<StringPooling>false</StringPooling>
<FunctionLevelLinking>false</FunctionLevelLinking>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Manifest>
<AdditionalManifestFiles>$(IntDir)$(TargetFileName).intermediate.manifest;$(BUILDER_DIR)\properties\security_manifest.txt;%(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
<Link>
<AdditionalLibraryDirectories>$(REPOSITORY_DIR)\binaries;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ProgramDatabaseFile>$(REPOSITORY_DIR)\binaries\$(TargetName).pdb</ProgramDatabaseFile>
<ImportLibrary>$(REPOSITORY_DIR)\binaries\$(ProjectName).lib</ImportLibrary>
<AdditionalDependencies>msvcrtd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>msvcrt.lib;mfc.lib</IgnoreSpecificDefaultLibraries>
</Link>
</ItemDefinitionGroup>
</Project>
We recently added GameSparks to our C++ project, which (so far as we were able to ascertain) required us to switch from VS2010 to VS2015.
Apart from the platform toolset and the path to msbuild.exe, nothing else in the project was modified.
Debug build times immediately climbed from 60 seconds to over 100 seconds.
As a test, we removed GameSparks again but left the platform as 2015. This reduced the build time by around 2 seconds. Switching back to VS2010 immediately reduced build times back down to 60 seconds again.
The project itself is extremely simple, comprising a single large .cpp file generated by a third-party multi-platform language, and a single .h file which includes the following:
#include <ctime>
#include <cmath>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <typeinfo>
#include <signal.h>
#include <cstdint>
#include <cfloat>
#include <windows.h>
#include <shlobj.h>
#include <direct.h>
#include <sys/stat.h>
#undef LoadString
//OpenAL...
//
#include <al.h>
#include <alc.h>
#include <stb_image.h>
#define STB_VORBIS_HEADER_ONLY
#include <stb_vorbis.c>
The nature of the project means we are building quite frequently, and those forty extra seconds per build really start to add up across the team.
See below for a transcript of the (VS2010) project file. Can anyone see any settings that could account for such a large increase in build time? Thanks.
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.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="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{692B78A5-C3E9-4843-A55A-5E94A35BDFB4}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>MonkeyGame</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v100</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v100</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>false</LinkIncremental>
<IntDir>$(SolutionDir)build\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>../lib;../lib/win32;../include;$(IncludePath)</IncludePath>
<IntDir>$(SolutionDir)build\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../stb;../openal/include;../glfw3/include;../glfw3/src;../freetype/include;../freetype/include/freetype2;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<FunctionLevelLinking>false</FunctionLevelLinking>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ExceptionHandling>Async</ExceptionHandling>
<MinimalRebuild>true</MinimalRebuild>
<IntrinsicFunctions>false</IntrinsicFunctions>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>opengl32.lib;glu32.lib;openal32.lib;Ws2_32.lib;freetype.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>../openal/libs/Win32;../freetype/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>TurnOffAllWarnings</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>false</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../stb;../openal/include;../glfw3/include;../glfw3/src;../freetype/include;../freetype/include/freetype2;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<ExceptionHandling>Async</ExceptionHandling>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>opengl32.lib;glu32.lib;openal32.lib;Ws2_32.lib;freetype.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>../openal/libs/Win32;../freetype/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\glfw3\src\context.c" />
<ClCompile Include="..\glfw3\src\init.c" />
<ClCompile Include="..\glfw3\src\input.c" />
<ClCompile Include="..\glfw3\src\monitor.c" />
<ClCompile Include="..\glfw3\src\wgl_context.c" />
<ClCompile Include="..\glfw3\src\win32_init.c" />
<ClCompile Include="..\glfw3\src\win32_monitor.c" />
<ClCompile Include="..\glfw3\src\win32_time.c" />
<ClCompile Include="..\glfw3\src\win32_tls.c" />
<ClCompile Include="..\glfw3\src\win32_window.c" />
<ClCompile Include="..\glfw3\src\window.c" />
<ClCompile Include="..\glfw3\src\winmm_joystick.c" />
<ClCompile Include="..\main.cpp" />
<ClCompile Include="..\stb\stb_image.c" />
<ClCompile Include="..\stb\stb_vorbis.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\main.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>