Jan Schreuder on .Net

.Net code samples, experiences, observations

View my professional profile on LinkedIn

Recent Posts

Tags

News

  • Inappropriate comments will be deleted at my discretion.

    The information and code samples in this weblog is provided "AS IS" without warranty of any kind, either expressed or implied, including but not limited to the merchantability and/or fitness for a particular purpose.

Community

Email Notifications

Tool suppliers

Tools

General

Microsoft

Favorite blogs

Archives

This weeks embarrasing moment

We all have those, I'm sure of it. Today it was my time to walk away from my computer and hide my face. So what happenend?

I built a windows service for my current assigment. I tested it and it worked so it was time to deploy it to the test server. The solution included a setup project, so I simply compiled the setup and sent it off. To my surprise, I was called to tell me the setup didn't work properly. According to the tester, the files had been installed, but the service did not show in the services window.

I couldn't believe it, so I ran the setup again on my system and checked my services window. Weird, it's there. I uninstalled it and checked it again. It was still there! WTF?!?!?! Time to open the good old dos-prompt and run InstallUtil /u on the service application in my debug folder. And yes, the service was gone. I proceeded in running the setup again, and it didn't appear in my services window.

I then checked the installer class in my service project and found that my installer class was tagged with the [RunInstaller(true)] attribute. I then checked a service class that I knew was installing properly and that class turned out to be tagged with [RunInstallerAttribute(true)]. You'll notice the small but significant difference. And the reason for my shame. Still trying to figure out why the [RunInstaller(true)] didn't raise a compiler error, though.

Lessons learned

  1. Be humble, you can't even trust your own work. Or the compiler...
  2. Make sure the service is uninstalled and doesn't show in the services window before testing the setup.
  3. Run the setup to make sure it installs all necessary files.
  4. Check if the service shows up in the services window.

 

Comments

davidvl said:

Jan,

Weird. The full name with the 'Attribute' postfix is the .NET Framework class name of the attribute, but as far as I know the 'Attribute' postfix is not required when using the attribute as an attribute (for readability, the compiler expands the attribute name when the attribute is applied on the class).

See also:

http://www.ondotnet.com/pub/a/dotnet/excerpt/vbnut_8/index1.html

In other words, both are syntactically correct and - should be equal in result. I wonder if this is reproducable and whether it is a bug or not.

Keep up the good writing.

Regards,

David van Leerdam

# March 5, 2007 3:15 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Please add 8 and 1 and type the answer here: