Including bin subfolders in ASP.NET Deployment - c#

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

Related

How to get file path of the file contained in dll file

I have library "library.dll" where is something like that in the code:
PathModifier.AddEnvironmentPath("lib\\dlls", PathModifyMode.RelativeToProjectDirectory);
In this "dlls" folder are *.dll files (cca 20 files) which need to be added to Environment path. Properties of these files are set up like this:
Copy to Output Directiory: Do not copy and
Build Action: Resource
Library has about 30 MB, so dll files are contained in.
When I use this library in WPF project, there is problem, because
it try to find "lib\dlls" in WPF project directory instead of inside the "library.dll".
Is there any solution, how to say "find dlls folder only inside library, not in project, where is library used"?
Thanks.
If you are trying to centrilize the dependencies, then you should take a look at my answer here Nuget common folder. The idea is the same as saving all Nuget packages, all your dependencies should point to the same place, on this case the Common folder. On the Nuget scenario, you need to add an extra configuration to restore all packages from there and seed the nuget repository from that location.
In your case I think that the WPF project is looking inside the bin folder, and because you have the resources as Do not copy, then you can't find them inside, if you change that Copy Always will bring those dependencies inside your bin folder.

Download the project from a repository without losing any project files. Sourcetree

When I upload a project from the local machine to the server repository, and try to download it from the server to another machine I am always missing some .dll files and cannot build the project?
It sounds like you're likely keeping externally needed DLLs in your bin folder, which would not be added to (many) source controls by default, as the DLLs in your bin folder get updated after each build.
The not adding bin to source is the correct route, you have a few options on what what you would need to do:
Use nuget packages that get restored automatically during build
add the DLLS to a separate folder (I like to use "extLib" or "3rdParty" as my folder name, and add that to source, referencing the DLLs in the separate folder.
ensure all machines have required DLLs/SDKs installed on the machine
They are listed in (my) order of preference, but that's just my own opinion.
Probably because repo's ignore file is ignoring those file types. Check you .gitignore file in the root of the repo.

Publish dll - copy to bin folder

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

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.

Find out all the files required to run a c# application

I need to generate a list of all the files which are enough to run my application on any machine. I need this for a setup program. When i go to bin/release folder i'm able to see some pdb files and some configuration files, which i think will not be needed. I tried to disable generation of pdb files too but it still generates pdb for the other projects present in the solution.
So i need a way in visual studio 2008, which can get me all the files (the .exe and .dll and other files) required by my application to run.
Thanks.
Have you tried publishing the application (Build > Publish [app])?
This should just copy all the essential files to the specified folder.
The pdb files are used for debugging. Building in "Release" mode should exclude these files.
You can also create a setup project within the solution. Using that project it is possible to see a list of included files.
If you make a release build or publish the application then you should have a complete set of assemblies your application needs.
However, it can still rely on assemblies which reside in the GAC (Global Assembly Cache) of your machine. Check the references of your project if you think there are assemblies missing in the bin folder.
To solve this exact problem with our software, we wrote a simple console app that finds all the .vbproj & .csproj files in our projects directory, then changes all of the to Release mode (which does not create pdb files, documentation files etc).
This is then run by the build machine (CruiseControl.Net) before it starts compiling the projects.

Categories