How can I configure MSBuild to name Project.dll instead of od Project.vcxproj.dll in TeamCity?

I am having a problem while using the TeamCity build mechanism. I need to build a lot of vcxprojects, some of them are LIBs or DLLs and the rest are EXEs using the previously built LIBs.

An example of installing one LIB project in TeamCity:

    <runner id="RUNNER_15" name="MP3" type="MSBuild">
        <param name="build-file-path" value="Audio\mp3\mp3.vcxproj" />
        <param name="dotNetCoverage.NCover.HTMLReport.File.Sort" value="0" />
        <param name="dotNetCoverage.NCover.HTMLReport.File.Type" value="1" />
        <param name="dotNetCoverage.NCover.Reg" value="selected" />
        <param name="dotNetCoverage.NCover.platformBitness" value="x86" />
        <param name="dotNetCoverage.NCover.platformVersion" value="v2.0" />
        <param name="dotNetCoverage.NCover3.Reg" value="selected" />
        <param name="dotNetCoverage.NCover3.args" value="//ias .*" />
        <param name="dotNetCoverage.NCover3.platformBitness" value="x86" />
        <param name="dotNetCoverage.NCover3.platformVersion" value="v2.0" />
        <param name="dotNetCoverage.NCover3.reporter.executable.args" value="//or FullCoverageReport:Html:{}" />
        <param name="dotNetCoverage.PartCover.Reg" value="selected" />
        <param name="dotNetCoverage.PartCover.includes" value="[*]*" />
        <param name="dotNetCoverage.PartCover.platformBitness" value="x86" />
        <param name="dotNetCoverage.PartCover.platformVersion" value="v2.0" />
        <param name="msbuild_version" value="4.0" />
        <param name="run-platform" value="x86" />
        <param name="toolsVersion" value="4.0" />


In the case of a DLL, the linker setting in the vcxproj file reads:. \ Release \ $ (ProjectName) .dll In the case of LIB, there is no such installation at all.

When I build it using the VS2010 command line the output is . \ Release \ mp3.dll or . \ Release \ mp3.lib .

But when I use TC I get the output . \ Release \ mp3.vcxproj.dll or . \ Release \ mp3.vcxproj.lib

Why? How can I avoid this strange behavior? (I don't want to replace the line in the vcxproj file, e.g. \ Release \ mp3.dll, this is a problem with many projects and I would like to avoid this primitive solution, and in the case of LIB projects, this possibility does not exist at all)

thanks for any answer.


source to share

2 answers

I had the same problem with .vcxproj showing up in the filename of my binaries. I narrowed it down to the $ (ProjectName) variable, which is different when building with TeamCity than when I built it on my own machine.

The solution for me was to define a ProjectName variable in each of the affected project files (oddly enough, this did not happen in some types of projects, like static libraries).

<!-- Define project name to avoid TeamCity from generating incorrect one -->


I put this below the <PropertyGroup Label = "UserMacros" /> line and above the <TargetName> definitions that reference it.

I still don't understand why TeamCity is different ... I hope this helps others with the same problem.



Here's a workaround for this problem that doesn't require changing anything in the project files. Before any build of the project is called, a script will be executed that would rename all .vcxproj

files of interest to files of the same name but no extension .vcxproj

. This is the "Command Line" runner and the script is

for /r directory\with_projects %%%%f in (*.vcxproj) do rename %%%%f %%%%~nf


Then the Visual Studio runner has the renamed project files as arguments. Internally, the runner makes a copy with an extension .teamcity

, which in turn is truncated by Visual Studio, giving the correct value $(ProjectName)




All Articles