简体   繁体   English

vs2003:C#无法建立Visual Studio解决方案

[英]vs2003 : c# can not build visual studio solution

I get latest from source control and can not build my visual studio solution. 我从源代码管理中获取最新信息,无法构建Visual Studio解决方案。 I get the following error: 我收到以下错误:

Cannot copy assembly 'XYZ' to file 'C:\\myfolder\\bin\\Debug\\XYZ.dll'. 无法将程序集“ XYZ”复制到文件“ C:\\ myfolder \\ bin \\ Debug \\ XYZ.dll”。 The process cannot access the file because it is being used by another process. 该进程无法访问该文件,因为该文件正在被另一个进程使用。

I have rebooted the machine but nothing seems to work. 我已经重启了机器,但是似乎什么也没用。 please help. 请帮忙。

Use ProcessExplorer to determine what other process is holding the DLL open - my bet is that it is Visual Studio itself. 使用ProcessExplorer来确定哪些其他进程正在使DLL保持打开状态-我敢打赌,它是Visual Studio本身。 Try closing down any open form Design windows (or all code/design windows in VS.Net for that matter) and see if you still get the same problem. 尝试关闭所有打开的窗体设计窗口(或关闭VS.Net中的所有代码/设计窗口),看看是否仍然遇到相同的问题。

You can use the handle tool to determine what process is using that file: 您可以使用处理工具来确定正在使用该文件的进程:

handle XYZ.dll

From there, you can figure out what started the process and why it's using the file. 从那里,您可以找出启动该过程的原因以及使用该文件的原因。

Whenever i've seen that error, it was because the program i was trying to compile was still running. 每当我看到该错误时,都是因为我尝试编译的程序仍在运行。 You may want to check and make sure any debug sessions are stopped (not just paused, but stopped completely), and that your program doesn't appear in the Task manager under the "Processes" tab. 您可能要检查并确保所有调试会话都已停止(不仅仅是暂停,而是完全停止了),并且您的程序没有出现在“进程”选项卡下的任务管理器中。

尝试将构建配置从“调试”更改为“发行”,然后再次尝试进行编译。

let's try a simple solution. 让我们尝试一个简单的解决方案。 The DLL in your bin directory is likely marked as Read-Only. 您bin目录中的DLL可能被标记为只读。 Visual studio doesn't check out the DLLs from the BIN directory when you check out source files. 当您签出源文件时,Visual Studio不会从BIN目录中签出DLL。 So if you keep the binaries in source safe then you need to manually check them out or manually take off the read-only flag in the directory. 因此,如果您将二进制文件保存在源代码中,则需要手动将它们检出或手动删除目录中的只读标志。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM