I need a specific functionality that was recently added into .Net Core 2.2 (new enhancements to GzipStream class in System.IO.Compression), however I'm using AWS Lambda and the latest version supported there is 2.1
Is there a way to extract the required DLL from 2.2 package and use it with 2.1 solution? I found the DLL and referenced it in my project, but it didn't seem to work (seems like it's simply ignored). Am i missing a step?
it is not possible because a .net DLL has written into it the version of .NET. So as the version is later than your project, the compiler will ignore it.
Even if it were possible, there would be no guarantee that it would not refer to other .net core 2.2 methods, which would make you look for more DLLs in that version.
maybe you should be change the project version to 2.2
Related
We are upgrading our solution of multiple projects. Starting with one class library which is been referenced by 13 projects. I need to upgrade my class library project .NET Framework 4.5 to .NET Standard 2.1.
Here the problem is:
This class library is being referenced by projects of .NET Framework 4.5 and its throwing error that it can't access .NET Standard 2.1 lib
Project 'abc.csproj' targets 'netstandard2.1'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.5'.
How to resolve this problem? Upgrading all those 13 projects is not possible at the same time.
EDIT:
Following comments, if I convert lib to .netstandard1.1 then errors start coming in the library itself:
After downgrading lib to .netstandard1.1, following on
NetStandard 1.4 does not allow decorating class with [DataContract]. I saw this post and added this package System.Runtime.Serialization.Primitives:
I even added reference to older dll but, still getting error:
Adding answer as we've iterated through the comments. At first OP wanted to change framework of library to .NET Standard 2.1 while having other apps under .NET Framework 4.5.
Unfortunately, this is not possible. As specified in the official documentation, .NET Standard 2.1 is not following along with .NET Framework. Latest you can get is .NET Standard 2.0 with .NET Framework 4.6.1. Solution for this issue is to downgrade common library project to .NET Standard 1.1, other app projects should be able to link to this.
Next iteration (after downgrading to .NET Standard 1.1) brought issue related to "unknown classes" and VS/compiler asking for adding reference. There was already existing question, answer is to download NuGet package related to the data serializers.
If your code in end-applications are also using classes/attributes from the affected assembly, you must make a cleanup. So that all code references the only single version of source. It is not possible to have one Attribute taken from Nuget and check for "same attribute/same name" but from different source (system assembly -> System.Runtime.Serialization).
I'm having a .Net 4.7.2 application, in which I want to reference the package OpcFoundation.NetStandard.Opc.Ua. This project as a list of dependencies for .Net 4.6 that is quite small.
But when I install it, I get like 50+ additional packages to install. Is there a way to reduce this? I feel that a lot of thoses classes are already existing in the full .Net project(System.Threading.Tasks/Timer/...).
Thank you
If you look at many of these types (which are supplied by .NET Standard packages, not .NET Core), you'll find that the specific version that's used against .NET 4.7.2 will be an empty assembly just containing lots of TypeForwardedTo attributes pointing right back at the full-flavour .NET Framework.
So you still end up using the exact types you always would have done. There's just extra indirections which allows .NET Standard to work with both .NET Framework, .NET Core and other .NET Standard implementations.
Is it possible to use .NET Core 2.2 or 3.0 with Blazor?
Because at this moment, the blazorhosted template creates a client-side project as .NET Standard which prevents using .NET Core 3.0.
Project blazor.Shared is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Project blazor.Shared supports: netcoreapp3.0 (.NETCoreApp,Version=v3.0) blazor.Client C:\app\blazor.Client\blazor.Client.csproj 1
After changing everything to .NET Core 3.0, I get the following error:
rzc generate exited with code 1.
So, is it possible and I'm doing something wrong or is there no way yet?
Client side Blazor runs on the Mono WASM runtime, and that only supports netstandard 2.0 ATM. The announcement of Blazor in Core refers to server side Blazor. The two are compatible code wise but the underlaying runtime technique is totally different.
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation does not work on blazor because it requires .NET 3.0
As a result it requires a recompile manually every time I make a change which is slow when debugging.
I am working on a large C# project which uses code contracts extensively and compiles against an older version of the .NET Framework (3.5). This project is a library, and I am also developing other applications which consume it as a dependency. I would like to use .NET Core 2.1 for these new projects. I believe my options are as follows:
Upgrade the library from .NET Framework 3.5 to .NET Framework 4.6.1+, which I believe will make it compatible with .NET Standard 2.0 and thus usable by a .NET Core 2.1 project.
Upgrade the library to build against .NET Standard 2.0 explicitly, using the new .NET Core toolchain.
I have the following questions:
It looks like code contracts are dead and unsupported in .NET core; this means I will be unable to run the code contract analyzer if I go with Option (2), correct?
If I go with Option (1), the analyzer can still run but I'll have to switch to Igor Beck's unofficial NuGet package per this answer to support .NET 4.6.1+, correct?
Ideally I'd like to keep the benefits of code contracts, although since they're unsupported I recognize this will continue to hold back the library version as time goes on.
I have a .NET Core (ASP.NET Core) project created using Visual Studio 2017 RC (MSBuild).
I also have an old F# project library (traditional .NET Framework Library) that compiles to a dll file. I want to use it in said ASP.NET Core project.
To do that, I added a project reference in the ASP.NET Core project, opened the namespace, and made a few function calls in my controllers; it works perfectly when running the ASP.NET Core server using ISS from VS.
My question is, will this arrangement work if I want to deploy to linux (Ubuntu)? Or does using external PCLs/dlls from .NET Core instantly make it windows-only?
Note that I didn't have to add .NET Framework as a target framework in my csproj (it's MSBuild Core), it just worked.
Since your F# project targets the .NET Framework it will not run cross platform. If you modify your F# project to target the .NET Standard library it will. Here is a video by Immo Landwerth explaining how the .NET Standard Library works.
You should be able to just to reference the .NET standard library and not have to change anything. However the current version, which is 1.6, is missing a lot of API's from .NET Framework. This is fixed in 2.0. Infact since your using .NET Core 1.1 I think you are already using 2.0, but I'm not certain. Here is another video by Immo explaining how it should work.
That being said, I'm not sure what the F# support is like with .NET Standard.