.netvisual-studioasp.net-core.net-coreazure-service-fabric

MSB3021 Unable to copy file could not find part of path error when running Service Fabric app in Visual Studio


I have a Service Fabric solution that contains multiple projects. I can run all but one of them on my local cluster without issue, but one particular project will not deploy due to the following issue:

MSB3021 Unable to copy file "C:\Path\To\Repo\src\MyProject\MyService\obj\Debug\netcoreapp2.1\win7-x64\PubTmp\Out\Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.dll" to "C:\Path\To\Repo\src\MyProject\MyService\pkg\Debug\MyServicePkg\Code\Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.dll". Could not find a part of the path 'C:\Path\To\Repo\src\MyProject\MyService\pkg\Debug\MyServicePkg\Code\Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.dll'.

There are two other errors reporting the same issue for Microsoft.Extensions.Configuration.EnvironmentVariables.dll and runtimeconfig.json and 30 warnings stating the same issue for random dlls.

I have done all the usual several times:

  1. Deleted all bin, obj and pkg directories
  2. Stopped local cluster
  3. Restarted Visual Studio
  4. Restarted machine
  5. Checked out repo in a separate directory

The error states that it cannot find part of the path to the Code dir in pkg, but I have verified that it does exist.

It is strange that this only affects 1 out of several projects. Am I missing anything obvious here?


Solution

  • I could not get to the bottom of this issue, I had already deleted the solution directory and re-cloned from the repo and it had not fixed it, albeit in the same parent directory.

    In a last ditch attempt I re-cloned the repo in the root of my user directory and it worked fine from then on.

    I have no idea what the issue was and why that fixed it.