.Net core 3.1 application deploy on windows 7 - wpf

Guys I have a solution containing projects of Api, class libraries and a WPF app.
All of targets are .Net Core 3.1.
I used Wix tools to create a self-contained installer.
It works well on windows 10 (well, it should) but i need an installation on windows 7.
But after installation the app doesn't start and there is no errors.
1- Is there any specific configuration for old windows 7?
2- if yes Which configurations should i check for existing projects?

Is there any specific configuration for old windows 7?
Yes, there is, according to https://github.com/dotnet/core/blob/master/release-notes/3.1/3.1-supported-os.md#windows, you must have SP1 installed, and according to https://learn.microsoft.com/en-us/dotnet/core/install/windows?tabs=netcore31, you need additional dependencies (KB2533623 update).
Obs. I had a similar problem in my test environment, and installing SP1 + KB2533623 solved the problem.
Regards.

For me, installing sdk on windows 7 solved the issue https://dotnet.microsoft.com/download/dotnet-core/3.1

Related

Detect the absence of .NET 6 runtime and ask user to download .NET 6 runtime?

I recently upgraded my WPF app from .NET framework 4.7 to .NET 6. But when I try to deploy my app on my client's computer, my app won't start because this new computer don't have .NET Desktop Runtime installed. So, how do I detect the absence of .NET runtime and promt a window asking the app user to download .NET runtime? Just like the below picture:
I'm not using any installer, just copy and paste my build folder to the new machine.
I remember that when I was using .NET framework, if the runtime was missing, the Windows system would automatically promt a window ask me to download the runtime.
Obviously your .NET 6 app won't be able to start and even less detect something unless the .NET 6 runtime is installed on the machine where you run the app.
To overcome this issue, you could bundle the .NET 6 runtime with your app by publishing it as self-contained:
dotnet publish -r win-x86
You will then copy the entire output of the publish folder, which includes the necessary .NET assemmblies, to the target machine.
Please refer to the linked docs for more information.

Is it possible to run a .NET core 3.1 app on Windows 7 Embedded?

I am trying to run a .NET Core 3.1 WPF application on a Windows 7 Embedded VM. Unfortunately, Windows 7 Embedded does not officially support .NET Core. Is there a workaround to get this to work anyway?
I have already tried publishing the app as a self-contained package, and as a single file (which is also self-contained), hoping that this would include all the necessary dependencies. But unfortunately, this didn't work. The event viewer showed me this exception:
Message: Failed to load the dll from (path)\hostfxr.dll, HRESULT:0x80070057
The library hostfxr.dll was found, but loading it from (path)\hostfxr.dll failed
- Installing .NET Core prerequisites might help resolve this problem.
(download link)
But of course that installer does not work on Windows 7 embedded ("This update is not applicable to your computer").
Is there a way to manually include all necessary dependencies, to get this to load anyway?
I had the same error regarding hostfxr.dll while starting from a barebones Windows 7 installation. Microsoft lists a specific security patch that fixed the error once I installed it.
KB3063858
64-bit: https://www.microsoft.com/download/details.aspx?id=47442
32-bit: https://www.microsoft.com/download/details.aspx?id=47409
.Net 5/Core Dependencies
https://learn.microsoft.com/en-us/dotnet/core/install/windows?tabs=net50#dependencies
.Net 5/Core Dependencies

M2MQTT in Portable Class Library

