Could not load file or assembly System, Version 2.0.0 - c#

I have a .NET application that currently builds and runs fine in a development environment but running the application on another machine is throwing this error.
The machine I am trying to run this on is running Windows Server 2012 which has .NET 4.5 baked into it. The error appears to be a .NET error however the GAC is showing the System Version 2.0.0.0 assembly installed. Also nothing is being written to Event Viewer on the application crash.
Any help or any idea of where to begin looking is appreciated.

Dan from above was correct, installing .NET 3.5 on the server fixed the error.

This link may possibly explain the error:
Make sure your .NET framework is patched.
It seems that the best explanation is that the server needs patched--but it could be the development machine as well.

Related

Moving .Net Web from Windows 2008 to Windows 2019 and .Net error

We moved the .NET WEB application from Windows 2008 to Windows 2019
and we observed the error
.NET Runtime version 4.0.30319.0 - Loading profiler failed during CoCreateInstance. Profiler CLSID: '{************************}'. HRESULT: 0x80040154. Process ID (decimal): 6880. Message ID: [0x2504].
That is certain dll file not registered.
But We suspect it is .NET 4.0 - .NET 4.8 changes causing the issue.
We ran the Dependencies Walker and please see the attached screen that it cannot find the files.
We tried to rebuild and didn't work.
What can we do at this point, thank youScreenshot of Dependencies Walker

.NET 4.0 to 4.5 migration and running on 4.0 machine exception

I have an C# application which is built on Windows Server 2012 with .NET 4.5. Now as part of the other process another machine needs to run this app.
It's probably using Process.Start to execute my .exe file. I can't say 100% because I don't have access to the code. Everything was fine when it was using .NET 4.0 but now when I've migrated to .NET 4.5 it's throwing an exception:
The specified executable is not a valid application for this OS platform
I assumed that the problem is that there is no .NET 4.5 installed on this machine so I've removed this line from the config file to support running on .NET 4.0.
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/></startup>
It still haven't helped and the same exception is being thrown.
My application references another libraries which use 4.5.1 framework but it shouldn't matter. I've read somewhere that they are treated as 4.0 application (4.5 features are not used). The build server has also changed from Windows Server 2003 to Windows Server 2012 but it shouldn't matter which OS was used to build, should it? I appreciate for any help.
The specified executable is not a valid application for this OS
platform
Your application should be built using AnyCPU platform. If you try to run an application built with Debug|x64 or Release|x64 on a 32bit OS, the whole executable won't work and you'll get that error.
Update
OP said in some comment:
Issue doesn't seem to be fixed. Does it matter that one of the referenced libraries is forced to use x86 due to C++ references?
Then, you're forced to start the process from a 32bit process.

Could not load file or assembly 'System.EnterpriseServices.Wrapper.dll'- Error in Azure

I have read all related questions and no solutions worked for me. Among them, things that I tried were:
Rebuild and published in Release mode with Any CPU platform. I also tried rebuilding and publishing with x64.
Reinstalled .Net 4.5.1
Made sure I'm referencing the correct "bit" version. Not only this but I also tried uploading to our Azure site the DLLs from this folder: {Windows dir}\Microsoft.NET\Framework64\v4.0.30319. That is the folder where .Net 4.5.1 was installed - validated in registry (regedit).
Checked and verified that our Azure website is in 64-bit mode
Verified that the target framework in VS is .Net Framework 4.5.1 - I'm using VS 2013
Our site is built with nopcommerce v3.3. I'm thinking that the issue is not caused by the nopcommerce project. The site runs on my local machine. I also researched on Azure support for .net 4.5.1 and found this page stating that Azure supports 4.5.1 since March.
With all those information what else could I be missing? Thanks in advance.
By the way here's the exception details:
Exception Details: System.BadImageFormatException: Could not load file
or assembly 'System.EnterpriseServices.Wrapper.dll' or one of its
dependencies. The module was expected to contain an assembly manifest.
I've researched on that too (BadImageFormatException) and the suggestion was to build with "Any CPU" that I already did. My local machine is running on Windows 7 SP1 64-bit from which the project was built - not sure if this is related to the problem.

Running .NET 4 application with Mono

I'm trying to run a .NET exe on a Ubuntu machine (I installed the package mono-complete), so far with no luck. The application is compiled with Visual C# Express 2010 under .NET 4 (Client Profile).
I try executing the program with the following command:
mono application.exe
However, I get the following error:
WARNING: The runtime version supported
by this application is unavailable.
Using default runtime: v1.1.4322
** (application.exe:5586): WARNING **: Missing method
System.Windows.Forms.Application::SetCompatibleTextRenderingDefault(bool)
in assembly
/usr/lib/mono/gac/System.Windows.Forms/1.0.5000.0__b77a5c561934e089/System.Windows.Forms.dll,
referenced in assembly
/media/disk/application.exe
Unhandled Exception:
System.MissingMethodException: Method
not found:
'System.Windows.Forms.Application.SetCompatibleTextRenderingDefault'.
It's suppose to be using .NET 4, not 1, but I don't know how to set it. I tried
mono --runtime=4.0.30319.1 application.exe
But that didn't work either.
Any help would be appreciated.
Sounds like you're experiencing this bug:
My Doc's Got No Nodes: .net 4 Client Profile on Mono 2.8
That is assuming you installed > Mono 2.8 (which was the first release to support .NET 4.0). If not, you should install a more recent Mono package.
The other thing to keep in mind is that Mono doesn't support the entirety of WinForms. Unless you developed your application with Mono in mind, there's a good chance you'll find that something you used isn't supported.
I suspect the exception is because the method System.Windows.Forms.Application.SetCompatibleTextRenderingDefault hasn't been implemented. Have you ran the tool through the Mono Migration Analyzer (MoMA), should help in knowing whether your application is compatible with mono. From that point you can possibly workaround the problem, maybe even incorporating the missing method in your code.
Current mono-complete package (even on Ubuntu Natty) uses mono 2.6.7 which doesn't support .NET 4.0 API. You'll have to build newest version of mono, which is the best way to get a chance of using 4.0 API. "Complete" support of .NET 4.0 is however planned in mono 3.0.
Install Monodevelop and just right click on the example.csprj that is a C#.NET project in linux and click on Monodevelop.

User cannot run C# released app - "The application failed to init.properly"

I am desperate due to this problem:
I have created and built app which works fine on mine and my colleagues PC. However, third user reports that with .NET 3.5 the app reports:
"The application failed to init.properly" and with .NET 4.0 "Unable to find the version of runtime to run this application“.
Could you please advice? It was built with 3.5.
EDIT:After installing 3.5 SP2, there is no error message. It just does not execute :(
Thanks
For .NET 4.0 version problem is that the framework is not installed on the users PC.
For .NET 3.5 if you are sure that the needed version of framework installed then most probably user doesn't have access to some system file required by the application.

Categories

Resources