add reference to msvcr90.dll in .net project - c#

One of our self hosted customer, do not have the public installation of msvcr90.dll. In order to make our app work on their machine, after each deployment we manually add msvcr90.dll and Microsoft.VC90.crt file in our app folder. and this requires a restart of the machine. is there a way I can add these two files in the project and make my project reference these files? I tried adding msvcr.dll in the project but I am getting following error:
"A reference to msvcr90.dll could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component."

I have that problem before same as yours but all i do is, Set the project to run as Administrator account and inside of the project, i manually code to copy the dll in system32 folder and it worked fine.
All DLL's can't be added into VS project. It depends on what framework, versions of DLL's came from. If not meet the requirements then VS project won't accept on it.

Related

BLL and DLL are not founded, when I move them somewhere except source repos(Visual Studio 2019)

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.

Getting error "Unable to load DLL 'SQLite.Interop.dll'" despite it being in the bin folder

I have a ASP.Net Web Project and used NuGet to include System.Data.SQLite.
That shows under my references but when I publish my app (via "File System") and go to the controller "http://localhost/api/test", it shows the error:
Unable to load DLL 'SQLite.Interop.dll' The specified module could not be found.
I noticed, in my project's bin\Release\net452\win7-x86\x64 the DLL is there, but in the website's actual bin folder, the interop dll is not there!
How do i get it to be included? (I tried adding it as a reference and it wouldn't let me)
Find the location of the interop.dll and add it to the project, then select copy always. This will force the publishing profile to copy it to your deployment.

C# Web Api/ MVC.net not loading assemblies properly

I'm new to C# and .net in general, and I need to use it to work with the SDK for a major piece of software we use.
I can add the assemblies they tell me to add in a console application and everything works fine. When I try to add them to any web application (either MVC or WebAPI), I keep getting errors saying other assemblies are missing. Eventually I just added every assembly/reference (not sure the correct term for this, pretty much just .dll files) in the sdk folder and now it is working. This definitely cannot be the correct way to do this.
Is there something I am missing that allows assemblies/references to load other assemblies/references, or is something else the cause of my issue?
UPDATE:
The exceptions are usually something like this:
Could not load file or assembly 'Server, Version=1.5.1.0, Culture=neutral, PublicKeyToken=d11ef57bba4acf91' or one of its dependencies. The system cannot find the file specified.
And it does not occur during build, only when the function is actually being called from the web application( in my case, since it's an api, when I visit the URL that returns my JSON data)
You can use a tool called "IL Disassembler" that is installed along with Visual Studio to see what other dependencies the SDK's Assembly depends on.
The install location may vary but mine is here...
"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\ildasm.exe"
Drag and drop the SDK's assembly that you are using onto the tool and click the manifest field. A dialog will open with the other assemblies that you'll need to include.
If your console application works but the web application does not then the exception should specify which assembly is missing.
Compare you console output directory with the output directory of you web build. Make sure the dll that is required is being deployed to the web directory you are running.
In visual studio with your web project find the assembly under references and select it. Make sure that the property "Copy Local" is set to TRUE.

C# reference that requires additional files

I'm having a problem with a third party C# class library:
The given .net dll requires additional files to be in the same directory than the .dll (config files etc.).
When I load the library as reference into asp.net project everything works smoothly until first call to the library. I get exceptions from the library saying that the required files are missing.
Now the question is where should I put those required files into? I've tried obj/debug/, bin/ and including the files in the project and selecting "Always copy to output directory", but none helped.
I guess it's something to do with IIS and its way of handling the reference/additional files?
Edit: It's working fine in Windows Forms application, but not in ASP.NET web application.
You can view source code of external class library with iLSpy or Reflector to find how exactly additional files are referenced.
It's can be an application execute path (so it must be IIS shadow copy directory) or GAC.
For that you need to read the documentation. The method throwing the error should be expecting the file in some other folder other than bin, debug or obj.

Teamcity/c# build doesn't copy my DLL to the bin folder

I have a C++ wrapper DLL added to one of my projects, the proect is my "Set as startup" project.
To do this I just right clicked on the project and did "Add exisitng item" and then in the properties I have
Build Action = None
Copy to Output Directory = Copy always
The code in this project does not directly use this dll, it's used in another project that's part of the solution and I cannot add it to the References as it's not a proper .NET dll.
My TeamCity build doesn't include this dll when it builds my project and I don't know why. I changed the build script so that it just copies the dll from a location to the bin folder but that doesn't work, when I run my app I get a run time error "could not find dll" even though I can actually see it in the bin folder.
So I cannot just copy it to the bin folder, I need to tell Team City to include that dll when the project is built, as it does when I compile it from Visual Studio
So my question is how can I tell Team City to include the dll when it complies my project?
I'm using VS2010, .NET 4

Categories

Resources