Click here to Skip to main content
15,890,995 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a solution with 2 projects and I want to publish this application. Publish is successful, but when I try to install I get a problem. It says that it can't find a txt file I'm using. In my application, I use 2 other txt files, as well, and it doesn't show a problem regarding those 2 txt files. The error is shown below. Does anyone know what the problem might be? Thank you in advance!

See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IO.FileNotFoundException: Could not find file 'C:\Users\Δημήτρης\AppData\Local\Apps\2.0\16302ORR.AW8\MB0AX4OD.0OL\auth..tion_4deb94c49aed6906_0001.0000_30081526368df596\checkStatus.txt'.
File name: 'C:\Users\Δημήτρης\AppData\Local\Apps\2.0\16302ORR.AW8\MB0AX4OD.0OL\auth..tion_4deb94c49aed6906_0001.0000_30081526368df596\checkStatus.txt'
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
   at System.IO.StreamReader..ctor(String path, Boolean detectEncodingFromByteOrderMarks)
   at AuthenticationApplication.Form1.Form1_Load(Object sender, EventArgs e)
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)



************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5444 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
----------------------------------------
AuthenticationApplication
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/Δημήτρης/AppData/Local/Apps/2.0/16302ORR.AW8/MB0AX4OD.0OL/auth..tion_4deb94c49aed6906_0001.0000_30081526368df596/AuthenticationApplication.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)
Posted
Updated 26-May-11 13:44pm
v2
Comments
Wonde Tadesse 26-May-11 19:48pm    
Have you include your txt files in the setup solution?
Dimitrios Zlitidis 26-May-11 22:07pm    
How do I do this...? :-)
Wonde Tadesse 26-May-11 22:16pm    
See my answer.
Dimitrios Zlitidis 27-May-11 8:28am    
I'll check it right now and I'll tell you.. Thanks! :-)
Albert Holguin 26-May-11 22:16pm    
does it do this when you run your application or the installer?

1 solution

Well, I am assuming that you are using Visual Studio Set Up application. So here are the steps how to include additional files and folder in you set up package.

How to create a Setup package by using Visual Studio .NET[^]

[EDITED]
In addition to this, you have to make sure that how your application reads the file. When you implement your application, is it supposed to read from common files folder, shared folder , current user folder... Even operating system has impact for such case.

Good luck.
 
Share this answer
 
v2
Comments
Dimitrios Zlitidis 27-May-11 11:04am    
I tried it. I included the three txt files I'm using. The installation is successful. When I try to run the application at the time it uses the txt files, it pops a message saying that the access to the txt file is denied. I go manually and change the permissions and give write permissions. Then it runs properly. Is there a way I can give permissions, so I don't have to give permissions manually after its installation? Thank you very much for your reply! :-)
Wonde Tadesse 27-May-11 13:25pm    
Good. This is permission issue. Your application doesn't have the right permission to access your files.
1. Try to run your app. as an Administrative privilege. Take a look at the following wiki.
http://en.wikipedia.org/wiki/User_Account_Control#Requesting%5Felevation
2. If you are installing in Vista or Window 7.You might need to disable UAC.
http://stackoverflow.com/questions/946420/allow-access-permission-to-write-in-program-files-of-windows-7
Dimitrios Zlitidis 27-May-11 22:32pm    
Great! I disabled UAC and now it works just fine... Thank you very much!
Wonde Tadesse 28-May-11 8:25am    
Anytime :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900