【问题标题】:Build a solution with MS build when the solution configuration doesn't match all projects当解决方案配置与所有项目不匹配时,使用 MS build 构建解决方案
【发布时间】:2020-02-22 09:54:50
【问题描述】:

我有一个有配置的解决方案,我们称之为A。该解决方案中 80% 的项目也具有配置 A,但其余项目没有。尽管它们确实需要构建。

当我使用 msbuild proj.sol /p:Configuration=A /p:Platform=x64 构建时,我会收到类似这样的错误消息

error MSB4057: The target "Build" does not exist in the project.

似乎我可以构建我的项目的移动,但不能构建配置名称与解决方案不匹配的项目。

【问题讨论】:

    标签: visual-studio msbuild solution


    【解决方案1】:

    您需要更新您的解决方案配置“A”以确保其他项目具有解决方案配置“A”的有效项目配置

    1. 在 Visual Studio 中,转到菜单 Build > Configuration Manager。
    2. 在活动解决方案配置下拉列表中选择配置“A”
    3. 选择要用于每个项目的配置。请注意,它不必是“A”。它可以是任何有效的项目配置。
    4. 确保也为项目设置了平台设置。它们可以不同于解决方案平台。 IE。解决方案 x64,但一个项目可能设置为 x86。

    msbuild proj.sln /p:Configuration=A /p:Platform=x64

    【讨论】:

    • 所以在 VS 中,当您的活动配置设置为 A 并且平台 x64 时,它构建时没有错误?此外, msbuild proj.sol /p:Configuration=A /p:Platform=x64 应更新为 msbuild proj.sln /p:Configuration=A /p:Platform=x64 。如果您只运行命令 msbuild proj.sln 会发生什么?
    【解决方案2】:

    我也遇到了同样的问题。通过安装F# Tools for Visual Studio Express 2012 for Web 并按照Xamarin forums 中描述的步骤重新启动Xamarin 来修复它

    该错误已提交here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-08-01
      • 2011-06-07
      • 1970-01-01
      • 2016-10-07
      • 1970-01-01
      • 2015-07-10
      • 2010-12-21
      • 1970-01-01
      相关资源
      最近更新 更多