I would like to share my M2MQTT code between a Windows 10 universal windows platform application and a windows phone 8.1 application. Perhaps a WPF app in the future.
I've attempted to use NuGet to include M2MQTT in a portable class library (PCL). I targeted the PCL with a minimum of requirements to satisfy both project types. I receive the following error. Is it possible to reference m2mqtt in a portable class library that can be shared by both UWP and WP8.1 projects?
Attempting to gather dependencies information for package 'M2Mqtt.4.2.0.1' with respect to project 'Pcl45', targeting '.NETPortable,Version=v4.6,Profile=Profile32'
Attempting to resolve dependencies for package 'M2Mqtt.4.2.0.1' with DependencyBehavior 'Lowest'
Resolving actions to install package 'M2Mqtt.4.2.0.1'
Resolved actions to install package 'M2Mqtt.4.2.0.1'
Install failed. Rolling back...
Package 'M2Mqtt 4.2.0.1' does not exist in project 'Pcl45'
Could not install package 'M2Mqtt 4.2.0.1'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.6,Profile=Profile32', 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.
Additional Information 9/24/2015
I cloned the M2MQTT GitHub repository and noticed that there is a .pcl for Windows 8.1 and Windows phone 8.1. I didn't see support for UWP in a .pcl though.
I suppose I have my answer. No M2MQTT does not support .pcl in UWP projects.
Wondering if there are any plans to add .pcl support in the future?
Also if I might be able to use M2MQTT in Xamarin Android or Ios projects?
Additional Information 9/28/2015
Following suggestions from #Anders Gustafsson I successfully created a .pcl that I was able to consume in my UWP app and windows phone 8.1 app. No more duplication of code. Nice. Hope this will work in xamarin android and ios.
There is this warning.
Severity Code Description Project File Line Source Warning
Some NuGet packages were installed using a target framework different from
the current target framework and may need to be reinstalled. Visit
http://docs.nuget.org/docs/workflows/reinstalling-packages for more
information. Packages affected: M2Mqtt Pcl45 0 Build
M2MQTT is available as a PCL profile 32 assembly, which is capable of targeting Windows 8.1, Windows Phone 8.1 and Windows 10/UWP projects. The M2Mqtt.WinRT assembly is really a PCL Profile 32 assembly.
The problem you are facing is that this fact is not reflected in the NuGet package. In the NuGet package there are separate lib folders for win81 and wpa81 with the M2Mqtt.WinRT assembly in both. The desirable scenario would have been that there should have been a single sub-folder portable-win81+wpa81 containing the M2Mqtt.WinRT, then everything would (probably) have worked flawlessly for you.
There seems to be one workaround, although I cannot promise that it is fully reliable.
Start off creating a portable class library, but set the only target for the PCL to Windows 8.1. (If that does not work immediately, create a PCL that targets Windows 8.1 and Windows Phone 8.1, and when the PCL has been created, uncheck the Windows Phone 8.1 check box.)
Add the M2MQTT package from NuGet to your PCL. Your PCL will now reference the M2Mqtt.WinRT assembly in the win81 sub-folder.
Add Windows Phone 8.1 as a target of your PCL, so that your PCL (again) targets both Windows 8.1 and Windows Phone 8.1. You may receive warning messages from NuGet when doing this; ignore those messages.
Now, you should be able to consume the M2Mqtt.WinRT assembly from your PCL, and you should also be able to reference your PCL in a UWP application.
To add more reliability once you have managed to download the M2MQTT package from NuGet, you might manually delete and then re-add the reference to the M2Mqtt.WinRT assembly in your PCL project. That way you will short-circuit NuGet, preventing NuGet from accidentally trying to restore your M2Mqtt.WinRT reference from a non-existing (portable-win81+wpa81) directory.
I cloned the M2MQTT GitHub repository and noticed that there is a .pcl for Windows 8.1 and Windows phone 8.1. I didn't see support for UWP in a .pcl though.
I suppose I have my answer. No. M2MQTT does not currently support .pcl in UWP projects.

WPF one executable file from project

I have a WPF project with one external library. Is it possible to make one executable file "*.exe" from this project to run on windows systems even without .net? and how to insert that library into .exe file?
You will need to have the .net framework installed on the clients pc. What this says is that since .Net has been preinstalled on Windows since XP SP1, you should target your application to the runtime that is available on the system you wish to install it on. And since you are targeting WPF you will need to make sure that you have available .net 3.5 or greater. You may want to look into the Client installation of the framework since it is smaller. And you may want to look at this Stackoverflow question
i.e. from above link
Windows .Net Framework
Win 7 SP1 4
win 7 3.5.1 ( can be updated to .Net Framework 4 through windows updates )
windows vista 3.0 ( can be updated to .Net Framework 4 through windows updates )
windows XP Sp 1 2.0
You must have .net installed to use a wpf application. You can use clickonce to make the install experience more friendly to the user, if he doesn't the right version of the .net framework installed.
As for the external third party library, see my answer here for the same issue.

How can I inform the user of an XCOPY WPF 4 app that he needs to install .NET 4?

I've made a small tool application with Visual Studio 2010 which to distribute it, I zip these files from the Release folder:
Data
MainData.mdf
MainData_log.ldf
DataBackup.exe
DataBackup.exe.config
FluidKit.dll
then unzip them on the target machine (no installation).
When I run it on a Windows 7 machine with .NET 4 installed, it runs fine.
When I run it on a Vista machine with .NET 3.5 installed, it gives me this default error message:
In order to run this appication, you
need to install the following version
of .NET: v.4.0.21006 To learn how to
install this version, contact the
distributor of this application.
When I run it on an XP machine with .NET 3.0 installed, it gives me an error that doesn't that the application cannot start but doesn't mention installing .NET.
Is there anyway that I can intercept these messages to e.g. give a nice-looking, custom message with install instructions and a link to the .NET 4 download?
I think that the only solution is to make a small non-.NET application that checks if the .NET Framework is installed, and if so, launches your .NET application. For the framework detection part, see for example here: http://www.codeproject.com/KB/dotnet/DetectDotNet.aspx
Check out the Application.DispatcherUnhandledException Event... maybe you could globally catch the exception and inform your user in there about having to install .NET 4.0. Probably this can help you determine what .NET platform versions are installed, and maybe even avoid using the .NET 4 features if you see that the client machine does not have it.

Resources