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.
Related
I have 3-layer MVVM project, my solution folder, DLL folder and BLL folder are inside 'source > repos >' and project loads normally
But if I move BLL or DLL(or both) to some other folder, or Desktop for example, my project doesn't load correctly and file moved to Desktop defined as not founded in solution explorer
How could I fix it? I need put all this three project folders(DLL, BLL, View) to one folder, because I need to share it as one big project, but I can't, because any movement with files or folder finishes with error 'Files not founded'
Sadly can not send images here, in y question(
Thanks in advance for your answers!
Check for that in your project: is it in the references list? If it is, check that it's built for the same CPU type as your project, and that the Reference properties option "Copy Local" is set to true.
If it isn't, try adding it. If that works, try rebuilding. If it doesn't, then it's probably a Native Library, and you need to ensure that the DLL is either in the EXE folder, or in a folder on the current PATH that Windows uses to locate executables.
You Need to compile the DLL project into a dll file and then refer to the compiled dll file.
Or just use project references to add your DLL project and BLL project.
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.
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"
In my solution I reference DLLs file from Libs folder. When I publishe application they don't copy to published folder. Is there anyway to make them to be copied too?
You should put your DLLs in the Bin folder.
The publisher will copy that folder.
In addition to Slaks I would say, in order to have DLL in bin or
Set CopyLocal property if linked reference to True.
Or
Use postbuild event to achieve the same.
I have a C# project that has multiple folders: Folder1, Folder2.
I added a shortcut in 'Folder1' to an xml file that is already in 'Folder2'. In this case when I compile the project the xml file will I have two copies in the assembly?
You were not clear with your description - did you reference the file with a shortcut, or did you add it to Folder1 by using the VS Solution Explorer and adding an existing item as a link?
The two methods are quite different. If you simply went into the filesystem and added a shortcut, then that is not automatically part of the project unless you specifically add it. And if you did add it, then it obviously can't be compiled, the best you could do is just have it set to No Compile and copy to the output directory.
If you added the file to folder one via the VS solution explorer and added it as a link, then it will be part of the project, and will be included twice, but it will be placed in Folder1 under the bin/debug or bin/release folder upon building. There will be no clash because they are in different folders, and they are not compiled, simply copied to the folder structure under the output directory.
Edit: and it won't be part of the assembly unless you set it to be a Resource or Embedded Resource. If you do that then yes, it will be in the assembly, but under two different resource paths.
In the Properties(context menu) of the selected file in the Solution Explorer change Build Action property to No Compile.