What are Redistributable DLLs - redistributable

Can anyone explain what are redistributable DLLs?
What dlls should be marked as redistributable?
I'm working on a project where I've introduced new dependency on some DLLs.
And when the program is installed, I want the DLLs to be installed as well.
But I'm not sure if I should mark them as redistributable.

Related

How to include VC++ Redistributable Files Needed by CEFSharp

Building an application using the CEFSharp browser, works fine on my machine, but crashes on the server with the following error:
System.IO.FileLoadException: A procedure imported by 'CefSharp.Core.dll' could not be loaded.
I’ve seen this problem all over the internet, and the most common solution seems to be installing the VC++ Redistributable. However, I don’t have that access on our production server. In the development server, I tried installing the redistrituable (x86, x64, 2017, and 2013) and nothing made a difference. The computers are 64 bit, but the application is 32bit so I tried everything.
Can someone tell me what files specifically I need to add to the application directory to make CEFSharp work. Section 6 of this document: https://github.com/cefsharp/CefSharp/wiki/Frequently-asked-questions#6-how-do-i-include-the-visual-studio-c-2012-redistributables-on-the-target-app lists directories of files necessary, but I’m using Visual Studio 2017 and don’t have any of these directories on my machine.
Additional Info:
Development machine Windows 10, server 2016 Standard
Build set to x86, have not made any config changes for Any CPU mode
Windows Forms application
CefSharp version 71.0.0 from NuGet (& individually through Package Management Console Simple CefSharp application is missing files at runtime)
Not using any type of package or ClickOnce Deployment, manually
uploading all files from my computer to server
Update:
Although I'm still unable to get CEFSharp to work in my project, I accepted Peter Liapin's answer because it did answer the question I asked. Now I know what files in the VC++ Redistributable to copy to my application folder on the server, I just don't have the specific dlls he mentioned on my computer or on the server.
Additionally, I created a new test Windows forms project with CEFSharp and it worked on the server without the VC++ Redistributable dlls. However, I need the CEFSharp browser to work in a user control referenced by existing application.
The Visual C++ dlls you need to ship with your CefSharp based project:
If you use CefSharp v63.0.3 or below:
msvcp120.dll
msvcr120.dll
If you use CefSharp v65.0.0 or above:
#Example of files for VC++ 2017(141), there will be a few less files for VC++2015(140) and a few more for VC++ 2019(142), copy everything from the `Microsoft.VC14x.CRT` folder where `x` matches the VC++ Version
concrt140.dll
msvcp140.dll
msvcp140_1.dll
msvcp140_2.dll
vccorlib140.dll
vcruntime140.dll
Files can be found on your Dev PC in the:
C:\Windows\System32
C:\Program Files (x86)\Microsoft Visual Studio\[Version]\[Edition]\VC\Redist\MSVC\[Version]\[x64|x86]\Microsoft.VC14x.CRT folder.
See section at bottom if you are having problems finding the files on your machine, they are in slightly different folder structure for VS2015 compared to VS2017/2019
Note, you must have an appropriate version of Visual C++ or Visual Studio installed on your PC, otherwise you would not be able to find them:
Version 120 is installed with C++ Redistributable for Visual Studio
2013
Version 140 is installed with Visual C++ Redistributable for Visual
Studio
2015
Version 141 is installed with Microsoft Visual C++ Redistributable
for Visual Studio
2017
Universal CRT is required by Visual C++, on Windows 10 it is installed by default. Local deployment of the Universal CRT is supported see https://learn.microsoft.com/en-us/cpp/windows/universal-crt-deployment?view=vs-2019#local-deployment
For Windows 7/8/8.1 you will either need the Universal CRT pre installed or deploy the files as per the link above.
To deploy redistributable Visual C++ files, you can use the Visual C++
Redistributable Packages (VCRedist_x86.exe, VCRedist_x64.exe, or
VCRedist_arm.exe) that are included in Visual Studio. In Visual Studio
2017, these files can be found in the Program Files[ (x86)]\Microsoft
Visual Studio\2017\edition\VC\Redist\MSVC\lib-version folder, where
edition is the Visual Studio edition installed, and lib-version is the
version of the libraries to redistribute. In Visual Studio 2015, these
files can be found under your Visual Studio installation directory in
Program Files [(x86)]\Microsoft Visual Studio
version\VC\redist\locale. Another option is to use redistributable
merge modules (.msm files), which in Visual Studio 2017 can be found
in the Program Files [(x86)]\Microsoft Visual
Studio\2017\edition\VC\Redist\MSVC\lib-version\MergeModules\ folder.
In Visual Studio 2015 these can be found in Program Files
[(x86)]\Common Files\Merge Modules. It's also possible to directly
install redistributable Visual C++ DLLs in the application local
folder, which is the folder that contains your executable application
file. For servicing reasons, we do not recommend that you use this
installation location.
As per https://learn.microsoft.com/en-us/cpp/windows/redistributing-visual-cpp-files?view=vs-2019 the locations for VS2015 are slightly different to VS2017/2019.
I had what appears to be the exact same issue, and I was able to get things working by copying msvcp140.dll and vcruntime140.dll into the bin folder of my application. I'm using CEFSharp 75.1.143 with cef.redist.x86 75.1.14.
Seems that Microsoft offers a unified installer for all C++ runtimes versions, from the 2015 to 2022.The installer is available on both 32 or 64bit, depending your architecture.
For details, check the Microsoft Visual C++ Redistributable latest supported downloads article.

