添加自定义的版本信息,以C#应用程序 [英] Add custom version information to C# application

查看:513
本文介绍了添加自定义的版本信息,以C#应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

应用程序是一个C#.NET 3.5 WCF服务。

Application is a C# .Net 3.5 WCF Service.

我在生成过程中要动态地添加一些构建信息到最终的二进制和组件然后可以编程读取并送回时,它发送一个请求GetVersionInfo到Web服务的WCF客户端。

I'd like during the build process to dynamically add some build information to the final binary and assemblies that can then be read programatically and sent back to the WCF client when it sends a GetVersionInfo request to the web service.

.NET程序集版本是不够的。我想包括包含在应用程序始建时的系统状态附加字符串数据。

.Net assembly versioning isn't enough. I want to include additional string data that contains the state of the system at the time the application was built.

我想我会通过添加后生成事件调用脚本来更新我想要的数据app.config文件做到这一点。这听起来是正确的,或者我应该考虑一些其他的方法呢?

I'm thinking that I'd do this by adding a post build event to call a script to update the app.config file with the data I want. Does this sound about right, or should I be considering some other approach?

更新

我还这样的字符串出现在最终的exe文件的特殊内部版本说明属性。即我想右击该文件,并查看版本选项卡中的文件信息。

I'd additionally like this string to appear in the "Special Build Description" property of the final exe. I.e. I'd like to right click on the file and see this information in the version tab for the file.

先谢谢了。

推荐答案

我怀疑是pre-生成事件可能比事后构建更合适......你有没有考虑增加一个 buildinfo的.xml 文件(或类似),以建设成为集作为嵌入资源?然后,您可以用 Assembly.GetManifestResourceStream 加载它。这样,你不必担心与现有文件之类的东西相适应的 - 只是简单地覆盖 buildinfo.xml 与在pre-构建一个新的文件一步。

I suspect a pre-build event may be more appropriate than post-build... have you considered adding a buildinfo.xml file (or similar) to be built into the assembly as an embedded resource? You could then load it with Assembly.GetManifestResourceStream. That way you don't need to worry about fitting in with existing files or anything like that - just overwrite buildinfo.xml with a new file in the pre-build step.

这篇关于添加自定义的版本信息,以C#应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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