MySql.Data c# .net library which runtime should I use? - c#

When adding reference to the MySQL .NET connector I am seeing two entries listed for MySql.Data
one with a runtime version of 4.0.30319 and another with a runtime version of 2.0.50727
Which should I reference? does it make a difference?

If your project targets .NET Framework 4.0, then you'll want to reference the 4.0 version. Otherwise, use the 2.0 version (even if your project targets 3.5).
You can check the version your project targets by right-clicking the project in Visual Studio and selecting properties.

If your project is using the .NET Framework 4.0, the 4.0.30319.
Otherwise, 2.0.50727

Related

C# 6, VS2015-3, .Net 4.6, System.Numerics.Vectors has no Vector<T>

I am upgrading an application from Visual Studio 2013 Net 4.5.1 to Visual Studio 2015 C#6 Net 4.6, and I would like to make use of the System.Numerics.Vectors Vector< T >. I have been using Vector4 already to get SIMD which works fine in my app, I would like to get Vector< T > support though and make full use of the larger AVX/AVX2 SIMD Registers.
The development system has Net 4.5, 4.51, 4.52, 4.6, 4.61 and 4.62 Multi-Target Packs and SDKs installed.
The project properties Target Framework is 4.6. I also tried 4.61.
The project references include both System.Numerics (4.6.81.0) and System.Numerics.Vectors (4.6.81.0).
But all that I get in the System.Numerics namespace is the BigInteger, Complex, Matrix3x2/4x4, Plane, Quaternion, Vector2/3/4.
I do not get Vector< T >.
At this late stage (2019) am I still supposed to install the old NuGet Preview packages to still get the Vector< T >? Is Vector< T > not by now a part of the current .Net 4.6 and 4.61 public releases?
And if I do have to use the old NuGet, is the NuGet package just the relevant information for VS and the JIT, or does that mean that I have to distribute another DLL even though System.Numerics.Vectors is already on the system...
I must be stupid...
Vector<T> is only in the .Net 2.1 standard preview, no it's not part of .Net Framework.
Applies to
.NET Core: 3.0 Preview 3 2.2 2.1 2.0 1.1 1.0
.NET Standard: 2.1 Preview
UWP: 10.0
Xamarin.Android: 7.1
Xamarin.iOS: 10.8
Xamarin.Mac: 3.0
Yes you will have to include the nuget, which will have its own Assembly
is the NuGet package just the relevant information for VS and the JIT
As far as I know there is no compiler magic and Vector<T>, it's just a vanilla struct, so what you are including are the definitions of this structure, this is all.

Can I target both .net standard2.0 and net471 in csproj file

I have a project that the target framework is .net standard 2.0, we use the System.Runtime.InteropServices.RuntimeInformation.OSDescription in our source code, but this library isn't support .net framwwork 4.6.1.Yesterday, one of our customer report a bug, about this question. his local framework is .net framework 4.6.1.
Can I set the target Framework to make a notice to user during they add the reference from Nuget Package?
And to make user to know if your local framework is 4.6.1, you should not use this version package and will cause bug.
When I set the target frameworks to:
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net471</TargetFrameworks>
<PropertyGroup/>
Then run dotnet build I get the error message:
error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.7.1" were not found.
To resolve this, install the SDK or Targeting Pack for this framework version
or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed.
Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies.
Therefore your assembly may not be correctly targeted for the framework you intend.
Then I go to the office website to download .net framework 4.7.1 SDK, but I install fail.
The error message is
A .NET Framework 4.7.1 or higher update has been installed on this computer
So I am confused!
Here is my dotnet --info
It seems I make a joke, I download the .net framework 4.7.1 from .net framework 4.7.1, but I can't install it. However, when I use Visual Studio Installer to install .net framework 4.7.1. It's fine.
And now run dotnet build, It success. More confused am I, Why can't install it from .exe file.

How to update to .NETStandard 2.0 NuGet Package

