简体   繁体   English

关闭警告CS1607

[英]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.

相关问题 为什么警告CS1607“为'产品版本'指定的版本不是正常的'major.minor.build.revision'格式”生成的? - Why is warning CS1607 “The version specified for the 'product version' is not in the normal 'major.minor.build.revision' format” generated? CS1607:程序集生成 - 为“文件版本”指定的版本“1.4.0.85725”不是正常的“major.minor.build.revision”格式 - CS1607: Assembly generation — The version '1.4.0.85725' specified for the 'file version' is not in the normal 'major.minor.build.revision' format pInvokeStackImbalance MDA警告以及如何关闭或修复它 - pInvokeStackImbalance MDA Warning and how to turn it off or fix it 如何在Visual Studio for Mac中关闭“警告错误提示” - how to turn off “warning treaded as error” in visual studio for mac ASP.NET自动生成aspx.designer.cs关闭? - ASP.NET auto-generate aspx.designer.cs turn off? 如何关闭“如果打算隐藏则使用新关键字”警告? - How do I turn off the warning “use the new keyword if hiding was intended”? 使用Selenium Web驱动程序在Safari中关闭“非安全表单”警告 - Turn off 'non-secure form' warning in Safari using selenium web driver 如何正确重构C#按位或运算符的使用情况,以摆脱编译器警告(级别3)CS0675 - How to properly refactor C# Bitwise-or operator usage in order to get rid off Compiler Warning (level 3) CS0675 关闭HttpRequestValidationException日志记录? - Turn off HttpRequestValidationException logging? 关闭过滤器 - Turn Off Filters
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM