<i id='yTnmW'><tr id='yTnmW'><dt id='yTnmW'><q id='yTnmW'><span id='yTnmW'><b id='yTnmW'><form id='yTnmW'><ins id='yTnmW'></ins><ul id='yTnmW'></ul><sub id='yTnmW'></sub></form><legend id='yTnmW'></legend><bdo id='yTnmW'><pre id='yTnmW'><center id='yTnmW'></center></pre></bdo></b><th id='yTnmW'></th></span></q></dt></tr></i><div id='yTnmW'><tfoot id='yTnmW'></tfoot><dl id='yTnmW'><fieldset id='yTnmW'></fieldset></dl></div>
<tfoot id='yTnmW'></tfoot>

    1. <small id='yTnmW'></small><noframes id='yTnmW'>

          <bdo id='yTnmW'></bdo><ul id='yTnmW'></ul>

        <legend id='yTnmW'><style id='yTnmW'><dir id='yTnmW'><q id='yTnmW'></q></dir></style></legend>

        以编程方式更改 AssemblyVersion 和 AssemblyFileVersion 属性

        Programmatically change the AssemblyVersion and AssemblyFileVersion attributes(以编程方式更改 AssemblyVersion 和 AssemblyFileVersion 属性)

          <tfoot id='3TFG6'></tfoot>
          • <small id='3TFG6'></small><noframes id='3TFG6'>

              • <bdo id='3TFG6'></bdo><ul id='3TFG6'></ul>
                  <tbody id='3TFG6'></tbody>
              • <i id='3TFG6'><tr id='3TFG6'><dt id='3TFG6'><q id='3TFG6'><span id='3TFG6'><b id='3TFG6'><form id='3TFG6'><ins id='3TFG6'></ins><ul id='3TFG6'></ul><sub id='3TFG6'></sub></form><legend id='3TFG6'></legend><bdo id='3TFG6'><pre id='3TFG6'><center id='3TFG6'></center></pre></bdo></b><th id='3TFG6'></th></span></q></dt></tr></i><div id='3TFG6'><tfoot id='3TFG6'></tfoot><dl id='3TFG6'><fieldset id='3TFG6'></fieldset></dl></div>

                <legend id='3TFG6'><style id='3TFG6'><dir id='3TFG6'><q id='3TFG6'></q></dir></style></legend>

                  本文介绍了以编程方式更改 AssemblyVersion 和 AssemblyFileVersion 属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在设置创建过程中,我计划执行以下操作(在 C# 脚本中):

                  During a setup creation process, I am planning to do the following (within a C# Script):

                  1. 读取一个DLL的AssemblyVersionAssemblyFileVersion属性值.
                  2. 迭代项目中的所有 DLL 和可执行文件,并将这些版本应用到它们的 AssemblyVersionAssemblyFileVersion 属性值.
                  1. Read the AssemblyVersion and AssemblyFileVersion attribute values of one DLL.
                  2. Iterate all DLLs and executables in the project and apply those version to their AssemblyVersion and AssemblyFileVersion attribute values.

                  现在的问题是:第二步怎么做?

                  我可以成功完成第 1 步,但对于第 2 步,我看不到真正的起点.我可能要做的是使用一些原生的P/Invoke方法,因为属性直接修改了DLL/可执行文件的版本信息资源信息.

                  I successfully can do step 1, but for step 2 I don't see a real start point. What I probably have to do is to use some native P/Invoke methods since the attributes directly modify the version information resource information of a DLL/executable.

                  对此有任何提示吗?

                  推荐答案

                  你为什么不在构建过程中读取一个DLL的AssemblyVersionAssemblyFileVersion,并将其保存回其他csproject的AssemblyInfo.cs,然后才编译?

                  Why don't you, during build process, read the AssemblyVersion and AssemblyFileVersion of one DLL, and save it back to other csproject's AssemblyInfo.cs, only then compile it?

                  其实我不知道是否可以直接修改DLL文件,而不用花哨的东西.

                  As a matter of fact, I don't know whether it is possible to modify the DLL file directly, without resorting to something fanciful.

                  或者,确保所有 DLL 共享一个公共 AssemblyInfo.cs.当您在 csproject 中添加新项目时,您可以通过将 AssemblyInfo.cs 添加为添加为链接"来执行此操作.这样编译时,所有的 DLL 将共享相同的 AssemblyInfo.cs,从而输出相同的 AssemblyVersion.

                  Or alternatively, make sure that all your DLLs share one common AssemblyInfo.cs. You can do this by adding the AssemblyInfo.cs as "Add As Link" when you add a new item in csproject. In this way when you do a compilation, all the DLLs will share the same AssemblyInfo.cs, and thus output the same AssemblyVersion.

                  这篇关于以编程方式更改 AssemblyVersion 和 AssemblyFileVersion 属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Performance overhead of using attributes in .NET(在 .NET 中使用属性的性能开销)
                  Accessing attribute info from DTE(从 DTE 访问属性信息)
                  c# Hide a property in datagridview with datasource(c#使用数据源隐藏datagridview中的属性)
                  Extract Display name and description Attribute from within a HTML helper(从 HTML 帮助器中提取显示名称和描述属性)
                  How can I force the PropertyGrid to show a custom dialog for a specific property?(如何强制 PropertyGrid 显示特定属性的自定义对话框?)
                  Associate attribute with code generated property in .net(将属性与 .net 中的代码生成属性相关联)

                    • <bdo id='Kt8iG'></bdo><ul id='Kt8iG'></ul>
                      <i id='Kt8iG'><tr id='Kt8iG'><dt id='Kt8iG'><q id='Kt8iG'><span id='Kt8iG'><b id='Kt8iG'><form id='Kt8iG'><ins id='Kt8iG'></ins><ul id='Kt8iG'></ul><sub id='Kt8iG'></sub></form><legend id='Kt8iG'></legend><bdo id='Kt8iG'><pre id='Kt8iG'><center id='Kt8iG'></center></pre></bdo></b><th id='Kt8iG'></th></span></q></dt></tr></i><div id='Kt8iG'><tfoot id='Kt8iG'></tfoot><dl id='Kt8iG'><fieldset id='Kt8iG'></fieldset></dl></div>

                    • <tfoot id='Kt8iG'></tfoot>

                          <small id='Kt8iG'></small><noframes id='Kt8iG'>

                            <legend id='Kt8iG'><style id='Kt8iG'><dir id='Kt8iG'><q id='Kt8iG'></q></dir></style></legend>
                              <tbody id='Kt8iG'></tbody>