Is .NET 4.5 mandatory for Windows API Code Pack - c#

Is .NET 4.5 mandatory for using Windows API Code Pack (Microsoft.WindowsAPICodePack and Microsoft.WindowsAPICodePack.Sensors.dll)
Will it work for .NET 4.0?
The latest version of Windows API Code Pack is 1.1 but there doesn't seems to be a dedicated page for it.

The library was published when Windows 7 was released (replacing the "Vista Bridge" library), and targets the .NET Framework version that is pre-installed on Win7, version 3.5. You cannot go lower than 3.5, it has a dependency on System.Core.dll. Targeting .NET 4.x is not a known problem.
Do keep the target operating system requirement in mind for the Sensor api, the underlying COM interface (ISensor et al) requires Windows 7 or higher and is not available on the Server edition.

The actual code of the Windows API Code Pack is compatible with .NET 3.5 and above. .NET 4 or 4.5 certainly won't be a problem.
I just downloaded the NuGet package using Install-Package WindowsAPICodePack-Core and it works for .NET 3.5.

Related

.NET Versions are retro-compatible?

I'm working on a C# Code that has as Targeted Framework .NET 4.6, and I'm trying to troubleshoot some issues that occurs during the execution.
That code is running on some clients, that has a .NET 3.5 Version.
My question is, does .NET 4.6 supports retro-compatibility, and if so, should it be wiser to have an aligned Framework versions (Target Version same as Client Version)??
TL;DR: Basically, you can run old on new, but not new on old.
DotNet 4.6+ is backwards compatible in the sense, that you can run an App built with DotNet 3.5 etc. But you cannot run an app built with DotNet 4.6+ while using an older installed framework eg. 3.5 or others. Take it this way:
Imagine you have a windows 10 computer and you want to install an app built for windows 8 or even XP and older. Modern windows has the compatibility layers, necessary to run or install the program.
Now what you/your clients are doing is basically taking an app specifically designed for windows 10, and trying to run it on Windows XP or 95 etc. That won't work as the compatibility layers are not in place to support the "future". No one can foresee the new features and API's that they might add, so the app is incompatible with older Windows.
If you are targeting .NET 4.6, then target .NET 4.6.
Do not expect your code/app to be compatible with anything lower, and if you do need it to be, you have to target that specific version. Which has its own draw-backs as the newer methods / ways of doing things and many libraries you could be using do not apply/are not compatible.
You can either update everything to use 4.6 or higher, or switch your codebase to target 3.5 and live with the drawbacks.
From Backward Compatibility
The .NET Framework 4.5 and later versions are backward-compatible with
apps that were built with earlier versions of the .NET Framework. In
other words, apps and components built with previous versions will
work without modification on the .NET Framework 4.5 and later
versions.
In your case app is built on .Net Framework 4.6 and the platform on client machine is 3.5 version. There might be some issues because app requires newer version than platform it runs.
.NET Framework version 4.6 was included with Windows 10 from version 1507 and .NET Framework version 4.6.2 was included with Windows Server 2016. If your clients are running either of these versions of Windows or newer, you won't have to install anything to run your .NET Framework 4.6 app, and it won't be running on .NET Framework 3.5 even if you do have it installed.
If you're using an older version of Windows than that and don't have .NET Framework 4.6 or newer installed, I wouldn't expect it to run at all.

Upgrade from .NET 4.0 to .NET 4.7

We have some legacy apps (ASP.NET) that have been targeting the .NET 4 framework, which is out of support. Looking at some articles https://learn.microsoft.com/en-us/lifecycle/faq/dotnet-framework, it basically says we don't need to recompile our apps to target the newer version of the framework.
How do I make sure that our apps are running with the latest (.NET 4.7) framework?
Thanks.

Running a .Net Standard 2.0 Application on a PC with .Net Framework 4.6.2

I added a new project to an existing solution. All of the other projects are compiled to .Net Framework 4.6.2. The new project is .Net Standard 2.0. When this is deployed to a client machine (it's a windows application) will it run if the machine only has .Net Framework 4.6.2?
based on the documentation it will.
https://learn.microsoft.com/en-us/dotnet/standard/net-standard
Doc says the minimum version required is 4.6.1

Using .NET Standard 2.0 with Mono

Does anyone know if .NET Standard 2.0.0 is supported on Mono? I currently have a build that is working fine on windows 10. When I attempt to use in Mono in a Ubuntu Linux environment I get the following error:
Could not locate the assembly 'netstandard'. Check to make sure the assembly exists on disk.
Dotnet core 2 is added with no problems via the SDK, but I seem to not have any references to .NET Standard 2. I had a similar problem on windows 10 originally, which was resolved after I updated my version of visual studio.
Consult the release notes for details, but Mono 5.4.0 includes NuGet 4.3.0 and MSBuild 15.4.
Mono 4.8.0 Preliminary support
API additions for .NET Standard 2.0
We added APIs to comply with .NET Standard 2.0, which is still a work in progress at the time of this writing. Note that in some cases an implementation is still missing and will throw at runtime.
Mono 5.2.0 Runtime support (compiling is in "Preview Status")
.NET Standard 2.0 groundwork
We’ve done all the groundwork to support libraries that conform to .NET Standard 2.0. Loading and running a library compiled against the 2.0 standard should work fine, tooling support (i.e. creating a .NET Standard 2.0 library) is still in preview though.
.NET Core 2.0 SDK Installation needed
You’ll need to install the .NET Core 2.0 SDK for tooling support as we use the MSBuild tasks which are installed as part of the .NET Core 2.0 SDK, similar to how Visual Studio/MSBuild on Windows does it.

Is WPF with version 3.5 fits Windows7 and Windows8?

i am developing WPF application in visual studio and using .NET 3.5.
does the application fits Windows7 and Windows8 OS with no .NET framework additional installation?
do i need to add .NET 3.5 installation to setup project?
In Windows 7 .NET framework 3.5 is part of the operating system so all machines should have it.
In Windows 8 or windows 8.1 .NET framework 3.5 is NOT automatically installed (though all machines that are upgraded from win 7 -> win 8 should have it).
To run apps that require the .NET Framework 3.5 on Windows 8 or later, you must enable version 3.5 on your computer. There are two ways you can do this: by installing or running an app that requires the .NET Framework 3.5 (that is, by installing the .NET Framework 3.5 on demand), or by enabling the .NET Framework 3.5 in Control Panel. Both options require an Internet connection.
If an app requires the .NET Framework 3.5, but doesn't find that version enabled on your computer, it displays a message box, either during installation, or when you run the app for the first time. In the message box, choose Install this feature to enable the .NET Framework 3.5.
The above require an internet connection. If this is not possible you will have to include the .exe files of .NET 3.5 in your distribution
however as MSDN states:
The .NET Framework 4.5 and its point releases are backward-compatible
with apps that were built with earlier versions of the .NET Framework.
In other words, apps and components built with previous versions will
work without modification on the .NET Framework 4.5. However, by
default, apps run on the version of the common language runtime for
which they were developed, so you may have to provide a configuration
file to enable your app to run on the .NET Framework 4.5
So build your project for 3.5 and just deploy it to windows 8 machines. It should run, but its not the "best" environment for the app. The "best" would be to have .NET 3.5 installed.

Categories