I run the following to build my solution (all projects in C#):
MSBuild.exe foo.sln /t:Build /p:Configuration=Release /p:Platform="Any CPU"
It builds it in Debug configuration. If i remove the reference to "Any CPU"
MSBuild.exe foo.sln /t:Build /p:Configuration=Release
the build is built in Release configuration.
Why is that? Am I missing something simple here?
In debug configuration, your program compiles with full symbolic debug information and no optimization. Optimization complicates debugging, because the relationship between source code and generated instructions is more complex.
If you select one of the platforms included with Visual Studio, the properties for your project are modified to build your project for the selected platform. On the menu bar, choose Build > Configuration Manager.
In the Type or select the new platform list, choose x64. If you give your configuration a new name, you may have to modify the settings in the Project Designer to target the correct platform. If you want to copy the settings from a current platform configuration, choose it, and then choose the OK button.
To configure a project to target a 64-bit platform On the menu bar, choose Build > Configuration Manager. In the Active solution platform list, choose a 64-bit platform for the solution to target, and then choose the Close button. If the platform that you want doesn't appear in the Active solution platform list, choose New.
Adding /p:Platform=“Any CPU” parameter forces the build in Debug configuration
The output directory of the project is related to the property of OutputPath
in the PropertyGroup
in the project file foo.csproj
.
According to your description, you may not have configured the target platform and OutputPath
correctly in your project file, for example:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
If we give the <OutputPath>bin\Debug\</OutputPath>
for the Release configuration, then we will get the output in the Debug folder.
So, to resolve this issue, you need to check the property OutputPath
in the project file, make sure it match the target platform.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With