Where do (published) C# Apps go?  Where do they live?

Posted on 2013-05-15
Last Modified: 2013-05-16
When you finish a project, and you set up that project to publish "offline", with no updates, as a CD Installation, it builds everything neatly into a folder (the one you provided to the system when setting everything up initially) - all ready to go.

(Note: I'm using the included Publisher with Visual Studio 2010 Ultimate, here - no additional third-party utilities are involved.  Yet.)

So you're on a target machine - one that's supposed to run this application "in the field".  You navigate to the [Publish] folder, and click [Setup].  Whammo!  The application starts!  And there, in the applications list, you can clearly see this solution of yours - the utility designed to save hours of time and improve productivity on the line.  It's apparently been successfully installed on your target machine.

But where is it?  In the good old days, these applications were installed to the [C:\Programs] folder (or whatever passed for it), and you could deal with them there.  But now...     ...where did/do these things go?

Reasoning: I have developed a suite of applications that (supposedly) work together, and they use a common configuration scheme.  So they seek a config file in the folder of the application --- only I can't seem to find it!  The Configuration Utility can't very well write out the config data for the suite of apps if it cannot find them, right?  And the apps, not having a default config file to start with, tell the end-user they need to run the Configuration Utility to get things started.  But the Configuration Utility cannot find the other applications, so it has no clue to where it should write out config files.  Frustrating.

Or am I going about this all wrong?  Not my first time trying to apply "old thinking" to the "new system" of doing things.  Anybody out there have any idea how I should approach this?  Or is it time to invest in a third-party installer, which I really have absolutely no desire to do...

Thanks (in advance) for your time and patience,

- The Lurking LongFist
Question by:LongFist
LVL 40

Expert Comment

by:Vadim Rapp
ID: 39169783
1. to find files, you can use utility called Agent Ransack

2. when you find it, you will see that config file, most likely, is installed under user's %appdata%, i.e. application data folder. Today's best practices dictate that writable files are to be installed under %appdata%, not under %programfiles%.

Program files, in turn, have also become less trivial. Now it depends on whether the installation is per-machine or per user. To install per-machine, you need to be local administrator. If you are not, then the product will be installed under user's programs, which is special folder, individual for the user. So non-admin user can't affect other users on the machine, but at the same he can have his own applications.

All this, and much more, was done in order to provide more security.

Regarding common configuration scheme. In Visual studio, the common mechanism to manage settings is via My. object, i.e. My.Settings. These settings are stored in XML file, and are individual for each project. So there's no way to have common My.Settings for the whole solution.

What you can do:

1. store settings in the Registry.

2. - an add-on that implements per-solution settings.
LVL 10

Expert Comment

ID: 39171112
Those 2 apps that need to share the same config, are they different installed in different publish?

If so, they will be in different directories and the clickonce installer will put them in a "random" generated folder in the users folder,appdata,net,etc..

If there is no commom database between them (to store it there), either store in registry as mentioned by vadimrapp1, or after install you force save the config in a specific folder (such as program files), and make both of them read from there.

Author Comment

ID: 39171228
Imagine constructing a suite of applications that all pertain to the same thing: AVR Coding and SOC Development.  Now, let's say you want these utilities to all "live" in the same folder, maybe in the [Program Files] or [Program Files (x86)] folder under [\Barghest\AVR-Tools\], right?  Based on the information you guys have revealed, that isn't quite possible under Visual Studio.

Yet it happens.  All the time.  If it didn't, there wouldn't be any [Program Files] or [Program Files (x86)] folders, now would there?  And the cute thing about it is that, once I've accomplished this feat, it will be a piece of cake for these utilities to share a config file - they just need a common location from which to share it.  I realize that under the current "extreme paranoia" method of internal security the average user won't be able to write to a text file in the [Program Files] or [Program Files (x86)] folders - but for organizational purposes this is a great start.  I can deal with that.

So I guess this question is less about "Where do they go?" and more about "How do I marshall them?" to the desired destination folder?  Or is that possible under the currently provided Dev Studio?  (Hey, somebody has figured it out - just look in your [Program Files] or [Program Files (x86)] folders for ample proof...
LVL 37

Accepted Solution

TommySzalapski earned 500 total points
ID: 39171257
Just manually write the config file to %appdata%\Barghest\AVR-Tools\
Or if you need it to be the same for all users put in in C:\ProgramData
C:\ProgramData is a hidden directory that is designed for essentially exactly what you describe. It's where MS moved all the config stuff that used to go in Program Files.

Author Closing Comment

ID: 39171298
...aaaaand *that* is exactly the response for which I was looking!  Excellent!  You see, after I shifted off to see what I could about installers, I discovered that I could, indeed, build an installer for this application suite by going to File ---> New Project ---> Other Project Types ---> Setup and Deployment ---> Visual Studio Installer: Setup Project (or CAB Project, or whatever I feel like suits this install best) and proceed from there to build an installation project for this suite of apps, by insisting on a common install folder.  This, combined with your solution ["...manually write the config file to %appdata%\Barghest\AVR-Tools\..."] is absolutely perfect!

Thank you, thank you, and Thank You!

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Visual Studio hangs on running project 6 61
linq .concat equivalent with expression syntax 4 25
Ruby or Python 7 59
aspx ascx, c# 7 17
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question