DSS New Service Generation Tool (DssNewService.exe)

Glossary Item Box

DSS User Guide: DSS Service Projects Overview

See Also Microsoft Robotics Developer Studio Send feedback on this topic

DSS New Service Generation Tool (DssNewService.exe)

The Decentralized Software Services (DSS) New Service Generation tool creates a new service project which you can use as the starting point for writing a new service. The project can be opened in Visual Studio but you can also edit it in any other source code editor. Similarly, the service can be compiled in Visual Studio or from the command line using the .NET Framework SDK. Note that DssNewService is a command-line tool for creating new services. You can also create new services using a Wizard in Visual Studio.

  <strong>dssnewservice.exe</strong> [options]

Parameters

Option Short Name Description

/alt:

Examples

From the Microsoft Robotics Developer Studio Command Prompt, the you can use the simplest example of creating a VB.NET service template project called MySampleVB or use a C# service template project called MySampleCS in respective folders of the same name.

For C#:

DssNewService.exe /s:MySampleCS

For VB.NET:

DssNewService.exe /l:VB /s:MySampleVB

These commands create folders called MySampleCS and MySampleVB respectively that contain Visual Studio project files. Even though a generated service only contains the skeleton of a service you can compile it directly from the command line using msbuild or from within Visual Studio. From the command line you can compile the C# service like this:

cd MySampleCS
msbuild MySampleCS.csproj

Once it is compiled, you can start the service using the DssHost utility:

cd "%MRI_INSTANCE_DIR% "
DssHost.exe /p:50000 /m:"MySampleCS\MySampleCS.manifest.xml"

Then you can examine it using your Web browser by using the following URL: https://localhost:50000 and looking in the section Running Services.

Another common example is creating a service that implements a specific service contract. For this you first need to determine which service contract you want to implement. The DssInfo utility is useful for inspecting a service assembly. The information can be written to an XML file or a HTML file (or set of files if the DLL contains more than one service).

The following example shows how to pick a service contract from the RoboticsCommon DLL. First run DssInfo:

DssInfo.exe /s:xml /o:"c:\temp" bin\RoboticsCommon.dll

The output is an XML file called c:\temp\RoboticsCommon.xml that you can open in a web browser. You can open XML files in Notepad or a web browser. Locate the service that you are interested in and find its Contract Identifier in a <contract> tag. Here is a section of the XML file for the Motor service as displayed in Internet Explorer:

        - <ServiceSummary Name="Microsoft.Robotics.Services.Motor" HasImplementation="false">
          <DisplayName>Generic Motor</DisplayName>
          <Description>Provides access to a motor.</Description>
          <Contract>https://schemas.microsoft.com/robotics/2006/05/motor.html</Contract>
          - <Assembly>
            <Name>RoboticsCommon, Version=2.0.9999.0, Culture=neutral, PublicKeyToken=6f5a65c6ba7cb1d3</Name>
            <Company>Microsoft Corporation</Company>
            <Product>Microsoft (R) Robotics</Product>
            <Copyright>Copyright (c) Microsoft Corporation. All rights reserved.</Copyright>
            <Trademark>Microsoft Corporation (R)</Trademark>
            <ClsCompliant>true</ClsCompliant>
          </Assembly>
          - <MainPort>
            <Type Name="Microsoft.Robotics.Services.Motor.MotorOperations" />
            - <Operations>
              ...

The Motor service has the contract identifier: https://schemas.microsoft.com/robotics/2006/05/motor.html

Now run DssNewService indicating that you want to implement the motor service as follows:

DssNewService.exe /s:MyMotor /alt:"https://schemas.microsoft.com/robotics/2006/05/motor.html"

When you use the /alt command line argument, DssNewService generates a service project that contains stubs for all the service handlers defined in the specified contract.

The generated project is available in the MyMotor folder and can be compiled using the following commands.

cd MyMotor
msbuild MyMotor.csproj

Again, you can start the service using the DssHost utility:

cd "%MRI_INSTANCE_DIR% "
DssHost.exe /p:50000 /m:"MyMotor\MyMotor.manifest.xml"

Finally, open your Web browser and point it at https://localhost:50000 then look in the Service Directory to see the new service. Note that there will be two instances of the service, one which matches the alternate contract and the other which is a new service with its own set of operations.

See Also 

DSS User Guide: DSS Service Projects Overview

 

 

© 2012 Microsoft Corporation. All Rights Reserved.