2017-08-10 77 views
0

我在Windows 7 Ultimate x64上使用VS2010。 我想在一個解決方案中自動構建多項目。VisualStudio - Q:如何在解決方案中構建多個項目之前執行過程

例如:) 解決方案StormSolution包含4個項目。

1:Storm_Module1(輸出文件擴展名:DLL)

2:Storm_Module2(輸出文件擴展名:DLL)

3:CombineModule12(輸出文件擴展名:DAT)

4: ConvertModule2CFGFile(輸出文件擴展名:cfg)

第1,2步Storm_Module1Storm_Module2的結果是Standard Windows DLL

步驟3:的CombineModule12結果是開放Storm_Module1.dllStorm_Module2.dll使「combined.dat」文件,就像cmd.exe /c copy /b storm_module1.dll + storm_module2.dll combined.dat命令。

步驟3-1:然後,讓combined.dat文件到encrypted_combined.dat文件,encryption_tool

第4步:打開「encrypted_combined.dat」文件,並將其製作成自己指定的cfg文件。

問題發生在步驟4。我無法自動構建解決方案風暴。 因爲我已經做「combined.dat」Step3結果爲「encrypted_combined.dat」encryption_tool

因此,如果我在沒有任何操作的情況下構建Storm解決方案,ConvertModule2CFGFile項目無法打開最新更新encrypted_combined.dat

我該如何執行加密工具Step4

加密工具可以用參數執行。

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

在構建項目之前無法執行過程嗎?

+0

使用def文件使用lib.exe實用程序爲相應的* .dll文件創建* .lib文件。 dll模塊不需要保存在解決方案中,因爲它們在編譯期間不需要。保持項目鏈接器設置爲共享模式。 – ark1974

回答

1

在Visual Studio中,您可以創建Post-Build Events可以執行批處理文件。用它來組合你的兩個DLL。

要使您的項目按正確的順序生成,請在解決方案/項目中調整Build Dependencies and Build Order

+0

Thankyou。當我輸入「Calc.exe」時它工作正常,但我怎樣才能運行我自己的程序?當我輸入「D:\ Tools \ CryptionTool.exe Combined.dll」時,它不起作用。錯誤MSB3027發生。 –

+0

嘗試使用絕對路徑來指定您的Combined.dll - 可移植的方式是使用$(SolutionDir)或$(ProjectDir)/bla/Combined.dll – Freakyy

0

考慮爲Visual Studio命令提示符編寫一個批處理文件 - 它將使您能夠首先構建解決方案,然後您可以對喜歡的文件執行任何操作並輕鬆調用加密工具,然後構建最後一個解決方案。

這個線程應該讓你開始:

How to create a Batch File for Visual Studio Command Prompt

相關問題