AssemblyInfo.cpp 是必需的吗?

发布于 2024-07-19 05:07:32 字数 96 浏览 10 评论 0原文

我想删除 AssemblyInfo.cpp,因为有时会出现一些元数据错误。

AssemblyInfo.cpp 有什么用处吗? 或者可以毫无问题地删除它吗?

I want to remove AssemblyInfo.cpp, because of some metadata errors that sometimes come up.

Is AssemblyInfo.cpp useful for anything? Or can it be removed without any problem?

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

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

发布评论

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

评论(3

逐鹿 2024-07-26 05:07:32

我发现此文件的一个区别:它与调用 Assembly.GetReferencedAssemblies。 我正在通过将修订号嵌入到 SVN 存储库中来跟踪二进制文件的版本号。 最初,我也在更新 AssemblyInfo.cpp ,但在二进制文件的文件属性详细信息选项卡中没有发现任何报告。 似乎该文件在更新这些详细信息方面对我没有任何作用,而对 csproj 的 AssemblyInfo.cs 的类似更新则并非如此。 为什么有区别呢?

现在,在一个这样的 csproj 中,我们碰巧引用了 vcxproj,并且 csproj 使用 .NET Assembly.GetReferencedAssemblies 方法将其所有引用的程序集的版本转储到日志中。 我发现该日志中报告的数字不是我添加的 VS_VERSIONINFO 资源给出的 vcxproj 版本(该资源确实将版本详细信息放入文件属性详细信息选项卡中)。 相反,报告的数字实际上与 AssemblyInfo.cpp 中定义的数字匹配。

因此,对于 vcxproj 文件,VS_VERSIONINFO 似乎能够更新您在文件属性详细信息选项卡下找到的内容,但 AssemblyInfo.cpp 能够将版本公开给 获取ReferencedAssemblies。 在 C# 中,这两个报告领域似乎是统一的。 也许有一种方法可以引导 AssemblyInfo.cpp 以某种方式传播到文件详细信息中,但我最终要做的是将构建信息复制到预构建步骤中的两个位置。 也许有人可以找到更好的方法。

I've discovered one distinction for this file: it has to do with values reported under calls to Assembly.GetReferencedAssemblies. I was working on tracking version numbers of our binaries from our SVN repository by embedding the revision numbers into them. Initially I too was updating AssemblyInfo.cpp and found nothing reported in the file property details tab for the binary. It seemed this file did nothing for me in terms of updating those details, which was not the case with similar updates to a csproj's AssemblyInfo.cs. Why the difference right?

Now in one such csproj we happen to reference a vcxproj and that csproj dumps to a log the versions of all its referenced assemblies using the .NET Assembly.GetReferencedAssemblies method. What I discovered was that the number that was being reported in that log was not the vcxproj's version as given by the VS_VERSIONINFO resource I added (which does get the version details into the file properties details tab). Instead the number reported was actually matching that defined in the AssemblyInfo.cpp.

So for vcxproj files it looks like VS_VERSIONINFO is capable of updating the contents you find under the file properties details tab but AssemblyInfo.cpp is capable of exposing the version to GetReferencedAssemblies. In C# these two areas of reporting seem to be unified. Maybe there's a way to direct AssemblyInfo.cpp to propagate into the file details in some fashion, but what I'm going to wind up doing is duplicating the build info to both locations in a prebuild step. Maybe someone can find a better approach.

云胡 2024-07-26 05:07:32

到目前为止,我的托管 c++ dll 中从未有过 AssemblyInfo.cpp,因此我认为没有必要。

(我刚刚添加了该文件以获取我的 c++ dll 的版本信息)。

So far I never had the AssemblyInfo.cpp in my managed c++ dlls, so I don't think it is necessary.

(I just added the file to have version information for my c++ dlls).

娇妻 2024-07-26 05:07:32

为什么不直接修复错误呢? 关于这一点,您遇到了什么错误?

该文件提供了使用您构建的程序集肯定需要的版本号等信息。

Why not just fix the errors? On that note, what errors are you getting?

This file provides information such as a version number which is definitely needed in order to use the assembly you have built.

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