我正在使用Windows 7上的Visual Studio 2012编写C#代码。我的解决方案包含多个项目。
我最近向我的解决方案添加了一个新项目,并在解决方案中的2个其他项目的引用中添加了此新项目的dll(其中一个是启动项目)。新项目本身引用了几个未包含在我的解决方案中的其他项目。
构建解决方案中的项目运作良好,但当我尝试运行程序(在Debug或Release模式下)时,出现错误。以下是错误信息:
我最近向我的解决方案添加了一个新项目,并在解决方案中的2个其他项目的引用中添加了此新项目的dll(其中一个是启动项目)。新项目本身引用了几个未包含在我的解决方案中的其他项目。
构建解决方案中的项目运作良好,但当我尝试运行程序(在Debug或Release模式下)时,出现错误。以下是错误信息:
System.IO.FileNotFoundException was caught
HResult=-2147024894
Message=Could not load file or assembly 'ABCD, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Source=NP
FileName=ABCD, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
FusionLog==== Pre-bind state information ===
LOG: User = MyCompany\MyName
LOG: DisplayName = ABCD, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/Users/MyName/Documents/Visual Studio 2012/Projects/MyProgram/Analysis/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : NP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\MyName\Documents\Visual Studio 2012\Projects\MyProgram\Analysis\bin\Debug\Analysis.vshost.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/MyName/Documents/Visual Studio 2012/Projects/MyProgram/Analysis/bin/Debug/ABCD.DLL.
LOG: Attempting download of new URL file:///C:/Users/MyName/Documents/Visual Studio 2012/Projects/MyProgram/Analysis/bin/Debug/ABCD/ABCD.DLL.
LOG: Attempting download of new URL file:///C:/Users/MyName/Documents/Visual Studio 2012/Projects/MyProgram/Analysis/bin/Debug/ABCD.EXE.
LOG: Attempting download of new URL file:///C:/Users/MyName/Documents/Visual Studio 2012/Projects/MyProgram/Analysis/bin/Debug/ABCD/ABCD.EXE.
StackTrace:
at NewProject.DATA.SetType(NP np, String code, OrderType orderT, MODEL MODELv)
at NewProject.DATA.SetData(NP np, String no, String type, String law, String time, OrderType orderT, MODEL MODELv)
InnerException:
分析是我的创业项目。 NewProject是我最近添加到我的解决方案中的项目。 ABCD.dll被引用在NewProject中,但是ABCD项目本身不是解决方案的一部分。
在这个错误中,它说AppBase是file:///C:/Users/MyName/Documents/Visual Studio 2012/Projects/MyProgram/Analysis/bin/Debug/
然而,当我查看NewProject中ABCD的引用时,它说:
Assembly ABCD
C:\Users\MyName\Documents\Visual Studio 2012\Projects\np\bin\ABCD.dll
实际上,ABCD.dll并不在错误中写的AppBase地址中。但我从来没有说过它在那里,也不明白这个错误是从哪里来的。
我曾试图将ABCD.dll放入错误给出的AppBase地址。但每次我重建NewProject和(然后)我的启动项目Analysis后,ABCD.dll都会从C:/Users/MyName/Documents/Visual Studio 2012/Projects/MyProgram/Analysis/bin/Debug/中消失。
我对Visual Studio非常陌生。当添加我的新项目时,我可能做错了什么,但我无法理解具体是什么。如果您有任何关于解决此问题的方法,请不要犹豫,告诉我!