在VS2012中发布后运行应用程序的问题 [英] problem with run application after publish in VS2012

查看:52
本文介绍了在VS2012中发布后运行应用程序的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

i在2012年创建了一个Windows窗体应用程序,当发布这个并安装并运行我得到这个错误:(



找不到路径的一部分'C:\Users\SadeQ \ AppData \ Local \ Apps \2.0 \ 5ELTCO6N.RGC \ Data'

见最后有关调用

实时(JIT)调试而不是此对话框的详细信息。



**** **********异常文本**************

System.IO.DirectoryNotFoundException:找不到路径'C的一部分:\ Users\SadeQ \ AppData \ Local \Apps \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\在System.IO.FileSystemEnumerableIterator`1.CommonInit()

at System.IO.FileSystemEnumerableIterator`1..ctor(String path,String originalUserPath,String searchPattern) ,SearchOption searchOption,SearchResultHandle r`1 resultHandler,Boolean checkHost)

在System.IO.DirectoryInfo.InternalGetDirectories(String searchPattern,SearchOption searchOption)

at System.IO.DirectoryInfo.GetDirectories()<在Autorun.Form1.Form1_Load(对象发件人,EventArgs e)上的

在System.Windows.Forms.Form.OnLoad(EventArgs e)的


在System.Windows.Forms.Form.OnCreateControl()

在System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)

在System.Windows.Forms.Control .CreateControl()

在System.Windows.Forms.Control.WmShowWindow(Message& m)

在System.Windows.Forms.Control.WndProc(Message& m)

在System.Windows.Forms.ScrollableControl.WndProc(Message& m)
(消息& m)
System.Windows.Forms.Form.WmShowWindow上的
(消息& m)
$ b System.Windows.Forms.Form.WndProc上的$ b(消息& m)

在System.Windows.Forms.Control.ControlNativeWindow.OnMessage(消息& m)

在System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

在System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd,Int32 msg,IntPtr wparam,IntPtr lparam)





**************已装载的装配************ **

mscorlib

汇编版本:4.0.0.0

Win32版本:4.0.30319.17929内容:FX45RTMREL

CodeBase:file:/// C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll

---------------- --- ---------------------

Autorun

汇编版本:1.0.0.0

Win32版本:1.0.0.0

CodeBase:file:/// C:/Users/SadeQ/AppData/Local/Apps/2.0/5ELTCO6N.RGC/2QVLQ2M4.3VG/auto..tion_e40b3abd960f3d93_0001 .0000_269312d74a6f2509 / Autorun.exe

------------------------------------ ----

System.Windows.Forms

汇编版本:4.0.0.0

Win32版本:4.0.30319.17929内容:FX45RTMREL

CodeBase:file:/// C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

----------------------------------------

System.Drawing

汇编版本:4.0.0.0

Win32版本:4.0.30319.17929内容:FX45RTMREL

CodeBase:file :/// C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

-------- ------------------------- -------

系统

汇编版本:4.0.0.0

Win32版本:4.0.30319.17929建立者:FX45RTMREL

CodeBase:file:/// C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

--- -------------------------------------

System.Configuration

汇编版本:4.0.0.0

Win32版本:4.0.30319.17929内容:FX45RTMREL

CodeBase:file:/// C:/ Windows / Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

----------------- -----------------------

System.Xml

汇编版本:4.0.0.0

Win32版本:4.0.30319.17929内容:FX45RTMREL

CodeBase:file:/// C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4。 0_4.0.0.0__b77a5c561934e089 / System.Xml.dll

------------------------------- ---------



****** ******** JIT调试**************

要启用实时(JIT)调试,请使用.config文件

应用程序或计算机(machine.config)必须在system.windows.forms部分设置

jitDebugging值。

应用程序必须也可以通过调试编译

启用。



例如:



< configuration>

< system.windows.forms jitdebugging =true>





启用JIT调试时,任何未处理的异常

将被发送到计算机上注册的JIT调试器

而不是由此对话框处理。



(SadeQ是我的用户)



i创建了一个文件夹Data并将其放入/ bin / Debug / Data

我的c#代码访问文件夹数据





  private   void  For m1_Load( object  sender,EventArgs e)
{
System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(System.AppDomain.CurrentDomain.BaseDirectory + @ \ Data);
foreach var 文件夹 dir.GetDirectories())
{
listBox1.Items.Add(folder.Name);
}
listBox1.SelectedIndex = 0 ;
}

解决方案

可能是权限和/或文件夹创建问题:你真的不应该'试图在您的应用程序文件夹下存储任何数据(或您更改的任何其他内容),因为对程序文件和相关文件夹的访问比以前更严格,并且可能更加严格 - 这个想法是为了防止意外的故意更改程序及其组件,以及确保tit更容易备份数据文件。



相反,请查看使用Windows特殊位置存储数据 - 这很容易,未来的专业和更安全。这可以提供帮助:我应该在哪里存储数据? [ ^ ]

您提供的路径存在问题。请重新查看数据文件夹的路径。它无法在你的loacl系统中找到指定的路径。 Plz让我知道它仍无法正常工作。


hello,
i created a windows form application in vs 2012 ,when published this and install and run i get this erro :(

Could not find a part of the path 'C:\Users\SadeQ\AppData\Local\Apps\2.0\5ELTCO6N.RGC\Data'
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\SadeQ\AppData\Local\Apps\2.0\5ELTCO6N.RGC\Data'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileSystemEnumerableIterator`1.CommonInit()
at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
at System.IO.DirectoryInfo.InternalGetDirectories(String searchPattern, SearchOption searchOption)
at System.IO.DirectoryInfo.GetDirectories()
at Autorun.Form1.Form1_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
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.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(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: 4.0.0.0
Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
Autorun
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Users/SadeQ/AppData/Local/Apps/2.0/5ELTCO6N.RGC/2QVLQ2M4.3VG/auto..tion_e40b3abd960f3d93_0001.0000_269312d74a6f2509/Autorun.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.17929 built by: FX45RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitdebugging="true">


When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

(SadeQ is my user)

i created a folder "Data" and put this in /bin/Debug/Data
my c# code for access folder "Data"


private void Form1_Load(object sender, EventArgs e)
{
    System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(System.AppDomain.CurrentDomain.BaseDirectory + @"\Data");
    foreach (var folder in dir.GetDirectories())
    {
        listBox1.Items.Add(folder.Name);
    }
    listBox1.SelectedIndex = 0;
}

解决方案

Probably, it is a permissions and / or folder creation problem: you really shouldn't be trying to store any data (or anything else you change) under your application folder, as access to "Program Files" and related folders is tighter than it was, and likely to get tighter - the idea is to prevent accidental of deliberate changes to programs and their components, and also to ensure tit is easier to backup data files.

Instead, look at using the Windows special locations to store data - it's easy, future proff and safer. This can help: Where should I store my data?[^]


There is problem with the path you provide. Please re cehck with the path of the data folder. Its unable to find the specified path in you loacl system. Plz let me know it it still not working.


这篇关于在VS2012中发布后运行应用程序的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