首页 > 解决方案 > Visual Studio 显示我无法解释的错误

问题描述

所以我正在运行 ac# 程序,然后我在错误列表部分看到了这个

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    

顺便说一句,这是我的代码:

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;
        }

    }
}

它说没有发现问题,但我仍然收到该错误消息,有人可以帮忙吗?我在谷歌上也找不到任何解决方案

标签: c#.netvisual-studio

解决方案


当我们遇到警告MSB3026错误时,我们可以参考下面的链接使用一般的方法来处理问题。

  1. Visual Studio“无法复制”....在构建期间
  2. Visual Studio 2012 警告 MSB3026:无法复制 DLL 文件

推荐阅读