0
votes

I've recently upgraded a project to .NET Framework 4.6.1 and now am having issues when trying to deploy to Azure as a WebJob. I'm getting the following error:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\VisualStudio\v15.0\Web\Microsoft.Web.Publishing.targets(2603,5): Error : Copying file C:\Users\XXXXXXXXXXX\Documents\Source\Workspaces\XXXXX Server Application\ServerApplication\XXXXXXXX.IntegrationService\bin\Release\Microsoft.Extensions.DependencyInjection.Abstractions.dll to obj\Release\Package\PackageTmp\app_data\jobs\continuous\XXXXXXXXIntegrationService\Microsoft.Extensions.DependencyInjection.Abstractions.dll 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.

I'm confused by the error as the path and filename are only 189 characters combined:

C:\Users\XXXXXXXXXXX\Documents\Source\Workspaces\XXXXX Server Application\ServerApplication\XXXXXXXX.IntegrationService\bin\Release\Microsoft.Extensions.DependencyInjection.Abstractions.dll

If I remove the Microsoft.Extensions.DependencyInjection.Abstractions.dll from my project I can then deploy as normal. I've tried cleaning the solution and restarting VS.

1
You would have try and isolate the issue with Deployment Vs WebJob as mentioned in the page Isolating WebJobs and Deployment script (github.com/projectkudu/kudu/wiki/…) - The first step is to try running the same logic outside of those context, which will help isolate the steps. Review the discussion on a similar issue: github.com/projectkudu/kudu/issues/1490AjayKumar-MSFT

1 Answers

1
votes

I'm confused by the error as the path and filename are only 189 characters combined

That because event if the error as the path and filename are only 189 characters combined in below path:

C:\Users\XXXXXXXXXXX...bin\Release\Microsoft.Extensions.DependencyInjection.Abstractions.dll

But when we publishing the project, VS/MSBuild will copy this file to the path:

obj\Release\Package\PackageTmp\app_data\jobs\continuous\XXXXXXXXIntegrationService\Microsoft.Extensions.DependencyInjection.Abstractions.dll

So the full path and filename should be:

C:\Users\XXXXXXXXXXX\Documents\Source\Workspaces\XXXXX Server Application\ServerApplication\XXXXXXXX.IntegrationServiceobj\Release\Package\PackageTmp\app_data\jobs\continuous\XXXXXXXXIntegrationService\Microsoft.Extensions.DependencyInjection.Abstractions.dll

Then the path and file name are about 260 characters combined, so VS/MSBuild could not access that path. To resolve this issue, you can try to move your solutions/projects to the the root directory, like:C:\Workspaces