views:

440

answers:

3

Hi,

I have WCF library project which I have recently done some minor refactoring on eg changing the namespace and changing it location on disk. I also removed the app.config, because I thought the app.config is used by whatever hosts the wcf service.

I have since noticed that I can no longer debug the library using the WcfSvcHost like I used to be able to do. The message I get from Visual Studio is:

'A project with an Output Type of Class Library cannot be started directly.

In order to debug this project, add ana executable project to this solution which references the library project. Set the executable as the startup orject.

I don't want to do as it says, because I didn't need to do this before. Please let me know how to restore the ability to debug it using the WcfSvcHost. On the Debug tab of the project settings, the Command line arguments is still set to: /client:"WcfTestClient.exe"

Not sure what else to try, thanks.

A: 

You need to build the project in Debug Mode in order to use WcfTestClient and WcfSvcHost

In Debug mode you don't need another project. The Wcf Service Library runs in WcfSvcHost

However if your solution has only Wcf Service Library you need the app.config to configure the endpoints and etc...

Svetlozar Angelov
I am only trying with the Debug version and I have put the app.config back in. Still VS will not let me debug with WcfSvcHost
Shantaram
+1  A: 

I have observed that changing the output path of the project cause this behavior. To re-enable the debugging using WCFSvcHost/WCFServiceClient leave the output path to default and it should work.

Prakash Buddhiraja
A: 

If you changed the project output path you can still run it, you just need to provide some extra parameters to WcfSvcHost like this (enter this in Command Line Arguments in project's debug settings):

/service:ServiceInterface.dll /config:application.config /client:"WcfTestClient.exe"

No need to enter the full path as it will be run from your new project output path

If you still get the 'A project with an Output Type of Class Library cannot be started directly' then you can try changing the start action to 'Start external program' and select the WcfSvcHost.exe in there

fajrvehr