Could not load file or assembly 'Serilog.FullNetFx, Version=1.5.0.0' - serilog

I have .Net 4.5.2 application and I have installed Serilog 2.1.0 and Serilog.Sinks.MongoDB 2.0.19 I have configured sink as
var log = new Seri.LoggerConfiguration()
.WriteTo.MongoDBCapped("mongodb://localhost:27017/test",collectionName: "logs")
.CreateLogger();
However I am getting error
Could not load file or assembly 'Serilog.FullNetFx, Version=1.5.0.0,
Culture=neutral, PublicKeyToken=24c2f752a8e58a10' or one of its
dependencies. The system cannot find the file
specified.":"Serilog.FullNetFx, Version=1.5.0.0, Culture=neutral,
PublicKeyToken=24c2f752a8e58a10

The MongoDB sink was only updated a day ago to support Serilog 2.0. You need to run:
Update-Package Serilog.Sinks.MongoDB

Related

F# Type provider FSharp,Data.SqlClient targeting .NetStandard 2.0 fails when using dotNet Build from commandLine but succeeds in Visual Studion 2019

I am using the F# Type Provider FSharp.Data.SqlClient in a DLL targeting .Net-Standard-2.0, while this successfully builds in Visual Studio 2019 it fails when I try to build it using the command prompt compiler dotNet compiler with the following error message
J:\Workspaces\DRILQUIP_2456764.0\Applications\EngWeb\Dev\src\EngWeb.Core\BillOfDocuments\BillOfDocumentsDataAccess.fs(14,27): error FS3033: The type provider 'FSharp.Data.SqlProgrammabilityProvider' reported an error: Could not load file or assembly 'System.Data.SqlClient, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (0x80131058) [J:\Workspaces\DRILQUIP_2456764.0\Applications\EngWeb\Dev\src\EngWeb.Core\EngWeb.Core.fsproj]
J:\Workspaces\DRILQUIP_2456764.0\Applications\EngWeb\Dev\src\EngWeb.Core\BillOfDocuments\BillOfDocumentsDataAccess.fs(14,27): error FS3033: The type provider 'FSharp.Data.SqlProgrammabilityProvider' reported an error: Could not load file or assembly 'System.Data.SqlClient, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (0x80131058)
I am using FSharp.Data.SqlClient version 2.0.6 and System.Data.SqlClient Version 4.8.1 and the FSharp.Core version 4.7.0
Any help with this issue will be appreciated

Autofac 3.4 is missing, while 3.5 is called

Attempting to run the MVC 5.2 project, which is built successfuly, got the following error:
An exception of type 'System.IO.FileLoadException' occurred in
ProjectNamespace.WebUI.dll but was not handled in user code
Additional information: Could not load file or assembly 'Autofac,
Version=3.4.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da' or
one of its dependencies. The located assembly's manifest definition
does not match the assembly reference. (Exception from HRESULT:
0x80131040)
Assembly manager loaded from:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Running under
executable C:\Program Files (x86)\IIS Express\iisexpress.exe
--- A detailed error log follows.
=== Pre-bind state information === LOG: DisplayName = Autofac, Version=3.4.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da
(Fully-specified) LOG: Appbase = file:///C:/ProjectPath/WebUI/ LOG:
Initial PrivatePath = C:\ProjectPath\WebUI\bin Calling assembly :
Autofac.Integration.Mvc, Version=3.3.0.0, Culture=neutral,
PublicKeyToken=17863af14b0044da.
=== LOG: This bind starts in default load context. LOG: No application configuration file found. LOG: Using host configuration file:
C:\Users\me\Documents\IISExpress\config\aspnet.config LOG: Using
machine configuration file from
C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Autofac, Version=3.4.0.0, Culture=neutral,
PublicKeyToken=17863af14b0044da LOG: Attempting download of new URL
file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary
ASP.NET Files/root/5c8bedab/6a36492/Autofac.DLL. LOG: Attempting
download of new URL
file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary
ASP.NET Files/root/5c8bedab/6a36492/Autofac/Autofac.DLL. LOG:
Attempting download of new URL
file:///C:/ProjectPath/WebUI/bin/Autofac.DLL. WRN: Comparing the
assembly name resulted in the mismatch: Minor Version ERR: Failed to
complete setup of assembly (hr = 0x80131040). Probing terminated.
My web.config has the following settings:
<dependentAssembly>
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0" />
</dependentAssembly>
Spent hours trying to resolve it, but failed. Please help.
This problem has become quite common. It seems to come up when you have the Autofac, Autofac.Mvc5 and Microsoft.AspNet.Mvc>5.1.0 packages, even though Autofac.Mvc5 is stated to work with Microsoft.AspNet.Mvc(≥ 5.1.0 && < 6.0.0).
I suggest the classic solution of checking and adding the appropriate assembly binding redirects for autofac, not only in the project which references it but in projects referencing that project as well.
Another potential problem is having two entries for the
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
in your config, if you have your bindings in the second one move them to the first one. That fixed it for me in a situation where I was also encrypting some configuration settings and for some reason the binding redirects were not copied into the resulting config file.
I highly recommend the Assembly Binding Log Viewer, it helped me a lot in figuring out the issue, even though my final solution was a cowardly one, going to Autofac3.4.0.0 and Microsoft.AspNet.Mvc 5.1.0. I spent way too much time on fixing the problem.
Also, for those who are interested you can use the nuget manager to detect and fill in your assembly binding redirects: Get-Project -All | Add-BindingRedirect (from here). It might need some additions afterwards depending on your porjects and references but at least it's going to give you a clean slate to begin with.
Update
Microsoft.AspNet.Mvc 5.2.3 was released so I decided to try again. I updated every package involved in the "conflict" to the latest version (Autofac 3.5.2, Autofac.Mvc5 3.3.4, Microsoft.AspNet.Mvc 5.2.3). I updated the redirect bindings and it worked.

