错误CS2012:无法打开<可执行路径>.访问<可执行路径被拒绝> [英] error CS2012: Cannot open <executable path> access to <executable path denied>

查看:67
本文介绍了错误CS2012:无法打开<可执行路径>.访问<可执行路径被拒绝>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Visual Studio 2015中使用WPF应用程序,并且一切进展顺利,直到该构建意外使我掉落,CS2012错误通知我它无法访问/更新/Debug目录中的可执行文件.

I was working on a WPF application in Visual Studio 2015 and all went well until unexpectedly the build dropped me the CS2012 error inform me that it cannot access/update the executable in the /Debug directory.

我尝试了以下操作,但不起作用:

I tried the following and it didn't work:

  1. 重新启动
  2. 关闭VS,然后再次打开应用程序
  3. Build-> Clean

我在网络上找不到任何解决方案,所以我尝试了:1.将整个项目目录移动到另一个位置.2.创建一个新的WPF项目,并使用复制/粘贴将文件逐个组装.

I couldn't find any solution in the web so I tried: 1. to move the whole project directory to another location. 2. creating a new WPF project and assembling it file by file with copy/pastes.

奇怪的是,在两种情况下,应用程序都在新位置工作.我继续进行实验(在原始目录中),并尝试在同一目录中构建"Hello World"控制台应用程序.结果是琐碎的控制台应用程序无法正常工作,并产生了与WPF应用程序相同的问题(CS2012错误).

The weird thing was that in both cases the application worked in the new location. I continued the experimentation (in the original directory) and i tried to build a "Hello World" Console application in the same directory. The result was that the trivial console application didn't work and produced the same problem as the WPF application (CS2012 error).

由于我没有注意到另一个程序的任何活动(例如,防病毒程序)试图隔离(或更改该文件夹的文件/文件夹的权限),因此我认为这是由VS完成的,但是我没有知道为什么.也许这是一个错误.

Since I haven't noticed any activity of another program (i.e., antivirus) trying to quarantine (or changing the file/folder permissions of) this folder, I assume that this has been done by VS somehow but I don't know why. Perhaps it is a bug.

有人对此问题有合乎逻辑的解释吗?并解决它?

Is anyone has a logical explanation about this problem? And a way to fix it?

推荐答案

我发现我的其他正在运行的解决方案引用了相同的<可执行文件路径>.

I found that my other running solution was referencing the same < executable path>.

只需确保没有其他进程正在使用引用的文件夹/文件/dll

Just make sure that no other process is using the referenced folder/file/dll

这篇关于错误CS2012:无法打开&lt;可执行路径&gt;.访问&lt;可执行路径被拒绝&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