Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 717 Vote(s) - 3.49 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dependent DLL is not getting copied to the build output folder in Visual Studio

#1
I have a visual studio solution.
I have many projects in the solution.
There is one main project which acts as the start up and uses other projects.
There is one project say "ProjectX". Its reference is added to main project.
The ProjectX references another .NET dll (say abc.dll) that isn't part of the solution.

Now this abc.dll should be copied to bin/debug folder of main project, but it isn't getting copied there. Why is it not getting copied, any known reasons ?

Reply

#2
Yes, you'll need to set `Copy Local` to `true`. However, **I'm pretty sure** you'll also need to reference that assembly from the main project and set `Copy Local` to `true` as well - it doesn't just get copied from a dependent assembly.

You can get to the `Copy Local` property by clicking on the assembly under `References` and pressing F4.
Reply

#3
Ran into this same issue. Background info: before building, I had added a new Project X to the solution. Project Y depended on Project X and Project A, B, C depended on Project Y.

Build errors were that Project A, B, C, Y, and X dlls could not be found.

**Root cause was that newly created Project X targeted .NET 4.5 while the rest of the solution projects targeted .NET 4.5.1.** Project X didn't build causing the rest of the Projects to not build either.

**Make sure any newly added Projects target the same .NET version as the rest of the solution.**
Reply

#4
You may set both the main project and ProjectX's build output path to the same folder, then you can get all the dlls you need in that folder.
Reply

#5
Just a sidenote to Overlord Zurg's answer.

I've added the dummy reference this way, and it worked in Debug mode:

public class DummyClass
{
private static void Dummy()
{
var dummy = typeof(AbcDll.AnyClass);
}
}

But in Release mode, the dependent dll still did not get copied. <br />
This worked however:

public class DummyClass
{
private static void Dummy()
{
Action<Type> noop = _ => {};
var dummy = typeof(AbcDll.AnyClass);
noop(dummy);
}
}

This infomation actually costed me hours to figure out, so I thought I share it.
Reply

#6
You could also check to make sure the DLLs you're looking for aren't included in the GAC. I believe Visual Studio is being smart about not copying those files if it already exists in the GAC on the build machine.

I recently ran in this situation where I'd been testing an SSIS package that needed assemblies to exist in the GAC. I'd since forgotten that and was wondering why those DLLs weren't coming out during a build.

To check what's in the GAC (from a Visual Studio Developer Command Prompt):

gacutil -l

Or output to a file to make it easier to read:

gacutil -l > output.txt
notepad.exe output.txt

To remove an assembly:

gacutil -u MyProjectAssemblyName


*I should also note, that once I removed the files from the GAC they were correctly output in the \bin directory after a build (Even for assemblies that were not directly referenced in the root project). This was on Visual Studio 2013 Update 5.*
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through