Eventually, I found the solution:
Add a cloud service project to the solution
I had to edit the project file of my class library and add this:
<RoleType>Worker</RoleType>
to the first<PropertyGroup>
element.In addition to that, my service entry point class had to extend
RoleEntryPoint
.Once this is done, right click no the Roles folder in the cloud service project and choose Add -> Worker role project in solution and choose my Class Library.
That's it.