Why does MySql.NET driver need .NET 2.0 for a .NET 4 application - mysql-connector

I am rolling out a WPF application which uses Entity Framework but also has MySqlConnection connections.
On Windows 7 the rollout is fine with just .net 4 installed, but on SOME older hardware running XP I have run into difficulties.
The symptoms are varied.
I install the driver and Entity Framework operations are successful but MySqlCommands fail - the event viewer either (depending on which machine) shows a FileNotFound Exception or it shows an exception relating to the .NET 2 optimiser.
I install the driver and nothing works - the error is that the driver failed to load.
I attempt to load the driver but the install complains that either .net 4 or .net 2 needs to be installed even though .net 4 is present.
One XP workstation out of the half dozen or so I have tried worked perfectly first time - what I noticed on this machine was that .net versions 1.1, 2.0, 3.5 and 4 were all present before I performed the MySql connector installation.
I am going to try uninstalling .net 4, reinstall .net 2 and then install the MySql connectors to see if that resolves the problem, but if I am honest I am hacking away at this without really knowing what the underlying issue is.
Can anyone enlighten me ?

What we found was that those workstations that had .NET 4 'Extended' preinstalled, and those that had a full 2, 3.5, 4.0 history of .NET preinstalled worked without a problem.
The workstations that only had .NET 4 'Client Profile' installed were not supported by, or did not support, the MySqlConnector. We found this to be true for a number of different MySqlConnector versions.

Related

Deploying .NET Framework 4.5 with Installshield

I have written an application that I deploy via Clickonce, but I want to deploy it via Installshield, so I am experimenting with it. I found and downloaded dotnetfx45_full_x86_x64.exe, the redistributable for .NET Framework 4.5, and made a Installshield prerequisite from it. I wrote a simple application that has a RDLC report that just says “Hello World”, and it needs .NET Framework 4.5, and used Installshield to deploy it. The Reportviewer needs Microsoft SQLClrTypes_x86.msi and SQLClrTypes_x64.msi, and ReportViewer.msi, so I got those and made Installshield prerequisites from them. For the ReportViewer.prq, I specified SQLClrTypes_x86.prq and SQLClrTypes_x64.prq, as dependencies, and for SQLClrTypes_x86.prq and SQLClrTypes_x64.prq I specified dotnetfx45_full_x86_x64.prq as a dependency.
When I installed my little application on my test computer (running Windows 7), it installed the 4.5 framework, said it needed to reboot, and asked if I wanted to reboot now, and I clicked Yes. I was thinking it would reboot and continue the installation, but when it rebooted, that was the end of the installation. I ran setup again, it asked if I wanted to install the 4.5 Framework (it asked me the first time, too), so I clicked No. After clicking No, it installed the rest of my program, and it ran perfectly.
How can I get the installation to continue after it reboots from installing the .NET Framework 4.5?
Thanks
Here's a blog I wrote about 9 years ago:
Using InstallShield 12 to Install .NET Framework 3.0
It hasn't changed much. You want to use the prereq editor to change the reboot behavior to Note it, fail to resume if the machine is rebooted, and reboot after the installation.
Also please note that InstallShield consumes it's PRQ files from the ISProductFolder (C:\Program Files (x86)\InstallShield.... ) I don't care for this from a CM perspective. I recommend isolating the file and file references to relative paths based on ISProjectFolder and keeping all of these files in your source control tool.
Behavior Tab

Running the "migrate.exe" for entity framework 6.0.2 migrations in Windows 2003 and XP "Not a valid win32 application" exception

Our product needs to be compatible with versions of windows including Server 2003 and XP.
We have code first entity framework projects with various migrations.
We are deploying these migrations to create or update a database using the "migrate.exe", file version 6.0.21211.0, supplied in entity framework 6.0.2 nuget package.
When using XP itself with visual studio 2010 or Windows 7 with visual studio 2013 to install the package every time we run "migrate.exe", on an xp or server 2003 machine, we are getting a "not a valid win32 application" exception.
Is there a good reason why "migrate.exe" will not run on windows xp and windows server 2003 other than the fact they are operating systems that nobody really wants to support any more?
I managed to resolve this issue by downloading the source code for 6.0.2 version of entity framework, un-signing it in properties, then building it through .net 4.0 and not 4.5 by changing the solution configurations to Release40.
Source code can be found here:
http://entityframework.codeplex.com/SourceControl/changeset/7648d33dfb53589d9c32b605c61758a5a6c0b80b
I found it quite difficult to locate it.
You probably don't have .NET Framework installed on the machines where it fails.
(As a side note I believe both XP and 2003 go out of support soon so you may want to upgrade your environment...)

C# application .Net 2.0 Couldn't run in Windows XP

