Search code examples
visual-studiomsbuildnant

OutputPath is set to be bin\x86\release, but shown as obj\x86\release when using MSBuild


In my .csproj file (C# project file) OutputPath is set as in the following:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
  <DefineTrace>true</DefineTrace>
  <OutputPath>bin\x86\Release\</OutputPath>
  ....
</PropertyGroup>

In my NAnt script, I have this:

<msbuild project="${demo.solution}">
  <property name="Configuration" value="release"/>

  <property name="OutputPath" value="${output.dir}"/>
  <property name="Platform" value="x86"/>
</msbuild>

Why is the log showing that the DemoProject.dll is copied from obj\x86\release?

....

[msbuild] Project "Demo.sln" (1) is building "DemoProjec1.vbproj" (3) on node 0 (default targets).

[msbuild] Copying file from "obj\x86\Release\DemoProjec1.dll" to ${output.dir}\DemoProjec1.dll".

[msbuild] DemoProjec1 -> ${output.dir}\DemoProjec1.dll

[msbuild] Done Building Project "DemoProjec1.vbproj" (default targets).

....

Somehow the DemoProject.dll from obj is different in size compared to DemoProject.dll from bin.


Solution

  • obj\x86\release is the IntermediateOutputPath for the release configuration.

    Your project is compiled in the intermediate directory and then the result file is copied to your output directory. In your NAnt file you override the OutputPath to ${output.dir}, so your file is copied from obj\x86\release to ${output.dir}.