Error creating a DevExpress controls for ASP.NET MVC empty project manually

I am using Visual Web Developer 2010 Express. I need to use DevExpress controls for an ASP.NET MVC 4 project.
So, I downloaded DevExpress Universal Edition something that has ASP.NET MVC controls.
Since I do not see a DevExpress ASP.NET MVC Empty project template, I am manually creating one following the instructions provided here:
http://documentation.devexpress.com/#AspNet/CustomDocument8163
However, when I start my application, I get this yellow screen of death that says:
Configuration Error
Description: An error occurred during the processing of a configuration file required
to service this request. Please review the specific error details below and modify
your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'DevExpress.Data.v12.2,
Version=12.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a' or one of its
dependencies. The system cannot find the file specified.
Source Error:
Line 39: <compilation debug="true" targetFramework="4.0">
Line 40: <assemblies>
Line 41: <add assembly="DevExpress.Data.v12.2, Version=12.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
Line 42: <add assembly="DevExpress.Web.v12.2, Version=12.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
Line 43: <add assembly="DevExpress.Web.ASPxHtmlEditor.v12.2, Version=12.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
Source File: C:\Users\computer\Documents\Visual Studio 2010\Projects\MvcApplication5\MvcApplication5\web.config Line: 41
Assembly Load Trace: The following information can be helpful to determine why the assembly 'DevExpress.Data.v12.2, Version=12.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a' could not be loaded.
=== Pre-bind state information ===
LOG: User = computer-VAIO\computer
LOG: DisplayName = DevExpress.Data.v12.2, Version=12.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
(Fully-specified)
LOG: Appbase = file:///C:/Users/computer/Documents/Visual Studio 2010/Projects/MvcApplication5/MvcApplication5/
LOG: Initial PrivatePath = C:\Users\computer\Documents\Visual Studio 2010\Projects\MvcApplication5\MvcApplication5\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\computer\Documents\Visual Studio 2010\Projects\MvcApplication5\MvcApplication5\web.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: DevExpress.Data.v12.2, Version=12.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
LOG: Attempting download of new URL file:///C:/Users/computer/AppData/Local/Temp/Temporary ASP.NET Files/root/8847955d/8ce8b26b/DevExpress.Data.v12.2.DLL.
LOG: Attempting download of new URL file:///C:/Users/computer/AppData/Local/Temp/Temporary ASP.NET Files/root/8847955d/8ce8b26b/DevExpress.Data.v12.2/DevExpress.Data.v12.2.DLL.
LOG: Attempting download of new URL file:///C:/Users/computer/Documents/Visual Studio 2010/Projects/MvcApplication5/MvcApplication5/bin/DevExpress.Data.v12.2.DLL.
LOG: Attempting download of new URL file:///C:/Users/computer/Documents/Visual Studio 2010/Projects/MvcApplication5/MvcApplication5/bin/DevExpress.Data.v12.2/DevExpress.Data.v12.2.DLL.
LOG: Attempting download of new URL file:///C:/Users/computer/AppData/Local/Temp/Temporary ASP.NET Files/root/8847955d/8ce8b26b/DevExpress.Data.v12.2.EXE.
LOG: Attempting download of new URL file:///C:/Users/computer/AppData/Local/Temp/Temporary ASP.NET Files/root/8847955d/8ce8b26b/DevExpress.Data.v12.2/DevExpress.Data.v12.2.EXE.
LOG: Attempting download of new URL file:///C:/Users/computer/Documents/Visual Studio 2010/Projects/MvcApplication5/MvcApplication5/bin/DevExpress.Data.v12.2.EXE.
LOG: Attempting download of new URL file:///C:/Users/computer/Documents/Visual Studio 2010/Projects/MvcApplication5/MvcApplication5/bin/DevExpress.Data.v12.2/DevExpress.Data.v12.2.EXE.
It looks like the DLL versions I have and the ones mentioned on that page are different. Please help.
I ran my project through their project converter which scans your references and web.config files and upgrades the entries to reflect the latest DLL's (if the ones you have are later than the ones you are pointing to in the web.config file), which was the case for me because I just copied the references from that page.
It says you're missing the data assembly. You seem to be using an old version. Download the latest version as there is an empty project template in the DevExpress project wizard.
Also, contact the DevExpress support team and they can help you quicker.
Please take a look at this:
How to: Manually Register DevExpress Extensions to Start Using Them in an MVC Web Application

