I'm trying to build a solution that contains about 20 projects; I want to build both 32-bit and 64-bit binaries. I've configured all my projects to use paths like this:
- <OutputPath>bin\$(Configuration)-$(Platform)\</OutputPath>
and I've set the platform to "x64" via "Build" -> "Set platform".
I expect the "x64" debug build to use DLLs from referenced projects in those projects' "Debug-x64" folder.
In some cases, however, the "x64" build will try to use DLLs from referenced projects in those projects' "Debug-x86" folder.
Note that if I use MSBuild to build the solution instead of SharpDevelop, I don't experience this problem.
Here's an example output message:
- Compiling MyCompany.TransferFormat.Converter
- Error CS0006: Metadata file 'C:\Development\wc\64-bit-c\gbx\MyCompany.TransferFormat\bin\Debug-x86\MyCompany.TransferFormat.dll' could not be found
Here's a excerpt from MyCompany.TransferFormat.csproj:
- <?xml version="1.0" encoding="utf-8"?>
- <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
- ...
- <OutputPath>bin\$(Configuration)-$(Platform)\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Platform)' == 'x86' ">
- ...
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Platform)' == 'x64' ">
- ...
- </PropertyGroup>
- <PropertyGroup>
- </Project>
If I change the highlighted line from:
- <Platform Condition=" '$(Platform)' == ''">x86</Platform>
to:
- <Platform Condition=" '$(Platform)' == ''">oink</Platform>
Then the error message becomes:
- Compiling MyCompany.TransferFormat.Converter
- Error CS0006: Metadata file 'C:\Development\wc\64-bit-c\gbx\MyCompany.TransferFormat\bin\Debug-oink\MyCompany.TransferFormat.dll' could not be found
This seems to indicate that SharpDevelop is using the default platform specified in the top of the referenced csproj file instead of the platform specified in "Build" -> "Set platform", when looking for the output of the referenced project.
Even with that change to the project file, though, MSBuild builds the solution without any issues (as long as I build with "/p:Platform=x64" on the command line, of course).
My current work-around is to change the base Platform property in the first PropertyGroup of affected target project files to "x64".
I've tried to create a trivial project to replicate the problem, but I haven't been able to. Also, not all csproj files appear to be affected by this problem; I haven't been able to determine what set of circumstances causes this, only that I can work around it by changing the default platform from "x86" to "x64" in affected csproj files.
(I'm using the SharpDevelop release candidate posted about a week ago.)