【问题标题】:Visual Studio showing unexplainable error by meVisual Studio 显示我无法解释的错误
【发布时间】:2020-08-29 12:42:45
【问题描述】:

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

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

    }
}

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

【问题讨论】:

  • 听起来你的程序在你编译的时候已经在运行了。
  • 要么已经不动了。
  • 这通常意味着它已经在运行。检查某处被忽略的控制台窗口。如果一切都失败了,请打开任务管理器并查找 app.exe,然后将其杀死
  • 在任务管理器上查看进程。如果您看到它已加载,请从那里杀死它并尝试重新运行应用程序,或者在最坏的情况下重新启动计算机。
  • 好的,我会试试的,顺便说一句:D

标签: c# .net visual-studio


【解决方案1】:

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

  1. Visual Studio "Could not copy" .... during build
  2. Visual Studio 2012 warning MSB3026: Could not copy DLL files

【讨论】:

    猜你喜欢
    • 2021-11-11
    • 1970-01-01
    • 2021-07-17
    • 1970-01-01
    • 2017-09-07
    • 2021-08-21
    • 2015-02-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多