C# 中的 AssemblyFileVersion 有何用途?

发布于 2024-08-02 04:45:08 字数 288 浏览 7 评论 0原文

在 assemblyInfo.cs 中,我有 AssemblyVersion 和 AssemblyFileVersion。

通常我只是像这样增加 AssemblyVersion 。 第 1 位数字:主要变化 第 2 位数字:微小变化 第三位数字:错误修复 第四位数字:Subversion 修订号

但是,我想知道 AssemblyFileVersion 的用途是什么,以及何时需要增加。它应该与 assemblyVersion 相同吗?

如果我不使用它,我应该将其注释掉吗?

非常感谢您的任何建议,

In the assemblyInfo.cs I have AssemblyVersion and AssemblyFileVersion.

Normally I just increment the AssemblyVersion like this.
1st digit: Major change
2nd digit: Minor change
3rd digit: bug fixes
4rd digit: Subversion revision number

However, I am wondering what is the AssemblyFileVersion for, and when do I need to increment. Should it be the same as the assemblyVersion?

Should I just comment it out, if I am not using it?

Many thanks for any advice,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

掐死时间 2024-08-09 04:45:08

AssemblyVersion 由 .NET 类加载器使用并标识程序集的 .NET 版本。 AssemblyFileVersion 表示 Windows PE 文件的标准 VERSION_INFO 块中包含的文件版本...换句话说,它表示文件属性对话框中看到的文件版本。

如果省略 AssemblyFileVersion,编译器将默认它与 AssemblyVersion 相同。

AssemblyVersion is used by the .NET class loader and identifies the .NET version of the assembly. AssemblyFileVersion represents the File Version contained in a standard VERSION_INFO block of a Windows PE file...in other words, it represents the file version as seen in the file properties dialog.

If you omit the AssemblyFileVersion, the compiler will default it to be the same as the AssemblyVersion.

零時差 2024-08-09 04:45:08

通常,文件版本比程序集版本更精确。每个示例:System.Windows.Form.dll - 程序集版本:2.0.0.0,文件版本:2.0.50727.3053。

当加载程序集时,程序集版本是一个重要信息。

因此,如果您在引用的程序集中发现一个小错误。您修复了错误,更新了文件版本,但保留了相同的程序集版本。优点:您不必将对此程序集的引用重新链接到新版本,并且通过文件版本,您可以知道文件的当前修订版本。

Generally the file version is more precise than the assembly version. Per example: System.Windows.Form.dll - Assembly Version: 2.0.0.0, File Version: 2.0.50727.3053.

The assembly version is an important information when it is time to load an assembly.

So, if you find a small bug in one of you referenced assembly. You fix the bug, update the file version but you keep the same assembly version. The advantage: you dont have to relink your references to this assembly to the new version and with the file version you can know the current revision of your file.

浅笑依然 2024-08-09 04:45:08

安装程序将使用 AssemblyFileVersion 来根据版本确定是否覆盖文件。

请务必注意,在尝试从以前的版本进行反序列化时,更改实现序列化的程序集的 AssemblyVersion 会产生一些严重后果。

Installers will use AssemblyFileVersion to determine whether to overwrite a file based on version.

It's important to note that changing the AssemblyVersion for an assembly that implements serialization has some serious consequences when trying to deserialize from a previous version.

咽泪装欢 2024-08-09 04:45:08

我不是专家,我可能不是在引用专家,但根据我的理解,从广义上讲,AssemblyVersion 是关于“接口”的 -> 接口。程序集的功能、向后兼容性等。AssemblyFileVersion 更多地与实现、构建等有关。

使用 AssemblyVersion 属性指定“最后兼容”版本,使用 AssemblyFileVersion 属性指定构建版本。”

-> http://www.shitalshah.com/blog/IsJeffRichterScrewingUpTheNetVersioning.aspx

//哦,还有另一件事。

在某些情况下(我不太清楚,因为我只是听说过,但没有实际经历过),如果您尝试使用 GAC 中的 dll 更新应用程序,旧版本的 dll 将不会被更新。除非文件版本已更改,否则将被具有相同程序集版本号的新版本覆盖。 (这句话够复杂吗?已经晚了...)

I am not an expert, and I may not be referencing an expert, but from what I have understood, broadly speaking the AssemblyVersion is about the 'interface' -> what the assembly does, backward compatibility etc. And the AssemblyFileVersion is more to do with implementation, which build etc.

Use AssemblyVersion attribute to specify "Last Compatible-To" version and AssemblyFileVersion attribute to specify the build version.”

-> http://www.shitalshah.com/blog/IsJeffRichterScrewingUpTheNetVersioning.aspx

//Oh, and another thing.

There are certain circumstances (about which I'm not too clear, as I've only heard about them but not actually experienced them) where if you try to update an application with dll's in the GAC, old versions of dlls won't be overwritten by new versions with the same Assembly Version number, unless the File Version has changed. (Is that sentence complicated enough? It's late here...)

尤怨 2024-08-09 04:45:08

AssemblyFileVersion 用于设置 Win32 资源中的版本信息
二进制文件,打开文件属性窗口时看到的二进制文件
在资源管理器中。

AssemblyFileVersion is used to set the version info in the Win32 resource in your
binary, the one you see if you open the properties window for the file
in Explorer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文