简体   繁体   English

在解决方案中构建多个项目之前如何执行流程

[英]How to execute process before build multiple projects in a solution

I'm using VS2010 on Windows 7 Ultimate x64. 我在Windows 7 Ultimate x64上使用VS2010。 I want to build multi-project in one solution automatically. 我想在一个解决方案中自动构建多项目。

For example : ) Solution StormSolution contains 4 projects. 例如StormSolution解决方案StormSolution包含4个项目。

1 : Storm_Module1 (output file extension : dll) 1:Storm_Module1(输出文件扩展名:dll)

2 : Storm_Module2 (output file extension : dll) 2:Storm_Module2(输出文件扩展名:dll)

3 : CombineModule12 (output file extension : dat) 3:CombineModule12(输出文件扩展名:dat)

4 : ConvertModule2CFGFile (output file extension : cfg) 4:ConvertModule2CFGFile(输出文件扩展名:cfg)

Step 1,2 : A result of Storm_Module1 and Storm_Module2 are Standard Windows DLL. 步骤1,2Storm_Module1Storm_Module2结果是Standard Windows DLL。

Step 3 : A result of CombineModule12 is open Storm_Module1.dll and Storm_Module2.dll to make "combined.dat" file, like cmd.exe /c copy /b storm_module1.dll + storm_module2.dll combined.dat command. 第3步CombineModule12的结果是打开Storm_Module1.dllStorm_Module2.dll以创建“ combined.dat”文件,例如cmd.exe /c copy /b storm_module1.dll + storm_module2.dll combined.dat命令。

Step 3-1 : Then, make combined.dat file into encrypted_combined.dat file with encryption_tool . 步骤3-1 :然后,使用encryption_toolcombined.dat文件转换为encrypted_combined.dat文件。

Step 4 : Open "encrypted_combined.dat" file and make it into own specified cfg file. 步骤4 :打开“ encrypted_combined.dat”文件,并将其放入自己指定的cfg文件中。

The problem occurs on Step 4 . 步骤4上出现问题。 I can't build solution storm automatically. 我无法自动建立解决方案风暴。 Because I've to make "combined.dat" result of Step3 into "encrypted_combined.dat" with encryption_tool . 因为我必须使用encryption_toolStep3 “ combined.dat”结果转换为“ encrypted_combined.dat”

So, if I build Storm solution without any action, ConvertModule2CFGFile project can not open latest updated encrypted_combined.dat . 因此,如果我没有采取任何措施就构建Storm解决方案,那么ConvertModule2CFGFile项目将无法打开最新的更新的encryption_combined.dat

How can I execute encryption tool before on Step4 . 如何在Step4上执行加密工具。

Encryption tool can be executed with parameters. 可以使用参数执行加密工具。

ex:) cmd.exe /c "encryption tool.exe -mode_crypt combined.dat -output encrypted_combined.dat . 例如:) cmd.exe /c "encryption tool.exe -mode_crypt combined.dat -output encrypted_combined.dat

Is it impossible to execute process before build project? 在构建项目之前不可能执行流程吗?

In Visual Studio you can create Post-Build Events which can execute a batch file. 在Visual Studio中,您可以创建可执行批处理文件的生成后事件 Use that to combine your two DLLs. 使用它来组合两个DLL。

To make your projects build in the correct order, adjust Build Dependencies and Build Order in your Solution/Projects. 为了使您的项目以正确的顺序构建 ,请在“解决方案/项目”中调整“ 构建依赖关系”和“构建顺序”

Consider writing a batch file for Visual Studio Command Prompt - it will enable you to build solutions 1 & 2 first, then you can perform any operation on files you like and call your encryption tool easily, and then build the last solution. 考虑为Visual Studio命令提示符编写一个批处理文件-它使您能够首先构建解决方案1和2,然后可以对所需文件执行任何操作并轻松调用加密工具,然后构建最后一个解决方案。

This thread should get you started: 此线程应该使您入门:

How to create a Batch File for Visual Studio Command Prompt 如何为Visual Studio命令提示符创建批处理文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM