Is there a way to turn an existing class library into a worker role? I don't want to add more projects to the solution especially when this project will only call MyLibrary.Class.Run().

有帮助吗?

解决方案

Eventually, I found the solution:

  1. Add a cloud service project to the solution

  2. I had to edit the project file of my class library and add this: <RoleType>Worker</RoleType> to the first <PropertyGroup> element.

  3. In addition to that, my service entry point class had to extend RoleEntryPoint.

  4. 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.

其他提示

You'll have to add a "cloud service" project (.ccproj) anyway. Then you can include a RoleEntryPoint descendant to the project which you select as worker role payload (you do that when you add a new role to the cloud service project) and it should work.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top