Search code examples
.netsetup-project

Web Setup Project - Getting the Current Machine Name


I've got a web setup project with a custom screen in it that asks for a machine name. Is there anyway to prepopulate this field with the current machines name?

For the case that I need it for just including "Localhost" does not meet my requirements.

"Environment.MachineName" will return the machine name within a code block which would be fine if I was needing it in a custom action. But it seems custom actions don't excecute until after you go through the installation wizard... So I cant actually use it. Anyway let me know what you think.


Solution

  • From my limited research, it doesn't look like the simple Web Setup Project will be enough for you to do what you want. I would suggest any of the following, depending on how important this is to your project:

    • Just use a default of LOCALHOST
    • Leave the default blank and use the dialog text to tell the user how to retrieve the machine name
    • Don't ask the user and make the settings later w/ a post-install exe/script that has access to environment variables
    • Use a different (read: more robust) installer

    I would suggest the last one of course, but if you don't need really need this feature that bad, go with one of the other options that is acceptable enough in your situation.