ClickOnce Publishing Issues-Cannot Copy Files

Groz 5 Reputation points
2023-03-07T00:42:35.89+00:00

I keep getting this error when publishing files. It does not matter if its to a local directory or URL server. The project builds correctly, and I can run the application. I have administrator rights to all locations. I've tried to delete bin an obj directories but same errors.

Any ideas at what is causing this ???

Error Cannot publish because a project failed to build. Speed_And_Flow_Sensors 1

Error Could not copy "bin\Debug\Speed_And_Flow_Sensors.exe.manifest" to "bin\Debug\app.publish\Application Files\Speed_And_Flow_Sensors_1_0_0_0\Speed_And_Flow_Sensors.exe.manifest". Exceeded retry count of 10. Failed. Speed_And_Flow_Sensors

Error Unable to copy file "bin\Debug\app.publish\Speed_And_Flow_Sensors.exe" to "bin\Debug\app.publish\Application Files\Speed_And_Flow_Sensors_1_0_0_0\Speed_And_Flow_Sensors.exe.deploy". Could not find a part of the path 'bin\Debug\app.publish\Application Files\Speed_And_Flow_Sensors_1_0_0_0\Speed_And_Flow_Sensors.exe.deploy'. Speed_And_Flow_Sensors

Error Unable to copy file "App.config" to "bin\Debug\app.publish\Application Files\Speed_And_Flow_Sensors_1_0_0_0\Speed_And_Flow_Sensors.exe.config.deploy". Could not find a part of the path 'bin\Debug\app.publish\Application Files\Speed_And_Flow_Sensors_1_0_0_0\Speed_And_Flow_Sensors.exe.config.deploy'. Speed_And_Flow_Sensors

Error Could not copy "App.config" to "bin\Debug\app.publish\Application Files\Speed_And_Flow_Sensors_1_0_0_0\Speed_And_Flow_Sensors.exe.config.deploy". Exceeded retry count of 10. Failed. Speed_And_Flow_Sensors

Error Could not copy "bin\Debug\app.publish\Speed_And_Flow_Sensors.exe" to "bin\Debug\app.publish\Application Files\Speed_And_Flow_Sensors_1_0_0_0\Speed_And_Flow_Sensors.exe.deploy". Exceeded retry count of 10. Failed. Speed_And_Flow_Sensors

Error Unable to copy file "bin\Debug\Speed_And_Flow_Sensors.exe.manifest" to "bin\Debug\app.publish\Application Files\Speed_And_Flow_Sensors_1_0_0_0\Speed_And_Flow_Sensors.exe.manifest". Could not find a part of the path 'bin\Debug\app.publish\Application Files\Speed_And_Flow_Sensors_1_0_0_0\Speed_And_Flow_Sensors.exe.manifest'. Speed_And_Flow_Sensors

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,829 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Gus Molina 0 Reputation points
    2024-03-28T01:07:39.3066667+00:00

    CAUSE: Destination file path too long.
    RESOLUTION: Moved public location closer to root of drive (shortening destination paths).

    I experienced this issue and figured out that for me, the resulting path for the file being copied ended up being too long and exceeded Windows 11 allowance. I then attempted to address issue by changing OS configuration to accept longer paths through Group Policy Editor, rebooted, and publish still failed, but now with a "file not found" error, instead of the previous "could not find part of the path". I then moved the publish location to a folder closer to the root of the drive (thereby shortening resulting paths, and this then produced a successful publish completion.