I’m working on a C# code on Visual Studio 2012 on Windows 7. My solution contains several projects.
I recently added a new project in my solution, and added the dll of this new project in the references of 2 other projects in the solution (one of the being the startup project). The new project itself is referencing to several other projects that are not included in my solution.
Building the projects in the solution works fine, but when I try to run the program (in Debug or in Release) I get an error. Here is the error:
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:
Analysis is my startup project. NewProject is the project I added recently to my solution. ABCD.dll is referenced in NewProject, but the project ABCD is not part of the solution itself.
In this error, it is said that the AppBase is file:///C:/Users/MyName/Documents/Visual Studio 2012/Projects/MyProgram/Analysis/bin/Debug/
However, when I look at the ABCD reference in NewProject, it says:
Assembly ABCD
C:\Users\MyName\Documents\Visual Studio 2012\Projects\np\bin\ABCD.dll
Indeed, ABCD.dll in not in the AppBase address written in the error. But I never said it was there, and I don’t understand where this comes from.
I tried to put ABCD.dll in the AppBase address the error is giving me. But each time I rebuild NewProject and (then) my startup project Analysis, ABCD.dll disappears from C:/Users/MyName/Documents/Visual Studio 2012/Projects/MyProgram/Analysis/bin/Debug/
I am quite new to Visual Studio. I probably did something wrong when adding my new project but I can’t understand what it is. If one of you has an idea regarding the method to solve this issue, please don’t hesitate to speak !