.net 应用程序中的环境设置
我需要知道如何控制应用程序中的环境设置,而无需手动更改 .net windows 应用程序中 app.config 中的设置。在 Java 中,我将使用命令行选项(-D 参数)在应用程序启动时设置环境,例如:java -Denvironment=1 myProgram。我可以在这里使用 .net SDK msbuild 吗? 请告诉我这些解决方案是否适用于我的情况:
http://www. hanselman.com/blog/ManagingMultipleConfigurationFileEnvironmentsWithPreBuildEvents.aspx
http://wallism.wordpress.com/2009/12/21 /msbuild-and-multiple-environments/
http://www.c-sharpcorner.com/UploadFile/mgold/MSBuildForXml07282006005222AM/ MSBuildForXml.aspx
http://www.timvw.be/2008/03/17/easily-switching- Between-appconfig-files-with-msbuild/
谢谢。
I need to know how we can control the environment setting in the application without manually changing the setting in app.config in my .net windows application. In Java I would use a command line option (-D parameter) to set the environment when the app launches, example: java -D environment=1 myProgram. Can I use .net SDKs msbuild here?
Please let me know if any of these solutions will be applicable in my case:
http://www.hanselman.com/blog/ManagingMultipleConfigurationFileEnvironmentsWithPreBuildEvents.aspx
http://wallism.wordpress.com/2009/12/21/msbuild-and-multiple-environments/
http://www.c-sharpcorner.com/UploadFile/mgold/MSBuildForXml07282006005222AM/MSBuildForXml.aspx
http://www.timvw.be/2008/03/17/easily-switching-between-appconfig-files-with-msbuild/
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在 System.Environment 类中找到它们
http://msdn.microsoft .com/en-us/library/system.environment.aspx
You can find them in then System.Environment class
http://msdn.microsoft.com/en-us/library/system.environment.aspx