Application done in Windows XP SP3 not working in Windows 7 - wpf

I have done a WPF appliction using VS 2008 SP1 in Windows XP SP3. I copy the exe and dlls to my Windows 7 RC build 7100 machine. But the exe is not working. When I doubleclick on the exe, a message comes like 'Application stop working. windows is gathering the information'. Why this happends?
I am overriding the OnStartup function in App.xaml.cs to create single instance of application. and also I am using DllImports for kernel32.dll, powrprof.dll, advapi32.dll and user32.dll. I use a Date control from the WPFToolkit

Have you tried to run in Backwards Compatibility Mode, by Right clicking the exe and going to the Compatiblity tab and trying different settings?
Also, did you test in more than one Windows 7 machine, to actually confirm its due to the Operating System difference and not due to a possible Framework installation problem?

Given that you are importing kernel32.dll, powerprof.dll, advapi32.dll, and user32.dll, my first guess is that you are running into a DLL-Hell problem. There is no concurrent versioning of those DLL's like there is with .NET assemblies. Make sure that the signatures you are importing have not been broken in the version of Windows 7 you are using.

Related

Windows forms app (visual studio 2010) compatibility issues

My task is to make a simple application that connects to the internet (using Wininet) and downloads a text file. It then displays the data in a listBox widget. The requirement was to make a GUI based application, so I used Windows Forms in Visual Studio Express 2010.
The application runs fine on my PC, however I realized that it runs only on my PC. I installed .Net 4 and Visual Studio 2010 redistributables on another PC and it worked fine there. Now, the person for whom I'm making this wants maximum compatibility on windows PCs. I'm totally stuck here.. should I switch to an older version of VSE?
From what I could search, using /MT instead of /MD would cause the application to link statically, however my app also uses /CLR and these are incompatible.
Any ideas?
Note: I've previously made a similar app (downloading and displaying) with console output and it works perfectly fine everywhere.
Dependens on what is meant by "maximum compatibility on windows PCs". If you can bundle the required redistributables, your program should run (as you found on the second PC), as long as the windows on the PC is capable of executing the binaries (e.g. not a 32 bit PC trying to execute 64 bit binaries)
I have been in your situation.
I can give you my free .NET-application-runner (RunNetApp.exe) that automatically installs .NET Framework 4 before running your application for the first time. If the framework is already installed on target machine, it only runs your application.
I also suggest changing application's framework to ".NET Framework 4 Client Profile". It's setup is about 40MB (in comparison to 200MB of full ".NET framework 4").
Is it helpful?

WPF is running well on development machine, but cannot run on other machines

I've got a problem with an wpf application.
I programming a wpf application with sharpdevelop 4.1.8000, it complied successful and is running well on the development machine.
When I copy the files from bin\debug to other machines (include the third part dll I used in project), the tool can't startup. I got a exception, the exception component is System.Windows.Markup.XamlParse. I don't know why this happened.
So I need your help. By the way, the development machine is win7 x64 enterprise, the version of .net framework is 4.0. The deployment machine were win7 x64, too.
Check your xaml namespaces, did you reference something that is in the GAC of your develop machine but bot present on the other client. Happened to me using a behaviour from System.Windows.Interactivity, worked on my dev machine because i had Blend installed but which wasn´t the case on the client.

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.

some troubles with WPF and Windows XP

is .net framework 3 compatible with xp? i install visual studio 9.0 (.net 3.5) on win XP. when i compile a WPF project and try to run it, this error occurs:
cannot initialize application ...... at address 0x<some digits>
(antivirus protection is off)
after first fail of wpf, all other project types (windows application, console &...) after compiling don't run.
where is problem?
WPF and .NET 3.5sp1 are supported on XP. You can create WPF applications with run on Windows XP.
It sounds like you have some other issue on your XP system. If other project types (ie: console) are failing, this is most likely some other, more serious issue.
Edit:
The System Requirements for .NET 3.5sp1, including WPF, are listed here. Basically, you need to have XPsp2 or better if you're using 32bit Windows XP, but both 32bit and 64bit XP are supported fully.

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