简体   繁体   English

将AssemblyVersion属性移动到单独的文件时,在Mono下生成错误

[英]Build error under Mono when moving AssemblyVersion attribute to a separate file

I have a C# library project with a build task that writes the current SVN revision into a file named Version.cs. 我有一个带有构建任务的C#库项目,该任务将当前SVN修订版本写入名为Version.cs的文件中。 The resulting file contains just this single line: 结果文件仅包含以下一行:

[assembly: System.Reflection.AssemblyVersion(0.0.0.1325)]

I've removed the pre-existing AssemblyVersion attribute from the AssemblyInfo.cs file. 我已经从AssemblyInfo.cs文件中删除了预先存在的AssemblyVersion属性。

When compiling using Mono, the gmcs compiler doesn't like this - it throws the following parse error: 使用Mono进行编译时,gmcs编译器不喜欢这样-它引发以下解析错误:

'value' is invalid attribute target. All attributes in this attribute section will be ignored

Any ideas why this is happening? 任何想法为什么会这样? Surely AssemblyInfo.cs isn't some sort of "special" file - I'd rather not have to write the version attribute into that... 当然,AssemblyInfo.cs并不是某种“特殊”文件-我宁愿不必将version属性写入该文件中...

I haven't tried it under Windows/VS.NET yet (it needs to be able to compile on both platforms). 我还没有在Windows / VS.NET下尝试过它(它必须能够在两个平台上编译)。

废话,没关系,我没有引用版本字符串(应该是[assembly: System.Reflection.AssemblyVersion("0.0.0.1325")] ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM