We also need to include our imports, so we also add the following: Note that TargetFramework becomes TargetFramework s! Doing so requires an edit of the csproj file. NET Framework 4.5, as well as Framework 4.0 and 4.6.
NET Standard 1.3, it's time re-introduce our targeting of. Now that we have successfully converted our project to target. NET Standard 1.3! Targeting multiple platforms and that's it! We now have a working library, that compiles, and targets. To replace them, we add the following info to the csproj file: The fix is simple: we remove all of the attributes from the AssemblyInfo.cs file that the compiler complains about. It turns out that with the new csproj format, the compiler generates these attributes for you based on information from the csproj file. In it, we define a bunch of attributes (AssemblyTitle, AssemblyDescription, etc) which the compiler is now complaining are duplicates. Last but not least, we run into a problem involving the old AssemblyInfo.cs file. It's not the prettiest solution, but it's the price we pay for targeting multiple platforms. We simply create multiple versions of our code, based on which features are available. If (type.IsEnum & !m_getMethodMap.ContainsKey(type)) If (type.GetTypeInfo().IsEnum & !m_getMethodMap.ContainsKey(type))
Then, everywhere this particular feature is used, I change my code like in the following example: #if FEATURE_TYPE_INFO This defines a feature flag for us whenever we are targeting Standard 1.3. In the csproj file, I add the following: So, we'll solve this problem through feature toggles. And while this particular API does exist in Framework 4.5, it does not exist in Framework 4.0, which I also intend on targeting. In Standard 1.3, you're supposed to do Type.GetTypeInfo().IsEnum. For instance, Type.IsEnum and Type.IsValueType are commonly used across several Blazer classes, but don't exist in Standard 1.3. Some APIs which are available in the full.
I ended up needing four additional packages. To figure out in which packages your missing types are hiding, you can use the extremely useful Reverse Package Search site.
As such, they must be included as separate NuGet packages. Some types, like the things we use from System.Data, are not found in the. There's basically two kinds of errors we encounter: missing packages and missing APIs. So anyway, what does this mean for us? Simply put, we'll have to go through our code and fix all of the incompatibilities. If this stuff confuses you, simply refer to this handy table to clear things up: Platform Although Standard 1.3 contains some APIs which are not in Framework 4.5, the real problem is that Framework 4.5 contains a lot of things not covered by Standard 1.3. NET Standard 1.3, which isn't compatible with our old. That was easy! Unfortunately, the project doesn't compile. Anyway, when we place this file in the old project folder and add it to the solution, all of the source files automatically show up in the Project Explorer. To do this, we'll simply get rid of the old project file, and replace it with a new Blazer.csproj with the following contents: The first step involves upgrading to the new csproj format. We're starting off with a Visual Studio 2015 solution and an old csproj file. We'll be using Visual Studio 2017, and my Blazer library as a working example.
There is some documentation, but it's all scattered information that fails to paint the full picture.
However, exactly how to create such a package (including setting up Visual Studio) is never fully described. NuGet has supported placing multiple versions of the same library in one package for quite a while now. NET Standard, while also remaining compatible with version 4.5 of the full. I now want to target multiple platforms: I want to target.
However, this only covered the basic scenario of targeting a single platform. In a previous post, I showed how to create and publish a simple NuGet package. NET Standard, in order to make my package available on a wider variety of platforms. To: "NuGet/Home" "Julie Lerman" Re: Default Project Dropdown Empty After Adding/Saving New Solution & Project ( we could not repro the issue that you've reported using latest build.As the proud owner of a NuGet package (72 downloads and counting!), I'm interested in targeting the new. I will try to see what happens without r#. I don't think I did anything out of the ordinary. Yes I was using a plain c# class lib and console. For now I can tell you ita the RC that was released at build and should be whatever version I'd nuget was part of that.