0
votes

MSBuild is reporting something odd:

D:\Test>msbuild Test.sln Microsoft (R) Build Engine version 15.1.1012.6693 Copyright (C) Microsoft Corporation. All rights reserved.

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. Build started 7/1/2017 5:33:14 PM. Project "D:\Test\Test.sln" on node 1 (default targets). D:\Test\Test.sln.metaproj : error MSB4126: The specified solution configuration "Debug|x64" 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. [D:\Test\Test.sln] Done Building Project "D:\Test\Test.sln" (default targets) -- FAILED.

So, Debug|x64 is not valid...

The problem is that:

D:\Test>find "X64" Test.sln

---------- TEST.SLN

this is not an existing target.

The file mentioned (D:\Test\Test.sln.metaproj) does not exist either (checked for hidden files too).

The sln file has DEBUG|AnyCPU and RELEASE|AnyCPU as targets.

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{63FA3D37-7672-4C5F-BAE2-43CCF8ABC7E4}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Release|Any CPU = Release|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {63FA3D37-7672-4C5F-BAE2-43CCF8ABC7E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {63FA3D37-7672-4C5F-BAE2-43CCF8ABC7E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {63FA3D37-7672-4C5F-BAE2-43CCF8ABC7E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {63FA3D37-7672-4C5F-BAE2-43CCF8ABC7E4}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
EndGlobal

So why is MSBuild confused?

As a personal note, it looks like since MS went with the .NET Core initiative, the whole build system has been a huge mess with disconnected settings, etc.

1

1 Answers

0
votes

As it turns out, this is tied to an environment variable (as if we don't have enough config files already).

When you run the cmd.exe, if you pick x86 or x64, it sets an environment variable.

And there is some unwritten rule that says that:

  • x86 is AnyCPU.. or x86
  • x64 is x64 but is not AnyCPU..