临时调试版本和最终应用程序版本
我有一个关于 VS 2008 中的调试和发布的快速问题。
我有一个我一直在开发的应用程序 - 它尚未完成,但大部分功能已经存在。所以基本上我现在正试图将它的副本提供给帮助文档的人 - 这样他们就可以玩一下并感受我所做的事情。
现在的问题是如何将其提供给他们。我被告知只需将 .exe 从 debug/bin 文件夹中复制出来,然后将其放到 USB 上。但是在测试时,如果我在其他地方(此文件夹之外)运行此 .exe,它就会崩溃。我现在已经弄清楚了为什么会这样:
var path = ConfigurationManager.AppSettings["PathToUse"];
var files = Directory.GetFiles(path);
抛出空引用,因此 App.config 文件未被使用。如果我将该文件与 .exe 一起复制,它会再次工作。
所以实际上我的问题是关于管理这种情况的最佳方法。向人们提供工作副本的最佳方式是什么?是否有关于准备发布应用程序的参考 - 因此所有内容都打包在一起并安装在干净的结构化文件夹层次结构中?
I have a quick question regarding debug and release in VS 2008.
I have an app i've been working on - its not yet complete but the bulk of the functionality is there. So basically i'm trying to give a copy of it now to the person helping with documentation - just so they can have a play and get the feel for what i've made.
Now the question is how to provide it to them. I was told to just copy the .exe out of the debug/bin folder and put that onto USB. But when testing, if I run this .exe anywhere else (outside of this folder) it crashes. I've now worked out why this is:
var path = ConfigurationManager.AppSettings["PathToUse"];
var files = Directory.GetFiles(path);
throws a null reference, so that App.config file is not being used. If I copy that file in with the .exe it works again.
So actually my question is regarding the best way to manage this situation. What is the best way to provide a working copy to people, and, is there a reference on preparing apps for release - so everything is packaged together and installed in a clean structured folder heirarchy?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果你想安全的话,请获取 debug/bin 文件夹中的所有内容。如果用VS中的下拉框改成release再编译工程,release/bin文件夹里的文件会少一些,因为很多debug相关的文件都没有包含进去。
如果您引用了第三方 DLL,例如您下载了 log4net 或类似的东西,那么您只需将它们放在与 exe 相同的文件夹中即可。这称为并行部署,在我看来这是最简单且最容易测试的。
您可以搜索 XCOPY 部署以了解有关您正在尝试执行的操作的更多信息。
您可以采取另一个步骤,将 bin 文件夹压缩为 zip 文件等存档,以便用户轻松提取它们,或者您可以使用 WIX 或 NSIS 等工具创建安装程序来提取和复制文件。
If you want to be safe grab everything in the debug/bin folder. If you use the drop down in VS to change to release and then compile the project, there will be fewer files in the release/bin folder because many debug related files are not included.
If there are third party DLLs you are referencing, like if you downloaded log4net or something like that, then you can simply put them in the same folder as the exe. This is called side-by-side deployment, and in my opinion is the simplest and easiest to test.
You can search for XCOPY deployment to learn more about what you are trying to do.
You can take another step of compressing the bin folder into an archive like a zip file to make it easy for the user to extract them, or you could use a tool like WIX or NSIS to create an installer to extract and copy the files.