Placing dlls in bin directory after successfull build - c#

I was working on a project , I needed to add a folder inside my application which consists some usefull dlls
under properties of my dll , I have changed the Copy to output directory field to copy always
On successfull build of my project I am getting the bin folder as :
After building the project I found out that my dll is placed inside DLL folder
but I do not want such folder , I want it to be inside the bin folder only , how can I achieve that.

simply delete the dll folder in both vs and the windows folder, then add them as references for your project and set there properties to copy always
you still may copy them manually the first time to make sure everything is going just fine

IF the project has a reference to the DLL already VS will copy the dll to the bin folder.

Related

How to load Dlls into a customized folder instead of the bin folder in C# when we publish

I have a simple Asp.Net web app. When I right click on project and publish it, a folder named bin is created in the project's location with some DLLs in it. Instead of bin, I want to load the DLLs into my customized folder called mydllfolder and I want mydllfolder in place of the bin folder.

VS2013: never put bin directory in source control, but it caused build fail

I'm new in Visual Studio 2013 (C#). I know in general it should be avoid putting bin directory in source control. However, in my bin directory, there are lots of dll files. Without this dlls, I can't build my project.
I thought maybe I should create a directory, such as 'lib' to store the dlls. But the fact is NuGet always put dll into the bin directory. Should I manually move the dll from bin to lib?
All I want is to simply put all source codes, resource files and dll files to source control (git). Then my team-mates can pull the project then build it in their machine.
edit on 1/4/2015: provide further details
For example, I installed log4net thru NuGet. After finished, I found 3 new files existed in bin directory:
log4net.dll
log4net.xml
log4net.dll.refresh
I tried to remove bin directory from my project, then rebuild my project, and hope to see that a new bin directory would be built and all dll/pdb/etc files would come back. But unfortunately it didn't happen.
In my understanding, the ideal process would be:
add reference/install package, then certain config info would be recorded and according files would be installed to bin directory;
when build, according lib files would be referenced from bin, if such files not found, VS would get the reference info from some place other than bin and download them again. So that's one of the reasons why we don't need to put bin into source control.
However, I found that's not true in my project.
Actually according to the official .gitignore, I found bin directory as build results is filtered ([Bb]in/). That is to say, even VS knows such directory should be ignored.
Maybe some wrong setting within my project?

adding a references folder to a project VS2012

I have two dll files which should be always in the bin/debug folder at runtime, I can add one of them as a reference, but the other one gives an error about that it is not being accessible, but whenever I added to the bin/debug file manually it works fine.
What I want to do now is I created a Lib folder which contains the two dll files, but I want to the whole folder as a reference so whenever the project runs the folder is directly linked.
Any suggestions?
Although you can't reference a directory, you can reference a project - I suspect this is what you want. That should also resolve itself as you update the binaries.
If you just want to have another file being copied to the bin folder of your project, add the file to your project, go to properties set Copy to Output Directory to Copy Always
Have you tried setting "Copy local" for this dlls to true?
I think what you want to do is add the the two dlls to your solution as content, and then set both to copy to output directory set to true. You can do this by looking at the properties of the included dll.

how to set the folder of destination when I use local copy?

I have a project in Visual Studio 2010 and in this project I have a "lib" foleder in which I have the external dll that I need. In this case, the libraries of SQLite.
Well, I can set hte reference to the principal dlls, SQLite.dll and SQLite.Linq.dll. In this case, the dll are copy in the main folder of the application.
However, I need also the SQLiteinterop.dll. I have tried to add a reference to this dll, but I get the error that it is not a valid COM component. So the way that I find to copy the dll is marked as local copy in the properties of the dll that is in the "lib" folder.
However, this copies the dll in a subfolder "lib" in the main application folder and I need to copy in the main folder.
Is there any way to set in visual studio where to copy each dll?
Thanks.
I would suggest using a Build Event, retrievable in the Properties of the Project.
Here you can make a Post-build event which copies the file to the Build folder.
Something like:
copy /Y "$(SolutionDir)lib\$(ProjectName)\sqllitefile.dll" "$(TargetDir)\$(ProjectName)\sqllitefile.dll"

Teamcity/c# build doesn't copy my DLL to the bin folder

I have a C++ wrapper DLL added to one of my projects, the proect is my "Set as startup" project.
To do this I just right clicked on the project and did "Add exisitng item" and then in the properties I have
Build Action = None
Copy to Output Directory = Copy always
The code in this project does not directly use this dll, it's used in another project that's part of the solution and I cannot add it to the References as it's not a proper .NET dll.
My TeamCity build doesn't include this dll when it builds my project and I don't know why. I changed the build script so that it just copies the dll from a location to the bin folder but that doesn't work, when I run my app I get a run time error "could not find dll" even though I can actually see it in the bin folder.
So I cannot just copy it to the bin folder, I need to tell Team City to include that dll when the project is built, as it does when I compile it from Visual Studio
So my question is how can I tell Team City to include the dll when it complies my project?
I'm using VS2010, .NET 4

Categories

Resources