Click here to Skip to main content
15,569,696 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a project in asp core 5.0 and I have referenced framework dll libraries (version 4.7.2). In the C# files of the project these libraries work, but I don't know how to use them in razor engine? Already the line @using ...; throws an error that the library is not referenced.

What I have tried:

I tried and still trying to google something.
Add <CopyRefAssembliesToPublishDirectory>true</CopyRefAssembliesToPublishDirectory> to csproj file didn't help.
Updated 23-Jul-21 5:04am

1 solution

If you're using a .NET 4.7.2 library, I don't think you can use it in a .NET Core 5.0 app. I could be wrong, but it doesn't look good.

If this is a library you wrote, you could possibly recompile it using .NET Standard 2.0 an use it on both the .NET 4.7.2 and .NET Core 5.0.

If it's 3rd party, you're going to have to see if there's a newer version to use it on .NET Core 5.0.
Share this answer
KarNullKa 23-Jul-21 10:34am    
I have found a "solution", but I doubt its correctness. NET 4.7.2 works in my C# file (ModelViews), so what I need to get into the view I place here in a new class and only this new class I use in the view.
Thanks for the answer. If the conversion to NET Standard is successful, that will definitely be a better solution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900