Partial cAlgo integration with Visual Studio 2015 FREE Community Edition
Partial cAlgo integration with Visual Studio 2015 FREE Community Edition
03 Mar 2016, 10:51
Waiting for the official integration of cAlgo with Visual Studio 2015 (I hope the FREE Community Edition), I elaborated this partial but fully functional solution
Above all, if you don't have it yet, download and install the powerful but TOTALLY FREE Visual Studio 2015 Community Edition
https://www.visualstudio.com/en-us/products/visual-studio-community-vs.as
During the installation, you can choose the full version (with web development, C++, Python and much much more...) or select only our loved C# environment for a lighter implementation
Now this is the procedure:
- Open as always a NEW EMPTY cBot or Indicator in cAlgo
- From the left menu, click on the dropdown menu arrow near the name of the new cBot/Indicator and select BUILD WITH SOURCE CODE
- Always from the same menu, select SHOW IN FOLDER and you should see your cAlgo file and a folder with the same name of your cBot or Indicator
- For now, simply let open this window with your cAlgo project
- Launch the Visual Studio 2015 Community Edition
- From the Visual Studio top menus: FILE -> choose NEW -> PROJECT FROM EXISTING CODE...
- A wizard windows appears, select VISUAL C# from the bottom dropdown menu
- Press NEXT button and it appears the SPECIFY PROJECT DETAILS window
- In the "Where are the files?" copy and past the full path from the cAlgo window you left open before, it will be something as "C:\Users\Marco\Documents\cAlgo\Sources\Robots\SniperServer cBot V01"
- Be careful, you must ENTER WITHIN your cBot/Indicator folder to select it, not stop at the "Robots" branch
- Be sure the "Include subfolders" option is checked
- In the following field specify the name for the new integrated project
- I use this convention: I call "RobotName cBot" the cAlgo project, and "RobotName cSharp" the integrated project... but of course you can use the name you want
- Choose the default CONSOLE APPLICATION as OUTPUT TYPE
- Press the FINISH button, Visual Studio works a while... and it's done!
- Note that you can apply this steps also to your already developed cBot/Indicator
Now you can start working on your new INTEGRATED PROJECT
Within Visual Studio expand the SOLUTION EXPLORER on the right and pin it to have always the files within reach
Probably you have to expand also all the folders of the new project and then double click to open your cBot,cs file
To complete the integration, you must add the "Main" function to your cBot/Indicator code and then add the reference to cAlgo API to Visual Studio Project
Add the "public static void main()" to YOUR cBot/Indicator CODE ..... [Parameter("Order label", DefaultValue = "ShootOne")] public string label { get; set; } [STAThread()] public static void Main() { Console.Write("Press a key to close..."); Console.ReadKey(); } protected override void OnStart() { .....
How you can see, every coding you act within Visual Studio is immediately reported also in cAlgo... because now the two projects are fused in the same!
- Now right click on the REFERENCES branch in the LEFT SOLUTION EXPLORER and ADD REFERENCE...
- Select the last option BROWSE from the left menu
- Press the BROWSE bottom button and navigate to cAlgo API folder, probably something as "C:\Users\Marco\Documents\cAlgo\API"
- Double click on "cAlgo.API.dll"
- Ensure the cAlgo.API.dll is added and checked in the central Reference Manager Windows, then OK
- Now expand the REFERENCES branch in the right SOLUTION EXPLORER and you must see the just added cAlgo.API.dll
...and finally all the job is done!
- You have your usually cBot/Indicator project in cAlgo
- But now you have also a CONSOLE PROJECT in Visual Studio
- You can work in Visual Studio with the intellisense and all the editor options
- You can compile and launch the console within Visual Studio, call the different method of your cBot/Indicator, set the break points, follow the flow of your code and debug it
- But remember... this is only a "partial" integretion, there are some limitation
- In particular, every time you add a library/dll reference in Visual Studio, you must add it also from the top menu in cAlgo enviroment
That's all and have a nice job!
gainer
03 Mar 2016, 14:55
Since it's only a partial integration of cAlgo with the Visual Studio 2015 (I always highlight in it's FREE but powerfull Community Edition), the cAlgo internal menu "Edit in Visual Studio" doesn't work and you have to open the project directly, but it's pretty simple
To be more specific, if you are interested in the details
Personally I use only the Visual Studio IDE to develop all my project and it works very fine, both as intellisense editor and as debugger
I hope this my be helpful, waiting for the official cAlgo integration!
@gainer