Could not load assembly WebPages.Deployment version 2 at host?

I have a ASP.NET MVC 2 website (VS2010) that I have upgraded to ASP.NET MVC 3 (VS2012) and this works fin on local IIS7 but when publishing it I get this exception on host :
Could not load file or assembly 'System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
After some seartch I found this that states that I should set CopyLocal on some of the references(inlcuding the System.Web.WebPages) and also use the publish tool in VS2012, but this generated the following exception?
Could not load file or assembly 'System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
And I can´t find any Deployment dll to set copyLocal?
How could I solve this?
Have a read of http://joel.net/getting-asp.net-mvc-3-working-on-discountasp.net
You need to add a reference to System.Web.WebPages.Deployment and set that also to CopyLocal.

Program crashes when using Managed DirectX with .Net Framework 4.0

We are having a problem using DirectSound with the Managed DirectX dlls and the .Net Framework 4.0
The program works fine with .Net Framework 2.0 - but we have a requirement to upgrade to 4.0 to use some other components.
When the program invokes the Sound module, it crashes with the exception noted below.
Anybody seen this one and know how to fix it?
==============================================
System.IO.FileNotFoundException was unhandled
Message=Could not load file or assembly 'Microsoft.DirectX, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Source=Microsoft.DirectX.DirectSound
FileName=Microsoft.DirectX, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
FusionLog=""
[stack dump snipped]
InnerException: System.IO.FileNotFoundException
Message=Could not load file or assembly 'Microsoft.DirectX, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
FileName=Microsoft.DirectX, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
FusionLog==== Pre-bind state information ===
LOG: User = *****************
LOG: DisplayName = Microsoft.DirectX, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///C:/Users/*********/Documents/Visual Studio 2010/Projects/************/bin/x86/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : Microsoft.DirectX.DirectSound, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\***********\Documents\Visual Studio 2010\Projects\****************\bin\x86\Debug\***************.exe.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 1.0.2902.0 redirected to 2.0.0.0.
LOG: Post-policy reference: Microsoft.DirectX, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
InnerException:
I know this is a late reply but for me to get this working I had to find two DirectX DLL Microsoft.DirectX and Microsoft.DirectX.DirectInput and add then as a reference to the project.
Then just use the DirectX namespace for calling methods.
<!-- Uncomment this section when switching from Net2.0 to Net 4.0
It is intended to fix problems loading DirectX dlls - per Microsoft-->
<!--
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
-->
Officially the legacy DirectX Managed 1.1 assemblies do not support .NET 4.0. See this blog post for details.
You could look at using SlimDX or some other alternative...

Resources