控制台项目.如果发布,如何更改属性? [英] Console project. If published, how do you change properties?

查看:72
本文介绍了控制台项目.如果发布,如何更改属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个将在Windows Task Scheduler中运行的Console项目.我在设置区域有一个属性,该区域具有程序的连接字符串.程序发布后如何更改?

我当时在考虑有一个XML文档,该文档具有到我的数据库的连接字符串.因此,他们可以随时更改数据库的位置.

另外,我的项目引用了我在项目中创建的类库.

I have a Console project that will be ran in windows task scheduler. I have a property in the settings area which has the connection string of my program. How would I be able to change it even after the program is published?

I was thinking of having an xml document that has the connection string to my database. So they have the flexibility to change the location of the database anytime.

Also my project references a class library I made in my project. Will I need to bring that dll with my project or does it do it automatically?

推荐答案

您应该可以更改它们,然后使用Properties.Settings.Default.Save <保存更改. br/>
您也可以将其作为命令行参数传递.而且您确实需要该应用程序具有dll,但是VS应该将其复制到您将程序编译到的任何位置.
You should be able to change them then save the changes with Properties.Settings.Default.Save

You could also pass it in as a command line argument. And you do need the dll with the application, but VS should copy it to wherever you compile the program to.


也许我不能正确地理解问题,但是您不会使用该应用程序.配置文件?

回答问题的第二部分.编译我们的程序时,将创建类库的DLL,您将不得不将该DLL与您的程序一起移动!

http://msdn.microsoft.com/en-us/库/ms184658%28v=vs.80%29.aspx [
Maybe I am not understanding the question properly, but wouldnt you use the App.Config file?

To answer the second part of your question. When our program is compiled, a DLL of the class library will be created, you will have to move that DLL with your program!

http://msdn.microsoft.com/en-us/library/ms184658%28v=vs.80%29.aspx[^] -- Just a little bit of info on the App.Config file! Have a click around to find out stuff you need to know.


这篇关于控制台项目.如果发布,如何更改属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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