0

So I was running a c# program and then I saw this in the error list section

Warning MSB3026 Could not copy "C:\Users\USER\source\repos\app\app\obj\Debug\netcoreapp3.1\app.exe" to "bin\Debug\netcoreapp3.1\app.exe". Beginning retry 10 in 1000ms. The process cannot access the file 'bin\Debug\netcoreapp3.1\app.exe' because it is being used by another process. The file is locked by: "app (11048)"  app D:\Visual Studio\main app\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets   4651    

Btw here's my code:

using System.Collections.Generic;
using System.Linq;
using System.Reflection.Metadata.Ecma335;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace app
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(GetMax(2, 1, 3));
        }
        static int GetMax(int num1, int num2, int num3 )
        {
            int result;
            if (num1 >= num2 && num1 >= num3)
            {
                result = num1;
            }
            else if (num2 >= num1 && num2 >= num3)
            {
                result = num2;
            }
            else { result = num3; }
            return result;
        }

    }
}

It says no issue is found but I still get that error message, can somebody help? I also can't find any solution on google

1 Answers1

0

When we encounter the warning MSB3026 error, we can refer to the following link to use the general method to deal with the problem.

  1. Visual Studio "Could not copy" .... during build
  2. Visual Studio 2012 warning MSB3026: Could not copy DLL files
Theobald Du
  • 773
  • 2
  • 7