Reputation: 281
Hi All am trying to get current service name from my project installer i have added a basic installer to my service application and wrote my service name and Display name but i need to get the service name from code
i have tried to add method in project installer then call it but it does not work :<
public static string getname()
{
return ProjectInstaller1.ServiceName;
}
my error:=
An object reference is required for the non-static field, method, or property 'myservice.ProjectInstaller.ProjectInstaller1'
Upvotes: 0
Views: 899
Reputation: 50235
If you're insisting on the public static string getname()
definition, this should work:
//assuming ProjectInstaller1 can be instantiated
return new ProjectInstaller1().ServiceName;
Upvotes: 5