I'm currently having an issue with "Probing" dlls from another folder. Specifically the C++ Redistributable files that my application is dependent on and that I have just included in my folder to avoid having to run an installer.
The application runs successfully if these files are in the same folder as the exe:
msvcp110.dll
msvcp120.dll
msvcp140.dll
msvcr110.dll
msvcr120.dll
vcruntime140.dll
However when I in my App.config of my application try to probe dlls to 2 other folders, none of them is loaded upon execution of the .exe.
<probing privatePath="DataResources/cefsharp;DataResources/miscellaneous" />
The DLLS are located in the DataResources/miscellaneous folder. The DLLS from DataResources/cefsharp (which are some of my other dlls) ARE loaded however.
Does anyone know what the issue could be?
Thank you very much!
So it turns out that when it comes to these files, CefSharp is dependent on them being in the exact same folder as the CefSharp files themself. In my case, moving these files to the CefSharp folder did the trick.
This is probably not the case in others circumstances but if you are using CefSharp are having this same exact problem, that's why.
Related
I was in hot pursuit of a big mystery in a Visual Studio 2022 C# testing project that I didn't originally create. I couldn't figure out how a certain EXE in a folder was making its way into the bin folder when I did a build. This EXE was not being produced by the build, but was part of an external tool that happened to be in a Lib folder within the solution folder. I had removed a reference to this EXE from the csproj file and thought everything was good to go to prevent it from being copied to bin. However, every time I would do a build, that same exe file would still get copied to my bin folder. I could not figure out for the life of me how this EXE file was getting copied into the bin folder. There was a DLL that I was using that the EXE also uses, but I didn't think including that DLL in my project would cause the EXE to get copied with it.
Finally I decided to create a dummy file in the bin folder with the same EXE name and make it read-only. I did the build and suddenly a file-write error occurred in C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets file.
So, I had found the culprit, but then it raised a question..., What exactly is C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets doing? Is it somehow automatically copying files into the bin folder? Seems like there is some black magic going on behind the scenes at it is confusing the heck out of me!
I'm using Accord.video.ffmpeg.x64. My project is built in x64 as well. It is a click once windows forms application. I installed accord through nuget. C++ redistributor is installed.
Everything works fine when I run the program from debug. But when I publish it and try to run it (on the same machine or any other machine) I get the error "could not load file or assembly 'accord.video.ffmpeg.x64.dll' or one of its dependencies."
Thank you for any help you can provide.
Install on the machine both
vc_redist-2015.x64.exe
vc_redist-2015.x86.exe
and copy all files from your Nuget packages folders
packages\Accord.Video.FFMPEG.x64.3.8.0\lib\net(Version)
packages\Accord.Video.FFMPEG.x64.3.8.0\build
to the installation folder of your application.
I had the same issue this week, but I found the solution! When I compared the files in the bin folder vs the application directory under programs files, the bin folder had 8 additional files that weren't in the application installed folder:
avcodec-57.dll,
avdevice-57.dll,
avfilter-6.dll,
avformat-57.dll,
avutil-55.dll,
postproc-54.dll,
swresample-2.dll,
swscale-4.dll,
These files need to be copied into the application install folder. They can't be referenced since they aren't .net they are c++ dll. So what I did was added the dll files directly to my project , then right click each file properties and for build action I selected "content", then for copy to output directory, I put "copy if newer." This fixed the issue for me, so I hope it works for you too!
I Created a WCF Service and added a dll file as a reference and i am getting the error mentioned in the title during runtime.
Created a WPF application and added the same dll file as a reference but it worked.
The dll file has other references that i added manually in the bin/debug folder of the wpf app.
When i try to do the same for WCF service it is not working.
Please help me figure it out.
I am new to C#. Unfortunately no one answered it, i found solution myself after three hours :(.
A dll file will always be used by an exe file.
In this case the exe was in the folder C:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0 which is the folder for ASP.NET development server.
So the dependent dll files need to be copied there. Copying to the bin folder will not work.
I am writing an add-in dll in c#, VS2012, Win 7 x64. Debugging has been fine; VS registers the dll at the end of building and I've also set up a batch files in my project folder to register and unregister the assembly.
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe" /codebase ".\bin\Debug\MyAddin.dll"
This will work every time. FYI my development files are also on a network drive and they will register. Even changing to an absolute file path for the dll works.
Now I am working on deploying the add-in, so I'm starting with WIX to create the installer MSI to put the files in the correct install folder. This is where I start getting the RA0000 "Unable to locate input assembly 'MyAddin.dll' or one of its dependencies." error from regasm.exe when I run from a batch file in in my project folder to register the files once they are installed.
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe" /codebase "C:\Program Files\Suite Folder\Product Folder\MyAddin.dll"
This never works. I could see if regasm never worked, but anywhere outside of the output folder won't. So here is what I've tried so far.
Since my Debug output folder has other files like the .tlb and other stuff I started deleting them one by one all the way down to my add-in and the dependent .dlls. Just to verify what files are really needed to register in the output folder.
I thought maybe WIX was not creating the files correctly so I copied all the files including the .tlb and others from my output folder into the install folder (I know these should not impact anything but just to be thorough)
I've unregistered the dll after VS builds thinking that more than one register was the problem.
Tried running regasm from within the install folder directly so it could find all dependencies there.
Made sure all of my dlls are x64 platform.
Tried all lines from batch files in CMD window (w/ and w/o run as admin).
File attributes from output to install folder are the same.
Any ideas?
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.