Wednesday, March 20, 2013

CSRun: why doesn't it work?

Undoubtedly, there may be many causes of the question set in the subject. But the first thing you should look at is whether you are trying to control (start, shutdown, etc) the emulation and control your emulated services (run service, update deployment, etc) at the same time. Moreover, it won't start devfabric and devstore simultaneously. In other words, CSRun confuses if you give it too many tasks at once. To resolve this kind of issue, just split it in two, three or more calls of CSRun, even though you might expect that single call will work for you. To be absolutely precise and to make it visual, I prepared the batch code samples below.

@REM Incorrect, do not do this way!!!
csrun.exe ^
  /run:MY.packed\MYS.csx;.\MYS\SConfig.Local.cscfg ^
  /launchbrowser /devfabric:start /devstore:start

Exactly, CSRun will attempt to do the first thing it finds in the parameter list. In the example above, it will try to run the MYS.csx package on the emulator using SCongig.Local.cscfg configuration file. It won't try to start the emulation before running the package. It won't even work as expected if you change the order in this way:


@REM Incorrect, do not do this way!!!
csrun.exe /devfabric:start /devstore:start ^
  /run:MY.packed\MYS.csx;.\MYS\SConfig.Local.cscfg ^
  /launchbrowser

In this example, it will start emulator and start compute emulation only, being reluctant to start storage emulation and to deploy the service package for running. To achieve the correct result, you merely call every implied action one by one, in separate lines:

@REM Correct, do this way!!!
csrun.exe /devfabric:start
csrun.exe /devstore:start 
csrun.exe ^
  /run:MY.packed\MYS.csx;.\MYS\SConfig.Local.cscfg ^
  /launchbrowser
 
This approach will do what you expected. The only further issue I can imagine is that you will have to insert a pause between calls, since storage emulator, for example, requires some time to start properly.  Nevertheless, in my practice it worked correctly and did the work.

P.S. For Russian speakers. Just call it "ЦСрань", and you won't be mistaken.

No comments:

Post a Comment