Weird Access is is denied error when change Platform in ConfigurationManager

Viewed 23

I am working with Visual Studio 2019 in Windows 11.

I create a new Solution which only has 1 Console App (.NET Framework) Project. The Framework is .NET Framework 4.7.2. So the Project's name is ConsoleApp1 and it has 1 App.config and 1 Program.cs file. And the Solution's name is also ConsoleApp1. I rebuild the solution and no errors.

Now this Project need to be used for x64 Platform. So I follow these steps:

  1. I open Configuration Manager window. For the ConsoleApp1 Project, the Configuration field is showing Debug and the Platform field is showing Any CPU.
  2. I open the drop down of Platform field and click <New...> option which opens New Project Platform window. There I selected x64 as New platform and Any CPU as Copy settings from. Click OK button which closes the New Project Platform window. Now in Configuration Manager window the Platform field of ConsoleApp1 Project is showing x64.
  3. I close Configuration Manager window.

Now I rebuild the solution again but this time I get this error:

Unable to copy file "obj\x64\Debug\ConsoleApp1.exe" to "bin\x64\Debug\ConsoleApp1.exe". Access to the path 'obj\x64\Debug\ConsoleApp1.exe' is denied.

I dont understand this error. There is no other Visual Studio open. There is no other process accessing those folders. Why I am getting this error?

If I change the Project's Platform back to Any CPU then the rebuild the solution works and I get no errors. So it has to do something with x64 Platform.

0 Answers
Related