AssemblyInfo.cpp 是必需的吗?
我想删除 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我发现此文件的一个区别:它与调用
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 updatingAssemblyInfo.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'sAssemblyInfo.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 theVS_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 theAssemblyInfo.cpp
.So for vcxproj files it looks like
VS_VERSIONINFO
is capable of updating the contents you find under the file properties details tab butAssemblyInfo.cpp
is capable of exposing the version toGetReferencedAssemblies
. In C# these two areas of reporting seem to be unified. Maybe there's a way to directAssemblyInfo.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.到目前为止,我的托管 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).
为什么不直接修复错误呢? 关于这一点,您遇到了什么错误?
该文件提供了使用您构建的程序集肯定需要的版本号等信息。
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.