【问题标题】:Run some script after compiling code in Visual Studio在 Visual Studio 中编译代码后运行一些脚本
【发布时间】:2023-02-23 11:38:12
【问题描述】:

在我的 VS 2022 解决方案中,我有几个项目。一种是“香草”项目类型:图书馆。

我想:

  1. 单击运行(或调试)按钮时
  2. VS 编译项目
  3. 然后运行我的脚本。该脚本必须(复制,但删除原始文件)文件Vanilla.dll到某个目标路径

【问题讨论】:

  • Solution Explorer => 项目,右击 => Properties => Section Build => Section Events => “Post-build events”

标签: c# visual-studio dll


【解决方案1】:

您应该检查与build-events 相关的线程。

对于您的问题,Fildor 有一个简短的解决方案。

具体可以实现如下(以.Net Framework项目为例,.Net项目同理):

Project—>Properties->Build->Post-build events

xcopy /y $(SolutionDir)1.txt $(ProjectDir) & del $(SolutionDir)1.txt

对于msbuild中的macro address,可以查看这个link

该示例首先使用xcopy将文件复制到指定地址,然后使用del删除原地址的文件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-20
    • 1970-01-01
    相关资源
    最近更新 更多