【问题标题】:Visual Studio 2017 - PreBuild event command line (build another project)Visual Studio 2017 - PreBuild 事件命令行(构建另一个项目)
【发布时间】:2018-04-28 10:58:24
【问题描述】:

我有一个包含多个项目的解决方案。

当我构建项目“Foo”时,我需要它在 Foo 之前构建项目“SimplePluginFramework”。

即使Foo是在调试模式下构建的,它也需要在Release模式下构建'SimplePluginFramework'。

我尝试将此添加到 Foo 的 Pre-build 事件命令行,但它存在代码 9009 并且 Bar 未构建...

 $(MSBuildBinPath)\MSBuild.exe "L:\SL1 - Current System\Core\SL Agent\SLV1\Agent\SimplePluginFramework\SimplePluginFramework.csproj" /t:build /p:Configuration=Release 

如何让一个项目的构建在构建之前触发另一个项目的构建?

我已尝试添加对该项目的引用,但仍无法构建它。

错误:

    1>Target "PreBuildEvent" in file "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets" from project "L:\SL1-(SentiLAN)-SentiLAN v1 - Current System\SentilanCore\SentiLAN Agent\SentilanV1\AgentServiceTpl\SentilanService\SentilanService.csproj" (target "CoreBuild" depends on it):
1>Using "Exec" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
1>Task "Exec"
1>  "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe" "L:\SL1 - Current System\Core\SL Agent\SLV1\Agent\SimplePluginFramework\SimplePluginFramework.csproj" /t:build /p:Configuration=release
1>  Microsoft (R) Build Engine version 15.3.409.57025 for .NET Framework
1>  Copyright (C) Microsoft Corporation. All rights reserved.
1>  
1>  Build started 15/11/2017 09:47:32.
1>  Project "L:\SL1 - Current System\Core\SL Agent\SLV1\Agent\SimplePluginFramework\SimplePluginFramework.csproj" on node 1 (build target(s)).
1>  GenerateTargetFrameworkMonikerAttribute:
1>  Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
1>  CoreCompile:
1>  Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
1>  _CopyAppConfigFile:
1>  Skipping target "_CopyAppConfigFile" because all output files are up-to-date with respect to the input files.
1>  CopyFilesToOutputDirectory:
1>    SimplePluginFramework -> L:\SL1 - Current System\Core\SL Agent\SLV1\Agent\SimplePluginFramework\lib\net35\SimplePluginFramework.dll
1>  Done Building Project "L:\SL1 - Current System\Core\SL Agent\SLV1\Agent\SimplePluginFramework\SimplePluginFramework.csproj" (build target(s)).
1>  
1>  Build succeeded.
1>      0 Warning(s)
1>      0 Error(s)
1>  
1>  Time Elapsed 00:00:00.22

项目依赖:

【问题讨论】:

  • 当唯一的问题是你有一个愚蠢的错误信息时,不要要求手册。在“输出”窗口中查找消息并将其复制/粘贴到您的问题中。

标签: visual-studio-2017


【解决方案1】:

使用项目 | Project Dependencies 来定义 Foo 依赖于 SimplePluginFramework。

使用解决方案配置(右键单击解决方案并选择属性)来定义在解决方案级别的调试配置中使用 Foo 的调试版本,但使用 SimplePluginFramework 的发布版本。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-01-17
    • 2018-06-02
    • 2011-08-05
    • 1970-01-01
    • 2012-04-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多