Publish dll - copy to bin folder - c#

MVC project.
On my data access layer I have a libs folder where I store some dlls that the project needs t oaccess data. One of them is set "copy local" to true. The goal is to copy the dll to the bin folder so I can deploy it with the application.
The thing is, when I build the app, it does copy to the bin folder, but to the bin folder on the DAL project only. Since it is a web applicaiton I want to build the web project and have the dll copied to its bin folder so I can just deploy it withou having to manually coping it from the bin on the dal to the bin of the deployed appliation.
What do I need to do to accomplish that?

Build Action = Content might help; but then it will only come in to your DAL Bin if it is referenced there.

You can right click on the web project and than click on Deployment project as given below ..this will add all required dll for your project in the path of your poject which you can see in ouput window

Related

Publish a file from an included project to App_Data

I have an mvc project (A) and this has a reference to another project (B) which includes a specific dll. I need this dll to be published to the app_data folder of any project which references project B.
I have tried setting it's build action, and the copy to output directory, but this doesn't seem to help. I've made sure the app_data folder exists on the server, and can publish files which are directly in the app_data folder of project A.
i have met this problem. I solve like that; move manually app_data files in publish folder. If App_Data folder exist in publish folder copy and paste from project to publish folder. If not exist create manullay.
Keep the "copy to output directory" but note that will only put the dll in the bin output folder. However, from there you can copy it to App_data after the build: in the project properties, select the Build Events tab and add this to the post-build events (updating for your dll):
xcopy "$(ProjectDir)$(OutDir)your.dll" "$(ProjectDir)App_Data\" /Y

Can't copy XML on Clickonce deployment

I have a solution with 2 projects:
MainSolution
Project A
Project B
Folder A
Settings.xml (Embedded R.->Copy Always)
But when I try to deploy it over ClickOnce, I got an error when the app starts, something like: "Could not find the .xml file", so the problem is basically that in the deployment part the file is not copied over the output directory.
I tried to:
*Change the output dir from my project B to the bin\debug in project A
*I included my project B as required in the app files for project A in the publish setting of my main project (Project A).
PS: The error is obtained when I tried to retrieve my settings in the fiel, I tried to use:
*Application.StartupPath + "\Folder\Settings.xml
*Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName) + "\Project B\Folder\Settings.xml"
Thanks, regards.
There is no "Project B" folder. When the application is deployed, everything would be in the "Project A' folder. Also, you have indicated that "settings.xml" file is an "Embedded Resource". Therefore that resource will be available via Assembly.GetManifestResourceStream Method.

Including bin subfolders in ASP.NET Deployment

I have an ASP.NET MVC 3 web-application with post-build build events that copies some interop dll's into subfolders of bin as follows
bin\x86\Sqlite.interop.dll
bin\x64\Sqlite.interpo.dll
When I deploy this project onto the web-server, it does not copy the x86 or x64 subfolders.
How can I make the deployment copy those two sub-folders?
I've tried including the files in the project with "copy to output folder" setting, but this does not copy to a subfolder, only to bin. I need to publish both subfolders all the time.
In case you have common DAL assembly you can perform a such trick:
Embedd native dll's to your assembly as resources
Create static constructor to your 'entry point' class (Session, SessionFactory, etc.) and save to FS native dll's if necessary from this constructor
Update:
Also you can add to your project all native dll's. Mark them as Content and Copy Always. In this case they will be deployed with your service

How Are References Handled in a VS2008 Website?

I'm creating a web service that uses multiple DLLs, some of which are projects that I have developed and others are external DLLs. Those that are external, I have simply copied into the Bin directory of my WebService. However, those that are from my own projects I have added as references by right clicking on the bin folder and selecting add reference. This adds both a dll and a pdb file to the bin folder. However, when I build the website, I am not sure where these two files are pulled from. I need to know because I am trying to encrypt these DLLs as a post build step on the web service and I need to know where I can find the DLL I should encrypt. Need any more information let me know.
If the files are part of another project in your solution, then open the project folder for those projects (right click on the project node in VS and choose "Open In Explorer..."). There is a bin directory in that folder that the assembly for that project is placed in after it is built. When the web site project is built, the assembly is copied from this bin folder into the bin folder for the web site.
EDIT
As discovered (in the comments to this answer), VS actually copies assemblies from the obj directory rather than the bin directory.

Referencing XML file in a referenced project?

I have a utility project that has an "XML" folder with two XML files in it, this project is then referenced by an ASP.net web project. I was wondering do you have to set some sort of build option to place the folder in the BIN of the website, or is there another approach to referencing these two files from the web project?
Thanks
Select one of the XML file in the solution explorer, then in the properties list you should see a property called "Copy to Output Directory", set this to "Always Copy".
Do this for both files.
That should then bring the files into the referencing projects bin folder.

Categories