Error message when you try to build a Visual Basic .NET or Visual Basic 2005 project: "The Dependency <DLL> in <ProjectName> cannot be copied to the run directory because it would overwrite the reference <DLL>" (814197)
The information in this article applies to:
- Microsoft Visual Basic 2005
- Microsoft Visual Basic .NET (2003)
- Microsoft Visual Basic .NET (2002)
SYMPTOMSIn Microsoft Visual Studio .NET or Microsoft Visual Studio 2005, when you try to build a
Microsoft Visual Basic .NET or Microsoft Visual Basic 2005 project that has references to different versions
of the same DLL, you may receive the following
error message in the Task List window: The dependency
<DLL> in <ProjectName>
cannot be copied to the run directory because it would overwrite the reference
<DLL>. Note In this error message, DLL is a placeholder for the
DLL name, including the version information. Also, ProjectName is a placeholder for
the Visual Basic .NET or Visual Basic 2005 project name. CAUSEWhen you try to build a Visual Basic .NET or Visual Basic 2005 project that has
references to different versions of the same DLL, Visual Studio .NET
or Visual Studio 2005 copies one version of the DLL to the run directory. When Visual Studio .NET
or Visual Studio 2005 tries to copy another version of this DLL to the same directory, you receive
the error message that is mentioned in the "Symptoms" section of this
article.RESOLUTIONTo resolve this problem, complete one of the following procedures. Set the Copy Local property to False- Copy two different versions of the same DLL to
subfolders of the Windows Application project output directory.
- Add references to the different versions of the same DLL in your Windows Application Project.
- Set the Copy Local property to False.
Install the DLLs in the Global Assembly Cache (GAC)- Type the following commands at the Visual Studio .NET or Visual Studio 2005 command prompt to install two different versions of the same DLL in GAC:
- gacutil -i
DLLName
Note DLLName is a placeholder for the name of the DLL that is generated when you reference the original version of your DLL. - gacutil -i
DLLName
Note You use the same name that you used to install the original version of your DLL. Run this command from the directory that contains the modified version of your DLL.
- Add references to the two different versions of the same DLL in your Windows Application project.
STATUS This
behavior is by design.REFERENCESFor more information, visit the following Microsoft Web
site:
Modification Type: | Minor | Last Reviewed: | 10/3/2006 |
---|
Keywords: | kbvs2005swept kbvs2005applies kbProd2Web kbDLL kbprb KB814197 kbAudDeveloper |
---|
|