Upgrading to .NET Core: Back-End Class Library - A TimCo Retail Manager Video

preview_player
Показать описание
In a continuation of the upgrade process, we are going to upgrade our back-end library (which serves our API) to .NET Standard 2.0. That will keep it compatible with our existing API and allow it to work with the new .NET Core 3.0 API when it is ready.

One-off tutorials are awesome but they aren't the only thing you should be doing to learn C#. Another vital part of learning is learning how to put it all together. This interactive course is all about putting the pieces together. You can watch each video on its own or you can watch them in order and see a bigger picture. The choice is yours.

This course focuses on real-world development. As such, we are simulating that we work for TimCo Enterprise Solutions on a brand new product, the TimCo Retail Manager. Just like in the real world, we are starting out with one set of requirements but know that over time they will change.
Рекомендации по теме
Комментарии
Автор

I installed Dapper 2.0.30, System.Data.SqlClient 4.7.0 & 4.6.0 as you did and didn't have the same errors that you did. The application worked without any additional steps.

roycelithgo
Автор

quick and easy fix:
unload the framework project (not the library), add these two lines to the PropertyGroup of the csproj file:


it should work like a charm without the need to reinstall libraries in the project.

Why it happens: The issue is basically the dependencies are not getting copied properly in the build process when using framework with standard (doesn't happen with core afaik, which is why it will we go away by itself when we update in later videos). In order to make sure that they play well together, we tell it to restore the package references and create the bindings. So no compile time errors but once the build happens, configManager/dapper dont get built in. The program runs until that point then begins to freakout since it needs to execute a class that isn't there and breaks.

On another note: Running with these flags once are plenty to get it working. I tried to remove them and restart visual studio, the project still had no issues. It seems that only one copy is necessary, but I would leave them there just in case my observation is not true.

mov
Автор

I was the only who had 500 internal server error, and no exception about dapper?
The real medicine was likely to install ConfigurationManager nugetpackage in TRMDataManager. It goes fine without Dapper.
There were other surprises, too but hopefully I am again on track with you.
And, as always, thank you!

zoltantoth
Автор

FYI, similar to previous video, after installing the necessary packages to the library, my project ran fine. I didn't have to install the packages to the TRMDataManager. I wonder if this is a VS 2019 thing that was eventually updated.

[Update] after restarting VS 2019, I had the same issue.

hchoi
Автор

Just a note. The method you use to basically wipe a project and rebuild it has a side effect in that any source control bindings get wipes too.
So next time you load the project into VS it does not know how to bind the project.
Surely there must be an easier / safer way to migrate?

LarryB
Автор

when I try to download any new version of dapper for this part of the video, I get the following error:
"The operation failed as details for project TRMDesktopUI.Library could not be loaded". Not sure how to proceed. I've done some research on this issue, but I'm still not sure how to make this error go away.

thegodtwon
Автор

Was there ever a good solution to these problems with System.Data.SqlClient and Dapper? I am now creating a brand new project in .net standard 2.0 using latest nuget packages and trying to use the dll in a new .NET Framework project. This will simply not work unless I install again these packages in the hosting project.

girornsveinsson
Автор

I would be curious to see if you find a better solution to the problem with references. Because even when I have a brand new project that I use core or even xamarin forms and used .net standard, i had the same problems where it said it could not find the references. When that happened, I always just added the references and it always just worked.

andywalter
Автор

Could Costura.Fody nuget package be a solution for the missing .dll Problem?

jimkoro
Автор

Seems like the reference issue has been around for a while.

Suggested fix is here:

pilotboba
Автор

Small tip. If you are committing all changes... you don't have to stage first.

pilotboba
Автор

Could this be an issue of "Copy to Output" directory flags in the references?

eddkepner
Автор

I had faced issue long back and found proper solution by Googling it. This happens because your package is not compatible with core.

gauravkukkar
Автор

Wouldn’t it be easier to create a new solution which has the same project name (but is built on .NET Core) and copy-paste all the code and folders from the original project (.NET Framework) into the new one.

windowsbuilderthegreat
Автор

For those poor souls like me struggling with 'Could not load file or assembly regardless of whether you have installed NuGet Packages for both projects: pay attention to the exact version of Configuration Manager that appears when the exception is thrown and update (downgrade actually) package in BOTH of your projects to be exactly as in the exception. Version 6.0.0 worked for me (VS 2022, .Net Framework 4.8).

miniputlol