I do have this issue whereby ProcessStartInfo
does not contain definition verb so i can not do 'runas
'. On VisualStudio 2015 a project 'foo' that uses ProcessStartInfo
does have this definition 'verb
' - confirmed by examining the class. Other project running on VisualStudio 2017 does NOT seem to recognize this method. Moreover, the method is missing from the class itself. Now i am not sure why and how this is possible?
我确实有这个问题,因为ProcessStartInfo不包含定义动词所以我不能做'runas'。在VisualStudio 2015上,使用ProcessStartInfo的项目'foo'确实具有此定义'verb' - 通过检查类来确认。在VisualStudio 2017上运行的其他项目似乎无法识别此方法。而且,该方法本身缺少该方法。现在我不确定为什么以及如何做到这一点?
Full error code:
完整的错误代码:
Severity Code Description Project File Line Suppression State
Error CS1061 'ProcessStartInfo' does not contain a definition for 'Verb'
and no extension method 'Verb' accepting a first argument of type
'ProcessStartInfo' could be found (are you missing a using directive or an
assembly reference?) project3cx C:\Users\Boss\Documents\Visual Studio
2017\Projects\project\project3cx\Program.cs 64 Active
The only difference between ProcessStartInfo class is that the version 4.0.0.0
ProcessStartInfo类之间的唯一区别是版本4.0.0.0
#region Assembly System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.dll
#endregion
Does have definition 'verb' and version 4.1.0.0 does not have defitnion verb.
有定义'verb'和版本4.1.0.0没有defitnion动词。
#region Assembly System.Diagnostics.Process, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// C:\Users\Boss\.nuget\packages\system.diagnostics.process\4.3.0\ref\netstandard1.4\System.Diagnostics.Process.dll
#endregion
I can also see that one project assembly is managed by nuget, the other is not. I have installed/updated nuget System.Diagnostics package but to no avail. Any help ?
我还可以看到一个项目程序集由nuget管理,另一个不是。我已经安装/更新了nuget System.Diagnostics包但无济于事。有帮助吗?
1 个解决方案
#1
1
The only difference between ProcessStartInfo class is that the version 4.0.0.0. Does have definition 'verb' and version 4.1.0.0 does not have defitnion verb.
ProcessStartInfo类之间的唯一区别是版本4.0.0.0。有定义'verb'和版本4.1.0.0没有defitnion动词。
Just as Hans commented, you need to "Pay attention to the project template you selected". I repeat the answer here more detail so that other community members who get the same issues can find the answer more easily.
正如汉斯评论的那样,您需要“关注您选择的项目模板”。我在这里重复答案更详细,以便其他社区成员能够更容易地找到相同问题的答案。
According to the reply to the question on GitHub, the ProcessStartInfo.Verb is not supported on .NET Core/.NET Standard:
根据对GitHub问题的回复,.NET Core / .NET Standard不支持ProcessStartInfo.Verb:
I've tagged it as a bug since this API shouldn't be showing up in our docs since it's not supported on .NET Core. It needs to be deleted from the article. @chenkennt, @bradygaster another case of APIs that are not really part of .NET Core showing up on docs.
我已将其标记为错误,因为此API不应出现在我们的文档中,因为.NET Core不支持此API。它需要从文章中删除。 @chenkennt,@ bradygaster另一个API的案例,它不是.NET Core的一部分,而是出现在docs上。
Besides, both Verb as well as Verbs are coming back as part of .NE Standard 2.0.
此外,Verb和Verbs都将作为.NE Standard 2.0的一部分回归。
#1
1
The only difference between ProcessStartInfo class is that the version 4.0.0.0. Does have definition 'verb' and version 4.1.0.0 does not have defitnion verb.
ProcessStartInfo类之间的唯一区别是版本4.0.0.0。有定义'verb'和版本4.1.0.0没有defitnion动词。
Just as Hans commented, you need to "Pay attention to the project template you selected". I repeat the answer here more detail so that other community members who get the same issues can find the answer more easily.
正如汉斯评论的那样,您需要“关注您选择的项目模板”。我在这里重复答案更详细,以便其他社区成员能够更容易地找到相同问题的答案。
According to the reply to the question on GitHub, the ProcessStartInfo.Verb is not supported on .NET Core/.NET Standard:
根据对GitHub问题的回复,.NET Core / .NET Standard不支持ProcessStartInfo.Verb:
I've tagged it as a bug since this API shouldn't be showing up in our docs since it's not supported on .NET Core. It needs to be deleted from the article. @chenkennt, @bradygaster another case of APIs that are not really part of .NET Core showing up on docs.
我已将其标记为错误,因为此API不应出现在我们的文档中,因为.NET Core不支持此API。它需要从文章中删除。 @chenkennt,@ bradygaster另一个API的案例,它不是.NET Core的一部分,而是出现在docs上。
Besides, both Verb as well as Verbs are coming back as part of .NE Standard 2.0.
此外,Verb和Verbs都将作为.NE Standard 2.0的一部分回归。