MSBuild 4.5 is ignoring project dependencies

后端 未结 6 699
梦谈多话
梦谈多话 2021-02-14 23:39

I have a VS2010 solution file with over 20 projects in it, and some of the projects have dependencies on other projects from within the solution.

I also have multiple bu

6条回答
  •  别跟我提以往
    2021-02-15 00:22

    I get the sense this issue has multiple causes. I tried most of the solutions here. I cannot change our build server to use a PS script so that solution was out. Nothing I could try worked.

    Finally, I deleted my solution and started a new one. The new solution worked. After diffing the broken solution with the working solution, I found the original solution was was missing lines. Each dependency that would not compile was missing this line:

    {A93FB559-F0DB-4F4D-9569-E676F59D6168}.Release|Any CPU.Build.0 = Release|Any CPU
    

    Note 1: The GUID will change from dependency to dependency.

    Note 2: You can find lines like this one under the "GlobalSection(ProjectConfigurationPlatforms) = postSolution" part of the solution file.

    My build.proj file says build "Release" using the "Any CPU" platform. Because MSBuild could not find this line it did not build this dependency. This results in the "error CS0246: The type or namespace could not be found" message.

    If you are curious, someone had set this solution to the "x86" platform (which is wrong for us). I changed it to "Any CPU" (along with several other changes). Visual Studio did not add the corresponding lines to the solution file. Everything built fine in the IDE, but MSBuild started throwing errors.

提交回复
热议问题