The C# demo can be built from the command line, or from the provided Visual Studio solution (.sln) file.
Building the C# demo server and client (command line)
- From the root directory of the distribution, cd to the demo directory:
- Generate source code for Protocol Buffer messages:
- Build the demo server:
- Build the demo client:
cd csharp\demo
..\bin\ProtoGen.exe Demo.proto -service_generator_type=GENERIC
csc DemoServer.cs Demo.cs DllPathResolver.cs /r:..\bin\RCFProto_NET.dll /r:..\bin\Google.ProtocolBuffers.dll
csc DemoClient.cs Demo.cs DllPathResolver.cs /r:..\bin\RCFProto_NET.dll /r:..\bin\Google.ProtocolBuffers.dll
Building the C# demo server and client (Visual Studio)
- From Visual Studio, open csharp\demo\vs2008\RCFProtoDemo.sln .
- If you are using a Visual Studio version newer than Visual Studio 2008, you will be prompted to upgrade the solution. Ignore any upgrade errors related to Demo.cs (this is a file generated by the solution).
- In the Solution Explorer, right click on the RCFProtoDemo solution and press Build. A pre-build event will run ProtoGen.exe to generate Demo.cs (containing source code for Protocol Buffer messages). The demo server and client will be built to the csharp\demo\vs2008\bin\Debug directory.
Running the C# demo server and client
- Run the demo server:
- Run the demo client (in a different command prompt):
DemoServer.exe
DemoServer.exe
FAQ
-
Q: I have built DemoClient.exe and DemoServer.exe from the provided Visual Studio solution. When running either of the executables, the following error is displayed:
The type initializer for 'DeltaVSoft.RCFProto.RCFProtoPINVOKE' threw an exception.
A: This is most likely caused by the program not being able to load RCFProto_NET_impl.dll. If the solution is built from a location within the distribution, it should find RCFProto_NET_impl.dll automatically. If the solution is built from a location outside the distribution, you will need to copy RCFProto_NET_impl.dll, from either csharp\bin\x86 or csharp\bin\x64, to the location of the executables.