Search code examples
c#.netazureazure-worker-rolesazure-cloud-services

azure worker roleA project with an Output type of Class Library cannot be started directly


I created a new cloud service solution in visual studio 2015 update 2 with azure SDK 2.9

According to one book I am reading, it says that if I start a worker role, it should open the compute emulator and I should be able to debug my code.

However I get this error: A project with an Output type of Class Library cannot be started directly

I know exactly what the error means, and on the tray icon the compute emulator has been started.

How can I debug the worker role?


Solution

  • Just in case this ever happens to anyone else, there's another possibility: Resharper 9.2 introduced Run Configurations which, among other things, allow you to set a specific project as the startup target.

    The page though notes:

    ReSharper overrides Visual Studio's Start and Start Without Debugging commands (i.e. Start/F5 etc) to execute ReSharper's active configuration.

    So, silently, pressing F5 suddenly doesn't do what you expect.

    If - like me - you have never heard of this feature, you might find yourself being vexed and perplexed when Visual Studio suddenly refuses to run the project you set as startup: in my case, a class library had been set in the Resharper Run Configuration, so I received the error "A project with an Output type of Class Library cannot be started directly", which led me to this question, as I had just added a new worker role to the cloud service.

    It was only when I got a different error from Resharper itself - "The project to be run with this configuration is not present in the solution" - that I managed to figure out what was going wrong, as that led me to this page. Then I could open up the Run Configuration dialog and reset it to use the Visual Studio setting.

    I have no idea how the Resharper startup got set. Maybe some strange key combination or something.