How to Publish a Winforms App with SQLite using ClickOnce

I have a small C# WinForms app developed using Visual Studio Community 2015 on Windows 8.1 on a 64-bit computer and targeting .Net Framework 4.5.2 and Any CPU | Prefer 32-bit. (I also tried targeting just x86).
I used NuGet Package Manager to install Entity Framework 6.3.1 and System.Data.SQLite 1.0.101 (which installed System.Data.SQLite, System.Data.SQLite.Core, System.Data.SQLite.EF6, and System.Data.SQLite.Linq), though System.Data.SQLite.Core doesn't show in the project references.
The app runs fine in the VS debugger, but the ClickOnce published version triggers an Unable to load SQLite.Interop.dll exception when installed and run on the same computer.
I don't see any references to SQLite.Interop.dll in Solution Explorer. There are such dlls in both the x86 and x64 Debug folders of the project, but not in the Release folder which is empty. When I try to add a reference to either the x86 or x64 dlls, I get an error saying they could not be added (i.e. inaccessible or not a valid assembly or COM component). All 3 of the SQLite dlls in the project references have Copy Local = true.
I'm guessing the SQLite NuGet install failed to set some project property/reference, but I don't know what that might be, why, and how to get around it. I'm not even sure who's responsible: SQLite, NuGet, Visual Studio, me?
Thanks for any help. Steve
I JUST found a working solution. Read the comment outlined https://github.com/oysteinkrog/SQLite.Net-PCL/issues/158#issuecomment-88163499 <- there
Important piece:
I created new PROJECT folders for x86 and x64. I created the project folders in the project that click-once deploys. That is, the project that produces the executable. I copied the interop files from the bin folder into the new solution folders
Just include x86 and x64 folders in your solition explorer. Then set Copy to local=true. I will create folders with sqlite.interop.dll
Had a similar issue, resolved it by simly creating the x64 and x86 folder on my startup project as follows:
I am using a separate class library project to communicate with the sqlite db. This is where I copied the sqlite.interop.dll files from

msdeploy: deploy reference of reference

is there a way for msdeploy to figure out reference of reference?
for example, i have project B that references project A that references TFS assemblies.
On my dev machine, TFS assemblies are GACed with Visual Studio installation, but my server doesn't have VS installed so it isn't GACed.
msdeploy doesn't seem to understand that it has to copy both assembly A and TFS assemblies that assembly A references.
I believe it is by design that VS ignores 'CopyLocal' if the assembly is GACed and i know that i can work around it by adding the assembly directly into the project but i am looking for more automatic way.
You should use the TFS API Nuget package to reference these assemblies instead of the GAC.
Microsoft.TeamFoundationServer.ExtendedClient

Could not load assembly System.Data.SQLite.dll

I have a perfectly working windows forms C# .NET 4 application that uses a SQLite3 database file to store data and display forms.
When I deploy my app on any machine other then the dev machine, I get an exception thrown and it's message is "Could not load assembly System.Data.SQLite.dll or one of its dependencies. The specified module could not be found."
The System.Data.SQLite.dll reference in the project is set to Copy Local = True. Also, I tried manually loading the assembly with Assembly.LoadFile. The dll is placed in the output directory. I also tried setting the platform target to Any CPU as well as x86, no difference. All machines I am working with are 32-bit. What is the issue here? Why is my application trying to load the assembly and can't find it?
Thanks!
I had the same problem after publishing my program to a separate computer. Installing Microsoft Visual C++ 2010 Redistributable Package (x86) on the separate computer fixed the problem.
Note: the separate computer already had Microsoft Visual C++ 2010 Redistributable Package (x64) installed, the x86 version was needed.
'System.Data.SQLite.dll" requires "msvcr100.dll" which is one of it's Dependencies. This will be available only if you installed latest "Microsoft Visual C++ Redistributable" or any other product which internally provides this.
For example, VS2010 will install C++ Redistributable by default. Thats the reason your application doesnot works in some machine but works in others.
You could try pasting the "msvcr100.dll" in your application bin folder and distribute if you dont want to install VC++ 2010 Redist in all the PC's.
Some of the System.Data.Sqlite.dll modules depend on the "Microsoft Visual C++ 2012 Redistributable Package" .
You can find required dependencies on the official download page : http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki
The answers already given didn't solve my problem. I tried to deploy to a VMware server. The solution that did help where given here: http://sqlite.1065341.n5.nabble.com/System-Data-SQLite-Deployment-Mystery-td71752.html Two methods are described there.
When i install this sqlite-netFx45-setup-bundle-x86-2012-1.0.88.0.exe, my app is able to find the right dll.
The second method is to add the dll to de app.exe.config in the debug or release dir. If you edit this file directly, there is a change VC will overwrite the file.
My main problem was that i installed the sqlite package manually. I didn't use NuGet, because i'm behind a proxy. If you do use Nuget, the information in the app.exe.config will be provided automatically.
Using NuGet behind a proxy is described here: NuGet Behind Proxy

How can I obfuscate a dll when using a Visual Studio deployment project?

I need to obfuscate a dll that is used in a ASP.NET project, the deployment project pruduces a setup.exe which I want to distribute. I have the VS 2008 Dotfuscator installed but when I build the deployment project the project that creates the dll is rebuilt before it is added to the deployment project and added to the setup.exe. Any suggestions on how I can get round this?
Many thanks
Lee
Just set the dependencies using project references.

Resources