We are new to .Net Core and are trying to deploy our first application that uses it. We are deploying to a Windows server which has .NET Core Windows Server Hosting Module (2.2.0), the .NET Core Runtime (2.2.0) and I even installed the SDK (2.2.103) to see if that could solve the problem, which it did not.
Error:
An assembly specified in the application dependencies manifest (accesslog.deps.json) was not found:
package: 'System.Data.SqlClient', version: '4.5.1'
path: 'runtimes/win/lib/netcoreapp2.1/System.Data.SqlClient.dll'
So, here is my issue...the above error is being generated when we try to run a .NET Core application via the "dotnet filename.dll" method. We "publish" the application to generate all needed dependencies, or so I thought. The publish (and thus application) folder contain "A" version of this file (System.Data.SQlClient.dll), but apparently not the right one (version in publish path shows 4.6.26606.5), but yet that is the one being generated by Visual Studio.
Oddly, we also have an ASP.NET application on this same server which runs fine and references the same file.
Any help, guidance, troubleshooting steps, etc would be GREATLY appreciated.
I'm trying to use Visual Studio to develop and debug a web application that uses the SharePoint 2007 API. I have been doing this fine on a 32-bit server up until now. Today I've moved over to a 64-bit development server and when I try to run the project out of VS, I get:
Could not load file or assembly 'Microsoft.SharePoint.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. An attempt was made to load a program with an incorrect format.
I have referenced Microsoft.SharePoint.dll and Microsoft.SharePoint.intl.dll from the GAC on this machine. That automatically copies in Microsoft.SharePoint.Search.dll from somewhere when I run it (even though copy local is false on the references). My project Platform Target is "Any CPU". I get the same error with x86. If I change to x64, I instead get Could not load file or assembly 'MyProjects.dll'...incorrect format.. I've also tried deleting Microsoft.SharePoint.Search.dll from the bin after it starts up but then I get a SharePoint error saying that the site at my URL can't be found, which I believe is also a bitness issue. I'm not quite sure what the issue is but want to be able to run this application out of Visual Studio. How can I get it working?
You need the x64 (or anyCPU) version of the Sharepoint dlls to make it work
Both Microsoft.SharePoint.dll and Microsoft.SharePoint.intl.dll in the server's GAC are built for Any CPU. When I build my web app in Visual Studio, it automatically copies Microsoft.SharePoint.Search.dll into my bin, presumably because it's referenced by Microsoft.SharePoint.dll. SharePoint.Search.dll is not in the GAC. It is copied from the 64-bit 12\ISAPI directory and is built with an "Amd64" target architecture (despite my server having an Intel Xeon CPU). So I believe the problem is VS runs the web app in a 32-bit process which causes the error when it tries to load the 64-bit SharePoint.Search.dll.
My first idea was to explicitly reference the 32-bit SharePoint.Search.dll in my project. That makes the error go away but it is replaced with an error saying the website at [my SharePoint site URL] cannot be found. I believe this is because now I'm trying to access the SharePoint site, which runs in a 64-bit app pool, from a 32-bit process. So what I really need is for Visual Studio to run my web app using a 64-bit hosting process. This looks like an option available for VS 2012, but not 2010. The alternatives I've found for VS 2010 are:
On the project properties Web tab, configure it to run using the Local IIS instance. This will add a virtual directory to the default site, which is running in 64-bit mode by default. This isn't a good solution for me because I want to allow multiple developers to work on the same project on the same server simultaneously. Using the same site would cause conflicts. If there were a way to configure the site name conditionally on the user, this would be ok. I opted to try #2 first.
Replace the VS Development Server with an x64 build of the CassiniDev project. This project has the capability of plugging in to VS in place of the default WebDev.WebServer.EXE. So you just need to download the source code, and build with an x64 target platform. Then you can replace the VS default development server exe, as is documented w/ the CassiniDev project, and it will run an x64 development web server which solves my problem!
With a windows smart client application, it runs fine on my (development) machine, but when I installed it on a user's machine, I get this error:
Requires log4net version 1.2.10 be installed in GAC
On my development machine, I have 2 log4net files that are GACed: one x86, one 64 bit. The user machine has only the x86 version. So I guess the user needs the 64 bit, yes?
If so, how do I install a 64 bit version of log4net?
Note that this is a different error than this:
Error: Could not load log4net assembly
I've discovered another difference. If I publish in Development/Debug configuration, it works. If I publish in Release config, I get the error.
There seems to be no direct log4net references. It is use in either CrystalReports or NHibernate or both.
In Debug Configuration, the application is running as 32bit, in Release Configuration, the application is running as 64bit. If I could get the Release Configuration to run as 32bit, I think that would solve the problem. Can anyone say how that is done?
You can change the Release configuration to x86 in Visual Studio => Project properties => Compile => Advanced Compile options
Check if you have Copy local=true on the log4net reference. If it is false the log4net has to be installed in the GAC, when it is true it is included in the application bin directory.
If you want to install it in the gac you can use gacutil to install the log4net.dll into the gac. Check if you application runs in 64bit (process explorer), if so, you need to install the 64bit version.
I faced similar issue with my ClickOnce application. I tried to put log4net dll in GAC and publish, but didn't work. It was also not related to 32/64 bit version as well.
The solution worked foe me is
Remove and add log4net references in all the required projects from local folder.
Check log4net reference properties and make sure property "CopyLocal=True" for all references. (In my case one of the referenced project was referring log4net with "CopyLocal=False" and thus looking for DLL in GAC)
(For ClickOnce deploy applications) Remove and add referenced DLLs (which refer log4net) in the main project. This will force all the DLLs to be downloaded to client's machine again.
Hope this helps.
I'm using vs2010 and crystal report version 13.0.2000.0 ,system 64bit crystal report runtime 64bit.
my application is running fine on development machine but when i'm deploying on server
getting this error
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.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: 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.
Source of error:
CR:CrystalReportViewer ID="CrystalRportViewrRegistration" runat="server" AutoDataBind="true"
and I have checked GAC assembly I didn't find log4net.dll and even in my system I have search all and tried various things like changing runtime version and uploading lo4net dll from apache but no luck.
To configure IIS to run 32-bit applications you must follow these steps:
Open IIS
Go to current server – > Application Pools
Select the application pool your 32-bit application will run under
Click Advanced setting or Application Pool Default
Set Enable 32-bit Applications to True
If this option is not available to you, follow these next steps:
Go to %windir%\system32\inetsrv\
Execute the appcmd.exe tool:
If you don't see log4net.dll in %systemdrive%\windows\assembly\ on the machine you are attempting to deploy it on, it is likely you haven't successfully installed the redistributable for Crystal Reports for .Net Framework 4.0
Install (or reinstall) the latest service pack from http://scn.sap.com/docs/DOC-7824 (SAP Crystal Reports, developer version for Microsoft Visual Studio Updates & Runtime Downloads)
That runtime distribution should add log4net to the GAC along with a bunch of CrystalDecisions dll's
Ensure version for correct platform (32-bit or 64-bit) is installed. I faced same issue when installed 32-bit run-time on 64-bit machine. Installing correct one, i.e. 64-bit, resolved the issue.
I faced same issue (VS 2015), but my application is running under 32-bit application pool. So even though machine is 64-bit. I installed 32-bit installation and it works.
So in general dll has to be placed in two places:
GAC ( can have 32 and 64 versions of dll's)
your project bin
folder
Thus, you just need add reference to log4net.dll.
(In your case 32-bit with PublicKeyToken=692fbea5521e1304)
You can achive that by
downloading log4net.dll separately and add reference to it
dowloading SAP crystal report SDK (32 bit)
https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads
For this specific error, I installed version 20 of Crystal Report and it solved my problem:
https://www.tektutorialshub.com/crystal-reports/crystal-reports-download-for-visual-studio/#Service-Pack-16
You can also download the file alone using the following link
https://www.nuget.org/api/v2/package/log4net/1.2.10
rename the file to .zip and extract it.
I tried all of that things and it doesn't worked for me.
I Just installed SAPCrystalReport in my computer and it's working now.
To configure IIS to run 32-bit applications you must follow these steps:
Open IIS
Go to current server – > Application Pools
Select the application pool your 32-bit application will run under
Click Advanced setting or Application Pool Default
Set Enable 32-bit Applications to True
This solution worked for me, thanks.
If you are building a windows app try to build as x64 instead of Any CPU. It should work fine.
I was able to resolve this issue using below steps:
Uninstall Crystal reports using 'Add or Remove Programs' on Windows.
Closed all running apps and used this link (https://www.tektutorialshub.com/crystal-reports/how-to-download-and-install-crystal-report-runtime/#hownbspto-download) to download SP 29 DEVELOPER EDITION DOWNLOAD (I was using .net framework 4.7.2, see below Crystal report version recommendation for other versions).
❗ Please note: To integrate “SAP Crystal Reports, developer version for Microsoft Visual Studio” you must run the Install Executable by right clicking and selecting "Run as Administrator". Installing the MSI will not fully integrate Crystal Reports into VS. MSI files by definition are for runtime distribution only. Do not run the MSI's on your Development PC, where VS is installed, not required.
References - https://blogs.sap.com/2020/10/30/upgrading-a-visual-studio-2008-2019-.net-project-with-the-latest-cr-.net-sdk-packages/
https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads
I would say, if you are using 64-bit version of Crystal Reports, just install 32 bit.
That solved my problem.
In my case I migrated crystal report in development computer to last version then migrated the cloud server to same version of crystal report
but after published the site I received this error :
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.
the solution I commented the line in web.config
<!--<add assembly="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />-->
then publish the site again this solved my issue
Error (While using Visual Studio 2015 in win 10 64 bit machine):
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.
Solution:
Open IIS
Go to current server – > Application Pools
Select the application pool your 32-bit application will run under
Click Advanced setting or Application Pool Default
Set Enable 32-bit Applications to True
The above solution is solved my problem.
Thanks.
I got the following error when I am Building Solution for my app.
Could not load file or assembly '0 bytes loaded from System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Working in Microsoft Visual Studio 2010. Windows phone 7.1 Silverligt Application.
64-bit operating system.
Any help appreciated.
Appearantly, you are trying to load a DLL that is specifically for Windows 7/xp 64 bit into the phone7 OS. then you get this errormessage.