开发者

Pre-build event command line question

开发者 https://www.devze.com 2022-12-17 13:13 出处:网络
I created two applications.(Console Appliaction: MyConApp.exe and Windows Application: MyWinApp.exe) Purpose, Attach MyConApp.exe to MyWinApp.exe and transfer the MyConApp.exe args with the MyWinApp\'

I created two applications.(Console Appliaction: MyConApp.exe and Windows Application: MyWinApp.exe) Purpose, Attach MyConApp.exe to MyWinApp.exe and transfer the MyConApp.exe args with the MyWinApp's Pre-build event.

[update]

MyConApp.exe is a small tool to parse a XSD file and generate a FromXSD.cs file. It worked very vell if i double click it.And my开发者_JAVA技巧ConAppArgs is the XSD file path.

Now the FromXSD.cs file used by the MyWinApp.exe project. I hope to build MyWinApp.sln with the FromXSD.cs file at the building time.

If the XSD file changed someday. I need handle the new XSD file automatically if i take use the pre-build event command line method. That's why i procedured the three steps.

My Procedure

Step1.

I copied the MyConApp.exe to the same path of MyWinApp.exe.

That is say: there are two .exe file located in the path **D:\learning\cs\MyWinApp\MyWinApp\bin\Debug**

Step2.

Open the MyWinApp project properties -> build events -> and the Pre-build event command line:

input:

myConApp.exe myConAppArgs

Step3.

Save MyWinApp project, build and run it.

Is there any better method to do this or any stand procedure to follow? Thanks for reading and replies.


Due to the fact, that you want to do this in your pre-build event, you can merge step one and two. Just try the following in your WinApp pre-build event:

copy /y $(SolutionDir)conApp\$(OutDir)ConApp.exe $(TargetDir)
ConApp.exe -i -k -whatever

So your ConApp will always be fresh copied within the pre-build event. Also you should set in the Project Dependencies of WinApp, that it will depend on ConApp. So ConApp will always be built before WinApp.

To access the Project Dependencies just right click in your Solution Explorer on the WinApp project and search that entry within the context menu.


This sounds pretty bizarre, does the MyConApp.exe do anything that affects the build process of MyWinApp.exe? If it does, it certainly doesn't belong in the bin\Debug directory, it would have to have the same affect when you build the Release version. It belongs in the project directory.

If it doesn't affect the build then using a pre-build event is entirely inappropriate. You'll then need to explain why this is at all necessary.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号