[英]Turn off warning CS1607
I have a common assembly file where I have tried to turn off a warning: 我有一个常见的程序集文件,我试图关闭警告:
warning CS1607: Assembly generation -- The version '2.0.4.121106' specified for the 'file version' is not in the normal 'major.minor.build.revision' format 警告CS1607:程序集生成 - 为“文件版本”指定的版本“2.0.4.121106”不是正常的“major.minor.build.revision”格式
I have done this but it isn't working: 我这样做了但是没有用:
#pragma warning disable 1607
[assembly: AssemblyVersion("2.0.*")]
[assembly: AssemblyFileVersion("2.0.4.121106")]
[assembly: AssemblyInformationalVersion("2.0.0.0")]
#pragma warning restore 1607
So is there some way to do this in the code? 那么在代码中有一些方法可以做到这一点吗?
The reason why you are getting the error is because the revision number is greater than 65534. And I found researching the same problem for my solution is that there is no way (or easy/correct) to suppress this warning. 你得到错误的原因是因为版本号大于65534.我发现研究同样的问题我的解决方案是没有办法(或简单/正确)来抑制这个警告。 But in order for us to get around it we found that we could set the following code in out AssemblyVersion.cs with your versions as an example: 但是为了让我们绕过它,我们发现我们可以在AssemblyVersion.cs中设置以下代码,并以您的版本为例:
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyInformationalVersion("2.0.4.121106")]
This will make it the Product Version of our dlls "2.0.4.121106" when viewing the details of the Properties > Details of our dlls. 当查看我们的dll的Properties> Details的详细信息时,这将使它成为我们的dll“2.0.4.121106”的产品版本。
You can do it in project properties on "Build" tab. 您可以在“构建”选项卡上的项目属性中执行此操作。 There is a field called "Suppress warnings" where you should put "1607" there. 有一个名为“抑制警告”的字段,你应该在那里放“1607”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.