Deploying assembly normally in the GAC with my project? - c#

I built a web application that uses the J# libraries which works fine in my cpu, however, when I deploy it to my shared server. I get an error message: Parser Error Message: Could not load file or assembly 'vjslib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
So basically, the server doesn't have visual j# installed. The problem is they wont install it because it is a shared server.
Is there a way I can deploy the J# assemblies with my project so that it will work on the shared server without it being registered in the GAC?
Thanks for your help!!

Simplest solution: Try to copy the assemblies your application needs into the same folder where your application resides.
The following MSDN article explains How the Runtime Locates Assemblies.
Also, you may find more options (including copying all J# related dlls into a subfolder of the application folder if needed) in the following link when the runtime cannot find the assembly in the GAC: Locating the Assembly through Codebases or Probing

Without knowing anything about J# I can only suggest that you try just distributing the required libraries along with your program (place them in the same directory), I believe if it can't find the library in the GAC it will revert to look in the current directory.

Related

How do I reference a "Portable" .NET assembly from an Azure Cloud Function?

I've successfully referenced an assembly via Nuget and project.json that is a "Portable" assembly. All my code compiles in the Azure function, but when it's run I get:
Could not load file or assembly 'System.Net, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The system cannot find the file specified.
As I understand it this is the portable version of System.Net, and Azure only preinstalls the 4.6 version of System.Net.
How do I work around this?
This is caused by a bug that has been addressed on the current Azure Functions host milestone and will be deployed with the next release (likely towards the end of the week). You can find more information about the issue and the fix here: https://github.com/Azure/azure-webjobs-sdk-script/issues/478
In the meantime, a workaround would be to copy System.Net from the Framework folder into a bin folder, inside of your function's folder. The host will automatically resolve it as a private assembly.

Sharepoint 2010 Could not load file or assembly 'Microsoft.Office.Server.Search, Version=14.0.0.0

I am working on a webservice(.asmx) file with web methods written to connect and do crud operations to share point 2010 lists,which is consumed by my c# application. When I try to run my asmx file, it throws the below error. I have included all related dlls and also Microsoft.Office.Search dll with same version. I tried lot of research on this part but couldn't find reasonable solution.
I took all dlls from the machine where sharepoint is installed.
I tried this and tried to change platform to X64, tried referring office.server dll, took dlls from C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\
Any idea would really help.
Could not load file or assembly 'Microsoft.Office.Server.Search, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. An attempt was made to load a program with an incorrect format.

.NET exe not picking dll dependencies

I have developed an EXE again :)
The problem is it has refernces of SQLite dll file so I included the file on the same path. Now in Windows 8 it is running fine, but in Windows 7 it is not
The error is
System.IO.FileLoadException: Could not load file or assembly 'System.Data.SQLite, Version=1.0.90.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail. (Exception from HRESULT: 0x800736B1)
File name: 'System.Data.SQLite, Version=1.0.90.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' ---> System.Runtime.InteropServices.COMException (0x800736B1): The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
I did everything I could but it is not running on Windows 7
It's a standalone EXE. No Setup.
EDIT:
This is what application event log says
Activation context generation failed for "C:\System.Data.SQLite.dll". Dependent Assembly Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.6195" could not be found. Please use sxstrace.exe for detailed diagnosis.
I think thats the reason as you mentioned, SQLLite is searching 64 bit dll!
Try to download 64 bit url and pack it with exe
You can download from here
http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki
side-by-side configuration is incorrect
That means Either:
One of your reference DLLS do not match your project target type
Or Your reference DLLS are of mixed target types
Solution:
Make sure your Project is set to build to target x86 for x86 reference DLLs or target x64 for x64 reference DLLs, and the same for the .NET versions
Make sure all your reference DLLs are either all x86 or all x64 versions and not x86 and x64, and the same for the .NET versions
If you are not sure you can use IlSpy to check by right clicking on the reference.
Generally this error indicates that a dependent assembly is missing.
Activation context generation failed for "C:\System.Data.SQLite.dll".
Dependent Assembly
Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.6195"
could not be found. Please use sxstrace.exe for detailed diagnosis.
This assembly is more commonly known as
Microsoft Visual C++ 2005 Redistributable Package (x86)
and can be downloaded from here.
But, often there is another cause. Today, for us, it was "Bit9 Security" which did not like us digitally signing the SQLite.dll assembly on our local machine and uploading the signed assembly to our server application folder with a different time stamp to the rest of the assemblies in the application folder.
The work around was to recompile the application, sign all the assemblies, upload and overwrite the existing application files.

Deleting ReportViewer from .NET web app, something still looking for ReportViewer dll

I have a web app which used ReportViewer, from which I am trying to delete ReportViewer and all its dependencies.
As far as I can see, I have deleted everything I need to and all works fine locally. However, when I deploy to our QA server and run the site, I get the following error:
System.IO.FileNotFoundException: Could not load file or assembly
'Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral,
PublicKeyToken=89845dcd8080cc91' or one of its dependencies.
The system cannot find the file specified.
I suspect that some other dll in the system depends on the ReportViewer.WebForms.dll, but I cannot work out which one. This dll is not referenced directly from anywhere in the app.
Does anyone know what dlls commonly reference ReportViewer.WebForms.dll?
I think the dll's reside in GAC, causing this error. According to MSDN;
When you run ReportViewer.exe, the following files are installed in
the Global Assembly Cache folder on the deployment computer.
Microsoft.ReportViewer.Common.dll
Microsoft.ReportViewer.ProcessingObjectModel.dll
Microsoft.ReportViewer.WebForms.dll
Microsoft.ReportViewer.WinForms.dll
Microsoft.ReportViewer.DataVisualization.dll
Refer http://msdn.microsoft.com/en-us/library/ms251723.aspx for more clarification.

Could not load file or assembly 'log4net'

I am attempting to deploy a Crystal Reports desktop application, but the application is not able to find my log4net assembly, even though I have verified that my installer is registering the log4net DLL in the GAC. Below is the exception and stack trace.
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral,
PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system
cannot find the file specified.
at CrystalDecisions.Shared.SharedUtils..cctor()
I am honestly completely lost as to why this isn't working... The versions are the same and everything. Do I need to configure log4net before this will work?
Editing: I am using InstallShield 2012 to install my application assembly to the GAC. The only other things I am installing are a very small exe that references my dll, and a few files in Program Files folder to handle configuration.
Turns out I was using the same version of the dll, but the one I was using had a different PublicKeyToken. After I fixed that, it worked.
Setting platform to x86 worked for me. Previous was AnyCPU
Assuming that the dll is already in the application folder, go to the properties of the project, click on Application Files and change the dll from "prerequisite" to "include", and save it. It would then be in GAC.

Categories

Resources