Reputation: 187
I am fairly new to C# and I working on one C# project/desktop app. This application can be called with various arguments. For instance:
programName.exe -m arg1
programName.exe -m arg2
programName.exe -m arg3
I understand that everything I need to build my project is consisted in .csproj file. Is it possible to configure this file so everytime project is builded three batch files (one per each argument) are created in the build output folder? Or is there some other, more sophisticated way to do this? Point is I would like to have these batch files in output build project.
I am open for suggestions!! Thank you.
Upvotes: 0
Views: 252
Reputation: 11763
Yes, you can configure your Visual Studio with Post build actions. You'll probably want to have this file generated automatically, and you can then tell it to copy it over to the output directory .
If you right click on your project, and select "Properties", in the tab that will open you'll see on the left something like "Application, Build, Build Events, ..." options. Select the "Build Events" and you can choose what to do there.
You can read more about your options in the msdn page, and as a bonus, here's an image:
Upvotes: 1
Reputation: 31153
If the batch files don't need to be dynamically generated you can just create them and add to the project. Then set their type in properties as Content and Copy if newer. This way they will always be put to the output folder on build.
If they need to be somehow dynamically generated then you can use post-build steps to handle that.
Upvotes: 2