I've a good old .NET Framework 4.7 Class Library in Visual Studio 2015 currently using Microsoft.Extensions.Configuration NuGet package version 1.1.2. I'm trying to update this to version 2.0, but I'm getting this error:
Microsoft.Extensions.Configuration 2.0.0'. You are trying to install
this package into a project that targets '.NETFramework,Version=v4.7',
but the package does not contain any assembly references or content
files that are compatible with that framework. For more information,
contact the package author.
I see that the new version only supports .NETStandard 2.0. Do I have to convert all my project to either .NET Core or .NET Standard in Visual Studio 2017?
.NET Framework versions 4.6.1 and higher do support .NET Standard 2.0+, but only when using new tooling. Make sure you update to VS 2017 version 15.3.0 or higher and have the .NET Core SDK 2.0.0 installed and no global.json in your solution's directory hierarchy pinning a lower SDK version.
You may also need to install the .NET Core workload in VS 2017
Yes you have to convert your project to .Net standard 2.0 to use the Microsoft.Extensions.Configuration 2.0.0 package.
Check out the below link for .Net standard 2.0 supported .Net framework version
as of now the, .Net standard 2.0 supports only up to .Net framework 4.6.1
.Net standard 2.0 supported api

Can I use "Roslyn" in Visual Studio 2017 with .NET 4.7?

I've upgraded my project with scripting capabilities and also Microsoft.CodeAnalysis nuget and it downloaded hundred of dependent System.* packages. Before it was only Microsoft.CodeAnalysis.Common, CSharp, CSharp.Workspaces, etc. What is happening? Does it work in Visual Studio 2017 with .NET Framework 4.7? Or is it included in 4.7 (I didn't find it anywhere)? Should I wait?
Older versions of Microsoft.CodeAnalysis.Common only had a variant for .Net 4.5, with few dependencies.
But since version 1.3.0, the package also has a .Net Standard 1.3 variant, which has many dependencies, as is usual for .Net Standard 1.x packages. When installing such package into a project targeting .Net Framework 4.7, NuGet installs all the .Net Standard dependencies. As far as I know, there is nothing wrong with that and the project should work fine.

Do I need visual studio 2012 for .NET 4.5 or is visual studio 2010 fine for 4.5?

I have installed the .NET Framework 4.5 but I can only use .NET Framework 4.0 in my project, which doesn't support BigInteger. Do I need Visual Studio 2012 for 4.5 or is Visual Studio 2010 fine for 4.5?
Yes, you need VS 2012 to use .NET 4.5, however, BigInteger was introduced in .NET 4
Every modern version of Visual Studio (VS 2002 on) is keyed to a specific .NET Framework version, and cannot "see"/use newer versions released after that VS version. More recent VS versions, VS 2008 and beyond can "see" some older framework versions, but CANNOT "see" newer versions of .NET.
VS 2008 keyed to .NET 3.5 and can use 2.0 and 3.0. CANNOT use 4.0 or 4.5
VS 2010 keyed to .NET 4.0 and can use 3.5, 3.0 and 2.0. CANNOT use 4.5
VS 2012 keyed to .NET 4.5 and can use 4.0, 3.5, 3.0 and 2.0
If you need features introduced in .NET Framework 4.5, you need VS 2012.
As others have noted, BigInteger was introduced in .NET 4.0, not .NET 4.5. Through our exchange in the comments, it appears that you had not referenced System.Numerics.dll in your project.
VS project references tell the C# compiler which assemblies define the types that will be used in the C# code being compiled. The default Visual Studio project templates do not include references to the entire .NET framework. Several more specialized assemblies, such as System.Numerics, are omitted; if you want to use them, you have to add the reference yourself.
People frequently confuse the using directive (using System.Numerics;) with the reference itself. The using directive only helps the compiler with resolving type names; it concerns a namespace. For the compiler to find the types themselves, you need a reference, which identifies an assembly.
That information should help clarify the error message "The type or namespace name 'Numerics' does not exist in the namespace 'System' (are you missing an assembly reference?)". This means that the compiler has examined all the referenced assemblies, and it has found no type or namespace called System.Numerics.
To add an assembly reference in VS 2010:
Open the solution explorer
Expand the node for the project in question
Right-click the References node
Choose "Add Reference...". A dialogue box opens.
Open the ".NET" tab
Locate "System.Numerics" in the Component Name list
Click the "OK" button.
Biginteger was introduced in .net 4.0
For version earlier than .net 4.0, try intX
You will need VS2012 for .NET 4.5. VS2010 supports till .NET 4.0 only.
But once you installed .NET 4.5, all .NET 4 applications actually runs on the new version of .NET, the location of system DLLs is C:\Windows\Microsoft.NET\Framework\v4.0.30319
Do you mean VS2010 can only reference system DLLs in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0?
Won't see new types / new libraries at design time,
but can use reflection to load at runtime?

Categories

Resources