Cant deploy web app because of version conflict, however it runs fine locally - visual-studio

I have an ASP.net core web app which references a DLL called BLL, which in turn references a DLL called DAL, and within the DAL there is a reference to Microsoft.EntityFrameworkCore 7.0.2.
I have changed the .net versions of these 3 projects from 6 to 7 today, it all compiles and runs fine locally in Visual Studio.
However when I come to deploy it the BLL won't compile, I get an error:
Error CS1705 Assembly 'ST.CMS.DAL' with identity 'ST.CMS.DAL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'Microsoft.EntityFrameworkCore, Version=7.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' which has a higher version than referenced assembly 'Microsoft.EntityFrameworkCore' with identity 'Microsoft.EntityFrameworkCore, Version=6.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' ST.CMS.BLL C:\Users******\ST.CMS\ST.CMS.BLL\CSC 1 Active
So there is a conflict between 6.0.2 and 7.0.2 for EntityFrameworkCore, however i'm not using 6.0.2 anywhere, I can't understand where it's getting 6.0.2 from.
Before I did this change today it deployed fine. I have tried closing and reopening Visual Studio and rebooting the laptop but it still keeps happening.

Simply removing the Nuget package references to Entity framework core in the DAL project then re-adding them solved the problem.

Related

regasm on a .net framework library now wants netstandard 2.1.0.0

I have a .net framework 4.8 library I have been working on for months in VS19. The project is configured to "Register for COM interop" (which runs regasm.exe on the dll).
Recently (in last few days) I installed VS22 and have been playing around with some .net core projects in here.
I have come back to my original library in VS19 which when compiling now reports (during the regasm call):
Cannot register assembly "X:\<removed>\my-lib.dll". Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
I get the same result from manually trying to register the dll or trying to load and compile the project in VS22. I have installed all VS19 updates and rebooted the computer, no change.
It is my understanding that netstandard 2.1 has nothing to do with framework and netstandard is not specifically mentioned anywhere in my code or config. The gacutil /l output shows netstandard 2.0.0.0 is installed but nothing else.
It would seem the installation of VS22 may have shifted something in my environment and I'm not sure how to correct it?

Supporting an .Net Framework Lib in .Net Core 2.0 WebAPI - Error

so basicly out complete company dataaccess is based in .Net Framework 4.6.
We are only on windows, so no problems here atm.
We have a new project in which I want to use .Net Core 2.0 and WebAPI but I have to use this "old" .net Framework lib.
When I add the reference and start my project I will get an error:
Could not load type 'System.Security.Principal.WindowsImpersonationContext' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.'
As far as I googled it and understand, the dataasccess lib will try to get the win auth but this isnt available in .net core (obvious) any more.
I found the nuget Microsoft.Windows.Compatilibity and after installing the error is gone.
But another one comes up:
Exactly this error:https://community.oracle.com/thread/4139377
And the only solution to this seems to be to remove the MS.Win.Comp package...
So a bit of a circle.
Any ideas?

Error upgrading from .Net Core 1.0.0 to 1.1.0

I have a .NET Core project which I am getting back to which was working fine. I ran a NuGet update which upgraded a number of items, mainly going from AspNetCore 1.0.0 to 1.1.0. The solution compiles fine, but when I run it, I get this exception in the browser:
FileLoadException: Could not load file or assembly 'Microsoft.AspNetCore.Http.Features,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Adding Microsoft.AspNetCore.Http.Features in project.json does not fix the problem and I can find no reference to it. Does any one have a suggestion on resolving this?
I encountered the same problem after updating from 1.0.0 to 1.1.0 (ASP.NET Core Web Application (.NET Framework 4.6.2) x86) using Visual Studio Community 2017 RC.
My solution were to uninstall the Codegeneration design package:
Microsoft.VisualStudio.Web.Codegeneration.Design (1.0.0-msbuild1-final)
Update!
The faulty package has since been updated (1.0.0-msbuild2-final as of this writing). So instead of removing the package, tick "include prerelease" and update.
According to this site Announcing the Fastest ASP.NET Yet, ASP.NET Core 1.1 RTM the .NET Core 1.1 SDK needs to be installed. I assumed that I had already done that through a Visual Studio notification, but that wasn't the case. Once I installed it, the site worked.

Could not load type 'System.Reflection.IntrospectionExtensions', ASP.NET MVC 4 (RC), possibly Facebook C# SDK's fault?

I'm developing an ASP.NET MVC 4 (RC) website, runs great on my local dev box.
Deploying to my host (DiscountASP) required me to change <compilation targetFramework="4.5" /> to <compilation targetFramework="4.0" /> even though I bin deployed it.
The site operates fine, until someone who is logged into Facebook, or attempts to connect to my site using their Facebook account (which is nearly all, my membership system uses Facebook primarily), it throws an error:
Could not load type 'System.Reflection.IntrospectionExtensions' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Since it's beta, I'm not worried about leaving the error online at this time, you should be able to re-create the error on my site here.
It appears the Facebook C# SDK is throwing the error, but is it the SDK's fault, or the fact I had to change to 4.0 framework? How could I resolve this?
Update
From what I gather, the System.Reflection.IntrospectionExtensions are new to .net 4.5, which is not on my host. However, my project targets the .net 4.0 framework, and is bin deployed as such. On my development system it runs fine, on host it errors.
Turns out it was the fact I had the project targeting .net 4.5 when I added the Facebook C# SDK reference (and later changed the project to target 4.0).
I removed the reference, ensured my project was set to .net 4.0, and used Nuget to re-install the Facebook C# SDK. Resolved the problem immediately.

Reference issues in .NET 4.0 project to .NET 2.0 dll/project

I just starting to use Visual Studio 2010 and .NET 4.0. I created a new WPF project a DLL built for .NET 2.0. When I build the project, I get a bunch of warnings like this one:
The referenced assembly
"MicroFour StrataFrame Business...processorArchitecture=MSIL"
could not be resolved because it has a dependency on
"System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client".
Please remove references to assemblies not in the targeted framework
or consider retargeting your project.
When I reference a project I created that targets 3.5, it can't find any of the namespaces (during compile), though they show up in the object browser and intellisense correctly shows them.
Is there something I'm missing that needs to be done to reference an older .NET assembly?
There is very little point in targeting the client profile for .NET 4.0. The download is 41MB, the full version is 48MB, only 15% bigger. Unfortunately it is the default in VS2010, just change it with Project + Properties, Application tab, Target framework combo.
The client profile does make a lot of sense if you target 3.5, the full install is ~350 MB. The huge difference is explained by the prerequisites, .NET 4.0 requires at least XP SP3 or Vista SP1. But 3.5 installs on any version of Windows > 2000. The 3.5 installer thus contains lots of the required updates for unmanaged Windows components used by .NET. The web installer lessens that blow considerably btw.
Your 2.0 assembly has a reference to System.Web. The reference is being automatically forwarded to your target framework, 4.0. So it is attempting to use System.Web, version 4.0.0.0. The problem is with 4.0 (actually this started with 3.5), there is now the notion of a client profile. The client profile has a smaller set of reference assemblies, anything web/server related has been removed. This is to make the .NET framework a smaller/simpler download for end users.
With VS 2010 and .NET 4, the client profile is being pushed a lot harder, MS really wants us to use it. So your .NET 4 project is targeting the client profile by default. Your referenced assembly wants System.Web, so in that case you need to switch to the full profile.

Resources