Creating User

Jul 15, 2015 at 3:14 PM
Hi,

I've tried creating a user like this:
User user= new User(new Id("NewUser"), "USER", Environment.UserDomainName);
user.Password = "Password123";
user.PasswordNeverExpires = true;
user.CreateUser = true;

Project project = new Project(NAME, dir, user);

But when I build it, it talks about Directory/Component pair should be listed inside CreateFolder table.

It does build an MSI but when I run it, it says Create user failed:
Image

I could not find any tutorials about user creation that tell me something that I don't already know.
Any help would be much appreciated.

Thank you,
Eduards Brown
Jul 15, 2015 at 3:20 PM
Edited Jul 15, 2015 at 3:20 PM
Hi,

I've got it working, I just had to remove the Environment.UserDomainName.
It works but it's weird... why cant I specify a domain...

Thanks,
Eduards Brown
Marked as answer by edik009 on 7/15/2015 at 8:20 AM
Coordinator
Jul 16, 2015 at 1:24 PM
Edited Jul 17, 2015 at 2:49 AM
It is a defect. I have created the issue on your behalf: https://wixsharp.codeplex.com/workitem/54

Keep in mind that there are two problems.
  • "Directory/Component pair should be listed inside CreateFolder table." is a defect, which manifests itself if you have no or empty dir in your project. It is logged as Issue#54 and it is fixed now.
  • "why cant I specify a domain.." You can. You just need to be sure you have rights to add users to that domain. The simplest way to test it is to add user to the local (not a network) doman. The following code works just fine:
var project = new Project("MyProduct",
                    new User("USER")
                    {              
                        Domain = Environment.MachineName, 
                        //or a domain name your setup process has rights to add users to
                        Password = "Password123", 
                        PasswordNeverExpires = true, 
                        CreateUser = true
                    });