Reputation: 3253
I'm attempting to have a TFS 2012 build definition that contains both solution files and project files.
When the build runs, the solutions don't get build. Instead, I get warnings like:
F:\Source\1\MyCode\src\MySolution.sln.metaproj: The specified solution configuration "Release|AnyCPU" is invalid. Please specify a valid solution configuration using the Configuration and Platform properties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those properties blank to use the default solution configuration.
This is caused by a bug that results in Visual Studio using "Any CPU" for the platform for solution files, while it uses "AnyCPU" for project files. See: http://connect.microsoft.com/VisualStudio/feedback/details/503935/msbuild-inconsistent-platform-for-any-cpu-between-solution-and-project
Is there a way to configure my build to make this work despite the issue? I.e., a way to pass a particular platform value to a specific sln build command while passing a different value to other commands?
Upvotes: 2
Views: 1214
Reputation: 4083
Open your solution.
From the Build menu click Configuration Manager.
From the active solution platform drop down, select New. Create a New Platform called "Any CPU" and Copy Settings From the AnyCPU configuration.
Click OK
From the active solution platform drop down, select Edit.
Select "AnyCPU" and click Remove.
OK to close all all dialogs, then CTRL+SHIFT+S to save your solution file.
Now when you build the solution the platform should be identical.
Upvotes: 2
Reputation: 10432
How about editing your .csproj
you build individually and adding the Or '$(Platform)' == 'Any CPU'
to Platform
property's default condition to override/trim the space?
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' Or '$(Platform)' == 'Any CPU' ">AnyCPU</Platform>
Upvotes: 5