0

I've made a fairly simple Windows form app, using C# in VS2012. When I copy the contents of \Bin\Release to a different folder on the (Windows 8) PC on which I made the app, everything runs fine. However, when I copy this folder to a different PC (Windows 7) and try to run the EXE, I get an immediate error from Windows:

Program has stopped working. Problem Event Name: CLR20r3 Problem Signature 09: System.IO.FileNotFoundException

The folder and it's contents are exactly the same as on the other PC, where I built the app. It includes the .EXE file, an .SDF (SQL Compact) database file and Microsoft.Office.Interop.Excel.DLL (I had to include this DLL for a certain function, but on the PC on which I built it, the standalone application runs from it's own folder without having to include this DLL, so I'm not sure if I should include it on other PC's).

So far, I've tried copying the DLL to Windows\System32, updated .NET Framework + reboot, run as Administrator.

I'm hoping to make this standalone application run on a Windows 7 PC and a Windows XP laptop. Both of them do not have Visual Studio installed. Can anyone please help me?

Ivo77
  • 71
  • 1
  • 2
  • 8
  • Not sure, but remember that if you use Interop.Excel then you need to have Office installed on the target PC. – Steve Sep 13 '14 at 07:47
  • Which version of .Net Framework are you targeting? And is that version of .Net Framework intalled on the PCs you're talking about? – RenniePet Sep 13 '14 at 07:47
  • If you look in the Windows event log the error may be logged there with the name of the file it can't find. – RenniePet Sep 13 '14 at 07:50
  • 2
    Try running [Process Monitor](http://technet.microsoft.com/en-gb/sysinternals/bb896645.aspx) while you start your application. It should show you which file open request is failing. – Richard Ev Sep 13 '14 at 07:55
  • did you build your project before copying it on another pc? – Miks Sep 13 '14 at 08:50
  • I have .Net 4.0 as my target framework. On the target PC, I have 4.5 installed. Office 2013 is also installed. I have built and rebuilt the project and ran it at least once in release mode before copying the release folder to the target PC. – Ivo77 Sep 13 '14 at 09:33
  • The error details do not refer to a particular file, except the .EXE file which I'm trying to run. Problem Event Name: CLR20r3. Problem signature 01: application.exe Problem signature 02-08: some abstract codes Problem signature 09: System.IO.FileNotFoundException Locale ID: 1043 I'm not quite sure how to use Process Monitor. It keeps building up an event list of over a million lines by now. – Ivo77 Sep 13 '14 at 09:36
  • Could be an issue to verify http://stackoverflow.com/questions/21013912/can-i-still-use-microsoft-office-interop-assemblies-with-office-2013 – Steve Sep 13 '14 at 09:36
  • Re Process Monitor, it has various filters you can use to limit the logging to only the events you are interested in. – RenniePet Sep 13 '14 at 09:51
  • Not related to your current problem, but you mention Windows XP. That implies you should stick to .Net 4.0. http://stackoverflow.com/questions/17499351/is-it-possible-to-run-a-net-4-5-app-on-xp – RenniePet Sep 13 '14 at 09:53

2 Answers2

0

Not sure, but it looks like, you are getting this error because of dotnet version mismatch. As you have mentioned you get this error immediately when you run the app. So, check your dotnet version .

StartCoding
  • 394
  • 5
  • 16
  • Um, I already suggested that 18 minutes ago. And anyway, this sort of thing is more suitable as a comment instead of as an answer. – RenniePet Sep 13 '14 at 08:08
  • @RenniePet We had this type of issue few days ago, and it was due to framework mismatch. We changed the framework and it worked. This is the reason why I posted this as answer. But I am not sure whether this works or not. So I started writing "Not sure, but it looks like, you ..." – StartCoding Sep 13 '14 at 08:14
  • I can set my target framework to either 4.0 or 4.5. Anything below that and my app won't run in VS2012. My target PC has 4.5 (updated today) and my current target framework is 4.0 (tried 4.5 as well). This doesn't seem to be the issue. – Ivo77 Sep 13 '14 at 09:38
0

Thanks for your suggestions, guys. I just stumbled over my problem:

I decided to copy the .Appplication file as well and ran it on the target PC. That gave me the following error:

"Unable to install or run the application. The application requires that assembly System.Data.SqlServerCe Version 4.0.0.0 be installed in the GAC first."

So that's what was missing. I fixed this by Publish > Application Files > SystemDataSqlServerCe.dll > set to Include, in stead of Prerequisite. Then I let VS publish my application and ran Setup.exe on the target PC. I did not want an installer of any kind, but doing so, the necessary files for using SqlServer CE were installed. After that, I could remove everything from the target PC, except for the application.exe and the database file and I could run it without any troubles. I'll do the same for the other target PC's and I'll keep my fingers crossed that this will work on XP as well.

Ivo77
  • 71
  • 1
  • 2
  • 8