gpt4 book ai didi

visual-studio-2012 - VS2012 构建后事件未触发

转载 作者:行者123 更新时间:2023-12-03 13:24:02 27 4
gpt4 key购买 nike

我有一个 Web 项目,它触发构建后事件“成功构建”以执行一些清理/迁移事件(命令脚本)。

在 VS2012 中,只有在代码发生更改时才会触发 post-build on success。如果没有代码更改,编译器仍会报告成功构建,但是,构建成功后事件不会触发。

在 VS2010 中,无论代码更改如何,每次成功构建都会触发构建后成功事件。这是我所期望的。即使没有发生任何更改,编译也成功,因此应该触发该事件。

带有代码更改的示例 VS2012 构建:

------ Build started: Project: ABC.Business.Web.Migrate, Configuration: Debug Any CPU ------
Build started 2012-08-23 01:26:13.
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702,2008 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /errorendlocation /preferreduilang:en-US /highentropyva- /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll" /reference:C:\Dev\ABC\Source\ABC.Business.Web\bin\ABC.Business.Web.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll" /debug+ /debug:full /optimize- /out:obj\Debug\ABC.Web.Migrate.dll /target:library /utf8output Properties\AssemblyInfo.cs "C:\Users\Administrator\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.cs"
_CopyFilesMarkedCopyLocal:
Copying file from "C:\Dev\ABC\Source\ABC.Business.Web\bin\ABC.Business.Web.dll" to "bin\ABC.Business.Web.dll".
Copying file from "C:\Dev\ABC\Source\ABC.Business.Web\bin\ABC.Web.dll" to "bin\ABC.Web.dll".
Copying file from "C:\Dev\ABC\Source\ABC.Business.Web\bin\ABC._Services.dll" to "bin\ABC._Services.dll".
Copying file from "C:\Dev\ABC\Source\ABC.Business.Web\bin\ABC.Business.Web.pdb" to "bin\ABC.Business.Web.pdb".
Copying file from "C:\Dev\ABC\Source\ABC.Business.Web\bin\ABC.Web.pdb" to "bin\ABC.Web.pdb".
Copying file from "C:\Dev\ABC\Source\ABC.Business.Web\bin\ABC._Services.pdb" to "bin\ABC._Services.pdb".
CopyFilesToOutputDirectory:
Copying file from "obj\Debug\ABC.Web.Migrate.dll" to "bin\ABC.Web.Migrate.dll".
ABC.Business.Web.Migrate -> C:\Dev\ABC\Source\ABC.Business.Web.Migrate\bin\ABC.Web.Migrate.dll
Copying file from "obj\Debug\ABC.Web.Migrate.pdb" to "bin\ABC.Web.Migrate.pdb".
PostBuildEvent:
"C:\Dev\bin\spawn.exe" "C:\Dev\ABC\Scripts\Migrate Business Web.bat"

Build succeeded.

Time Elapsed 00:00:00.34
========== Build: 4 succeeded, 0 failed, 53 up-to-date, 0 skipped ==========

示例 VS2012 构建,无需更改代码:
------ Build started: Project: ABC.Business.Web, Configuration: Debug Any CPU ------
Build started 2012-08-23 01:36:04.
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
CopyFilesToOutputDirectory:
ABC.Business.Web -> C:\Dev\ABC\Source\ABC.Business.Web\bin\ABC.Business.Web.dll

Build succeeded.

Time Elapsed 00:00:00.31
========== Build: 1 succeeded, 0 failed, 56 up-to-date, 0 skipped ==========

我尝试在 VS2012 中使用构建后事件“始终”。如果有代码更改(与 On success 相同),它只会触发 Always post-build 事件。我唯一的解决方法是进行重建——当我有几十个依赖项目时很痛苦!或者手动运行我的脚本——也很烦人! (不,这不是我的脚本 - 如第一个示例所示,当发生代码更改时,此脚本可以正常工作!)

这要么是有意更改,要么是错误。

有没有其他人在 VS2012 中遇到过这个构建后问题?

最佳答案

我有同样的问题,我解决了如下:

  • 将一些虚拟的空 txt 文件添加到项目中。
  • 属性“构建操作”:内容。
  • 属性“复制到输出目录”:总是。

  • 就是这样,即使项目是最新的或者不是启动项目,它也会始终执行 de POST-BUILD 步骤。

    enter image description here

    关于visual-studio-2012 - VS2012 构建后事件未触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12084133/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com