Basically, I created a Visual Studio Installer project. I added a primary output to my project, which was great because it loaded in the dependencies and files automatically for me. The problem I'm facing is that I want to be able to mark my config file as a hidden file, but can't seem to figure out how.

When I go to View>File System it lists:

MyExternalAssembly.dll Primary output from MyProject (Active)

So, is there a way to actually mark my config file as hidden during installation if I add a primary output project instead of the individual files?

1

There are 1 best solutions below

0
On

I'm not sure if you really want to make it hidden. If you're worried about users looking at it, a more than average user will know how to un-hide things and pilfer around. So, that being said, if you want to keep users from seeing what's in the config you will need to encrypt the config. A good example of that can be found here:

http://www.davidhayden.com/blog/dave/archive/2005/11/17/2572.aspx

If you still want to hide the config, then you could try hiding it once the application is run for the first time. Using: ApplicationDeployment.IsNetworkDeployed && ApplicationDeployment.CurrentDeployment.IsFirstRun with a click once application you can tell if this is the first time an application is run.

You could then use File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden); to actually hide the app.config.

Which would result in:

if (ApplicationDeployment.IsNetworkDeployed && ApplicationDeployment.CurrentDeployment.IsFirstRun)
{
    File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden);
}