积极答复者
vb.net2008 release目录复制之后exe无法执行

问题
答案
-
发现问题所在了。
iBatis.net的SqlMap.config中,设定调用的sql.xml所在位置<sqlMap resource="Maps/sql.xml">
而该sql.xml的属性中“复制到输出”被设定为“不复制”
导致bin\release中文件位置移动之后,无法执行。
解决办法:将sql.xml的属性中“复制到输出”被设定为“始终复制”
这样在bin\release中自动生成Maps/sql.xml文件,之后再整个文件夹位置移动之后,正常执行。
但是,这样做的话,sql文就没有保留的展示在别人面前了。不知道有没有更好的解决办法
- 已标记为答案 Mike FengModerator 2011年7月5日 8:54
全部回复
-
同感, 不过不是看相对路径引用,而是看绝对路径引用,尤其是DLL 引用的路径等。
Mike Feng [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
-
同感, 不过不是看相对路径引用,而是看绝对路径引用,尤其是DLL 引用的路径等。
Mike Feng [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
恩,有道理。不过引用绝对路径要怎么检索呢?或者说,在哪些文件中容易出现这样的错误呢?
毕竟程序代码一行行的check,实在是太花时间了。
多谢各位
- 已建议为答案 Mike FengModerator 2011年7月4日 6:47
- 取消建议作为答案 Mike FengModerator 2011年7月4日 6:47
-
数据库连接字符串,看看你的reference都是怎么引用的,其copy local属性是true还是false?
程序中涉及到文件保存打开操作的等等...
Mike Feng [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
-
-
数据库连接字符串,看看你的reference都是怎么引用的,其copy local属性是true还是false?
程序中涉及到文件保存打开操作的等等...
Mike Feng [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
数据库连接是写在cofig文件中,服务器名称,数据库名称,用户名\密码都是写好的。
引用外部DLL的copy local都设定为True,
文件的打开保存,是通过打开的窗口设定的,现在连窗口都无法正常打开(点击无反应),所以应该也不是这儿的错
-
发现问题所在了。
iBatis.net的SqlMap.config中,设定调用的sql.xml所在位置<sqlMap resource="Maps/sql.xml">
而该sql.xml的属性中“复制到输出”被设定为“不复制”
导致bin\release中文件位置移动之后,无法执行。
解决办法:将sql.xml的属性中“复制到输出”被设定为“始终复制”
这样在bin\release中自动生成Maps/sql.xml文件,之后再整个文件夹位置移动之后,正常执行。
但是,这样做的话,sql文就没有保留的展示在别人面前了。不知道有没有更好的解决办法
- 已标记为答案 Mike FengModerator 2011年7月5日 8:54
-
如果可以的话, 把你的SQL 文写成一个类,这样编译完了 就成DLL,别人就不能直接看见了。
Mike Feng [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
-
如果可以的话, 把你的SQL 文写成一个类,这样编译完了 就成DLL,别人就不能直接看见了。
Mike Feng [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
可是iBatis.net框架要求sql文写在xml文件中.能把xml变成一个类么?我还真不知道了
-
一定要XML 的话,你可以将这个XML 文件添加为resource, 比如我有一个名为log.xml的文件, 通过resource添加文件 添加 然后这个文件就会被编译到EXE中. 你试试.
引用的话 就可以直接用My.Resources.log引用,这样得到的是一个字符串.
Mike Feng [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.