I built a .Net 2.0 Application for Windows XP but I made it in Windows 7.
The application contains a Mysql.data connection and CrystalReport. When I try to run it on Windows XP, the application does not run, giving an error message of:
The application failed to initialize properly (0xc000007b).
I tried to rebuild application in Windows XP, but when I rebuilt and ran it in Visual Studio, the following error occurs:
Could not load file or assembly or one of its dependencies. The module was expected to contain an assembly manifest.
How can I fix this?
Please try the following:
1.Uninstall the .NET Framework 3.5 from Add/Remove Programs (in the Control Panel) on Windows XP or Programs and Features on Windows Vista/Windows 7.
Even if the uninstall fails, go on to step 2.
2.After the Framework 3.5 has been uninstalled or if it failed, download and run the .NET Framework removal tool.
Here's the link to Aaron Stebner's Framework Removal tool on Windows Live Skydrive:
http://cid-27e6a35d1a492af7.skydrive.live.com/self.aspx/Blog_Tools/dotnetfx_cleanup_tool.zip?wa=wsignin1.0&sa=17797669
Aaron Stebner is a Microsoft employee. The tool he's developed is linked on that page and makes easy work of cleaning up damaged .NET Frameworks from your system so they can be reinstalled. When you run the tool, choose the .NET Framework 3.5 from the list and choose to cleanup. After this is done, reinstall the .NET Framework 3.5 that Design 3 needs by running the Expression Design 3 setup package again. It will detect that the .NET Framework 3.5 is missing and reinstall it for you. After that's done, try running Design 3 again.
3.If that still fails to resolve the problem, go to START, RUN and type CMD to run a command prompt. Type CHKDSK /R and hit ENTER. Hit the letter Y and restart the machine. Allow the machine to do the check disk scan. After this is done and it goes back into Windows, try Expression Design again.
more information here

How to manually install .Net 4.0.x and 4.5 on XP

XP isn't a supported OS for .NET 4.5. This is a known issue.
I read a few months back that the reason XP can't install 4.5 is because there are kernel API that 4.5 calls which don't exist on XP. I also read that it would be possible to inject your own implementation of the 'new' kernel calls to an XP machine - and 4.5 could run.
I can no longer find this information. Does anyone know more about this?
A second, but related, question is - how can I take upgraded .Net 4.0 libraries from a windows 7 machine (which had 4.5 installed) and inject them into an xp machine? I believe I read that the implemention files of 4.5 are actually the same as the 4.0 files, there are not two sets. And in fact, the two .net folders (4.0 and 4.5) are only the interfaces - which link back to these same files. If this is the case, then a manual injection of the 4.0 files would likely need the solution to my first question.
In short - does anyone have more information about hacking/manually upgraded .net for xp?

Make .NET Framework 4 wpf application portable or more reliable to install

I am required to create a simple application. Since I am good at WPF and I don't know win forms that good I implemented my application by creating a .Net Framework 4.0 WPF project in Visual Studio. Everything works great the application runs like it is supposed to.
Since the application is required to run in multiple platforms (Windows XP and above) I am including the prerequisites when publishing my applications. The prerequisites happen to be:
1) WIC (Windows Imaging Component) old computers need that to run the .net framework 4.0
2) Windows installer 3.1 (needed in order to install the next prerequisite)
3) Windows .NET Framework 4.0 Client Profile
If I install those prerequisites then the application runs like it is supposed to.
Now the problem is:
My boss did not approve my application because he tried installing it in a Windows XP machine with SP2 and this are the things that happened:
Step 1)
// first prerequisite (WIC) took less than 1 minute to install everything
// is working great so far.
Step 2)
// second prerequisite (Windows Installer 3.1) takes about 2 minutes to install
// which is great. After the installation is done the computer needs to be
// restarted in order to continue with the installation. Things are not going
// that good now but we are still ok...
Step 3)
// After the computer is done rebooting it continues with the last prerequisite
// (Windows .NET Framework 4.0 Client Profile). That takes 10 minutes to install!!!!
Step 4)
// My application has all the prerequisites needed to be installed so it installs in
// about 1 minute
We recorded the time, and the application took about 25 minutes to install from start to finish. The computer where we tested the installation was a virtual computer using 2 cores and 1 GB of memory with 3.1 GHZ.
What do you guys recommend in order to speed up this installation? Should I use a different technology such as windows forms using .net 2.0? It will be nice if I can deploy the application that I have already created. If you guys could help me make this application portable I will really appreciate it. In order to do so I tried building my application with all the required references copied to the output directory. That did not work... Or any ideas of how to make the installation be faster will be of great help as well.
If you're using .NET Framework 4.0 (which is not going to come out-of-the-box with any versions of Windows, especially Windows XP) there's no way to get around the install of .NET 4.0 on the target machine. Your major bottleneck is going to be the download of .NET 4.0 files from Microsoft to the machine.
I've run into similar problems where the initial install of an application takes forever because of the .NET 4.0 download and install. We even encountered an issue where the application couldn't be install because there was insufficient disk space for the download.
One option would be to pre-push the prereqs out to all the machines you'll be install this on before deploying your application.
Otherwise, you might be forced to use an older version of the .NET framework. Here's a list of the framework versions which shipped with various versions of windows.
http://blogs.msdn.com/b/astebner/archive/2007/03/14/mailbag-what-version-of-the-net-framework-is-included-in-what-version-of-the-os.aspx
Unfortunately, if your organization is committed to using a 10 year old operating system then they either need to accept that modern tools will require a lengthy install process while all prereqs are loaded... or else force you to use a 10 year old software technolgy.