Unable to copy file 'source' to 'destination' while building application in visual studio 2022

Viewed 29

I am working on Web API Project in ASP.NET Core using .NET 6.0. I have also added some features of MVC to view the data. Everything was working fine. Suddenly, while modifying the project, i have tried to build the application, i have received error

Unable to copy file "D:\Soliton\Applications\MachineManagement\ServerAPI\MMAPIApp\MMAPIApp\obj\Debug\net6.0\apphost.exe" to "bin\Debug\net6.0\MMAPIApp.exe". Access to the path 'bin\Debug\net6.0\MMAPIApp.exe' is denied.

enter image description here

I have tried to give rights to everyone to the source and destination folders.

1 Answers

The path 'bin\Debug\net6.0\MMAPIApp.exe' is an executable file, and not a directory. Whatever you modified, you probably inputted the incorrect path. You probably meant bin\Debug\net6.0 as this would be a valid directory path to copy a file to.

Related