在设置创建过程中,我计划执行以下操作(在 C# 脚本中):
During a setup creation process, I am planning to do the following (within a C# Script):
AssemblyVersion
和AssemblyFileVersion
属性值.AssemblyVersion
和 AssemblyFileVersion
属性值.AssemblyVersion
and AssemblyFileVersion
attribute values of one DLL.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的AssemblyVersion
和AssemblyFileVersion
,并将其保存回其他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 属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!