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

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...)

Related

ServerManager.exe -This application could not be started

I have problem on Windows Server 2019, all application which use .Net cannot be started. I have 4.8 version with all windows update. But I get this error. I tried reinstall, use fix tool for .NetFramework but i cannot fix .NetFramework
enter image description here
We just found this solution. (https://techcommunity.microsoft.com/t5/windows-server-for-it-pro/windows-server-2019-and-net-4-8/m-p/2660319)
I ran into this issue after the Windows Update, Cumulative Update for .NET Framework (KB5006765), was installed on a Windows Server 2019 that also had Azure AD Connect installed. Apparently, a bunch of .NET registry items where deleted. Server Manager and any software built on .NET was not working...throwing this error:
This application requires one of the following versions of the .NET Framework: v4.0.30319
Do you want to install this .NET Framework version now?
DSIM and SFC repairs did not work, nor did rolling back the Windows Update.
Found some insight here:
https://www.bleepingcomputer.com/forums/t/758800/net-48-kills-server-2019/
Ended up having to import these registry items from a working system:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0,Profile=Client]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0.1]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0.1,Profile=Client]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0.2]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0.2,Profile=Client]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0.3]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0.3,Profile=Client]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.5]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.5.1]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.5.2]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.5.3]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.6]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.6.1]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.6.2]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.7]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.7.1]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.7.2]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\Client]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\Default]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319]
"AspNetEnforceViewStateMac"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0,Profile=Client]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0.1]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0.1,Profile=Client]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0.2]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0.2,Profile=Client]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0.3]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.0.3,Profile=Client]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.5]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.5.1]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.5.2]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.5.3]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.6]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.6.1]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.6.2]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.7]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.7.1]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.7.2]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs\Client]
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319\SKUs\Default

PowerShell not working on Windows 2008 R2

I have accidently installed .Net 4.5 on my Windows Server 2008 R2 for PowerShell 5.1, but now I have reverted to .Net 4.0 version and now the PowerShell is not working. It gives below error.
Windows PowerShell terminated with the following error: Method not found: 'System.Threading.Tasks.Task System.Threading.Tasks.Task.Run(System.Action)'
What should I do to resolve this?
Perhaps this is the same issue you have: https://michlstechblog.info/blog/powershell-method-not-found-system-threading-tasks-task-system-threading-tasks-task-runsystem-action/
If that does not work for you, you can always reinstall Powershell 3.0. Download it from https://www.microsoft.com/en-us/download/details.aspx?id=34595
You can also install a higher version if you would like. It would do no harm. Reinstall will require a reboot as they come in the form of KBs.
You will need to download Windows Management Framework 3.0 or install Microsoft .NET Framework 4.5 to correct your issue.
Windows Management Framework 3.0 - link
Microsoft .NET Framework 4.0 - link
or you can get
Windows Management Framework 4.0 - link
Microsoft .NET Framework 4.5 - link

Entity Framework 6.0.2 not working in Coded UI project on build machine

I am trying to read values from a table using Entity Framework 6.0.2 in my Coded UI project. The code works in developer system but in our build machine we are getting the following error in the line Database.SqlQuery(sqlQuery, parameters).ToList();
An exception of type 'System.Data.Entity.Core.ProviderIncompatibleException' occurred in EntityFramework.dll but
was not handled in user code
and the Inner exception is
Method not found: 'System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher System.Data.Entity.Infrastructure.Interception.DbDispatchers.get_Connection()'.
Please see the details of developer machine and build machine below
Developer Machine
Windows 7 Enterprise operating system (64 bit), Visual Studio Premium 2013 with Update 4, Entity Framework 6.0.2
Build Machine
Windows Server 2008 R2 Standard operating system (64 bit), Visual Studio Premium 2013 with Update 2, Entity Framework 6.0.2
The only difference which I could notice is the Visual Studio update but unfortunately we can not update the build machine with update 4. Another observation is, on build machine I am able to connect to database using Entity Framework 6.0.2 in my console application. The issue comes only with my Coded UI project and on that build machine.
Just to summarise the issue
Coded UI is able to connect to database using EF 6.0.2 on developer machine.
Coded UI is not able to connect to database using EF 6.0.2 on build machine.
Console application is able to connect to database using EF 6.0.2 on build machine.
Please let me know anyone has come across this issue and please let me know the solution.
Thanks,
Deepak

Is Windows SDK for Windows Server 2008 a dependency for Visual C++ and C#?

When I installed Microsoft Visual C++ and C# 2008 Express, I got "Microsoft Windows SDK for Windows Server 2008" added in.
I want to know if I can remove it and still have all the functionality of Visual C++/C#.
Strange, I remember it was shipped with Vista RTM headers (The Microsoft Windows Software Development Kit Update for Windows Vista version). Looks like Microsoft updated the SDK bundled with Express.
Anyway, the SDK is responsible for a lot of features in Visual Studio. For example, Visual Studio invokes sgen.exe to generate XML serializer assemblies, and call rc.exe to compile a resource script. Chances are you can't get away without it if you are not writing hello-world apps.

Ado.net entity data model template missing in visual studio 2010

Environment: Vista, VS2010 SP1
Apologize if I seem to be repeating this but I have spent a day on this. Last ditch attempt before I reinstall VS2010!!
I tried
1. devenv /installvstemplates
2. uninstalled EF 4.1 and installed 4.0 CTP 5 and now it's not even opening VS2010. Asking me to install SP1 again!!
I used Web Platform INstaller to install SP1 and EF.
Most of the posts was on VS2008 and different scenarios. SO really not sure what happened here.
Thanks in advance for your time
-Soni