I'm new to MSVS and there's a requirement appeared to write one executable program and one DLL. I've got MSVS 2013 project with vcxproj file for DLL that I'm trying to build with msbuild.
When running build from MSVS it creates folder like ${ROOT_PROJECT_FOLDER}/${PROJECT_NAME}/Release
where build logs are being stored. And also it creates DLL itself with exp,lib and pdb files. They are situated in ${ROOT_PROJECT_FOLDER}/Release
.
But, when I'm trying to run
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe cryptoApiLib\cryptoApiLib.vcxproj /t:Build /p:PreferredToolArchitecture=x86 /p:Platform=Win32 /p:PlatformToolset=v120_xp /p:Configuration=Release /p:TargetFrameworkVersion=v3.5
from the root project folder, DLL falls into ${ROOT_PROJECT_FOLDER}/${PROJECT_NAME}/Release
. I need it to be created in ${ROOT_PROJECT_FOLDER}/Release
. Have no idea though what exactly am I doing wrong.
Here is a part of vcxproj file:
...
<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>{ECFFC1B0-5155-41C7-8C03-DD94EB590E3A}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>cryptoApiLib</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</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>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
...
And that is how I run msbuild with vcxproj:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe cryptoApiLib\cryptoApiLib.vcxproj /t:Build /p:PreferredToolArchitecture=x86 /p:Platform=Win32 /p:PlatformToolset=v120_xp /p:Configuration=Release /p:TargetFrameworkVersion=v3.5
Any suggestions please?
Have no idea why
/p:OutDir
parameter didn't work for me on first attempt. Walked through project properties and came up with idea to pass it as msbuild param. And finally got it working. Now my build batch file looks like this:Hopefully will help somebody else. Thanks.