如果我在类中只声明一个私有方法,则 ESLINT 编译时不会发出警告,但是...\nESLINT 会为我在同一类中声明的每个新私有方法发出一个额外警告。
\n例如,ESLINT 对于如下声明的类发出 2 个警告:
\nclass Clazz {\n #methodOne() { /*...*/ }\n #methodTwo() { /*...*/ }\n #methodThree() { /*...*/ }\n}\nRun Code Online (Sandbox Code Playgroud)\nESLINT 输出:
\nWARNING Compiled with 1 warning 10:14:26 PM\n\nModule Warning (from ./node_modules/eslint-loader/index.js):\n\n/Users/***/Clazz.js\n 3:3 error Duplicate name \'\' no-dupe-class-members\n 4:3 error Duplicate name \'\' no-dupe-class-members\n\n\xe2\x9c\x96 2 problems (2 errors, 0 warnings)\nRun Code Online (Sandbox Code Playgroud)\n我想知道我是否做错了什么,或者我应该忽略这些警告。
\n包.json:
\nWARNING Compiled with 1 warning 10:14:26 PM\n\nModule Warning (from ./node_modules/eslint-loader/index.js):\n\n/Users/***/Clazz.js\n 3:3 error Duplicate name \'\' no-dupe-class-members\n 4:3 …Run Code Online (Sandbox Code Playgroud) 过去,我使用Installer、ServiceInstaller和ServiceProcessInstaller类来使我的应用程序可自行安装。我只需运行即可InstallUtil.exe MyApp将应用程序安装为 Windows 服务。
但我在 DotNet5 上找不到这些类。
他们不会被移植吗?还有其他方法可以替代它们吗?谁能向我指出一些有关如何实现这一目标的文档?
下面是一个关于过去如何使用这些类的示例:
[RunInstaller(true)]
public class MyServiceInstaller : Installer
{
private string serviceName = "MyApp";
public MyServiceInstaller()
{
var processInstaller = new ServiceProcessInstaller();
var serviceInstaller = new ServiceInstaller();
processInstaller.Account = ServiceAccount.LocalSystem;
processInstaller.Username = null;
processInstaller.Password = null;
serviceInstaller.ServiceName = serviceName;
serviceInstaller.DisplayName = serviceName;
serviceInstaller.StartType = ServiceStartMode.Automatic;
this.Installers.Add(processInstaller);
this.Installers.Add(serviceInstaller);
this.Committed += new InstallEventHandler(MyServiceInstaller_Committed);
}
void MyServiceInstaller_Committed(object sender, InstallEventArgs e)
{
var controller = new ServiceController(serviceName);
controller.Start();
} …Run Code Online (Sandbox Code Playgroud)