异常消息中的C#本地目录引用

时间:2013-08-09 14:54:37

标签: c# visual-studio-2010 exception-handling

我已经使用Visual Studio 2010在C#中为我的公司发布了一个可执行文件。但问题是,每次抛出异常时,它都会继续引用回到我的本地目录,其中捕获了代码行号。不是它当前所处的环境。

Unhandled Exception: System.ArgumentException: There is already a tab with the same name. Rename it please
   at CSVToXLSX.ApplicationArguments..ctor(String[] args) in C:\Users\zhangh9\Do
      cuments\Projects\CSVToXLSX\CSVToXLSX\ApplicationArguments.cs:line 133
   at CSVToXLSX.Program.XlsxCreator(String[] args) in C:\Users\zhangh9\Documents
      \Projects\CSVToXLSX\CSVToXLSX\Program.cs:line 16
   at CSVToXLSX.Program.Main(String[] args) in C:\Users\zhangh9\Documents\Projec
       ts\CSVToXLSX\CSVToXLSX\Program.cs:line 11

无论如何我可以删除整个部分,或者按照我希望的方式自定义/配置它吗?

1 个答案:

答案 0 :(得分:0)

这将是构建可执行文件的位置,您只能通过更改该位置并在构建时将其移动到其他位置来更改它。

更好的解决方案是处理异常,而不是以这种方式向用户冒泡。