May 13, 2019

WCF Service Project publish fails due to .datasource files.

I have multiple WCF service projects in solution file. One service (User Management) has reference to another service (CommonLib) to reuse common functionality. For service method calls I have created separate interfaces and hence separate class templates for each method's request. The parameters of methods are encapsulated in single request object as public properties. And similar pattern used to methods' return values or responses.

In some cases, the request classes names become too long (for some reasons) and that causes me the issue when publishing my User Management WCF service. It was build successfully, but when try to publish, it was showing the following error message:

Copying file Service References\CoreSystem.B2B\CoreService.CoreSystemIntegration.CoreSystem.B2B.GetCompanyConsentsByCompanyAccountIDResponse.datasource to obj\Release\AspnetCompileMerge\Source\Service References\CoreSystem.B2B\CoreService.CoreSystemIntegration.CoreSystem.B2B.GetCompanyConsentsByCompanyAccountIDResponse.datasource failed. The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

While searching I found different suggestions which give valuable information on the topic:

In my case I fixed the issue by deleting all the .datasource files from ProjectRoot/Properties/DataSources folder.

After deleting .datasource files, I got my WCF service published successfully.

1 comment: