Questions about deploying my .Net application.

Experts, I am getting ready to deploy my first .Net application. I have a question. Do I have to include with the application my .Net controls like I used to have to do with my activex controls in VB6.

Do I put my controls in "System32/SysWOW64"?
Do I put my controls in "AppData\Roaming\MyApplication"?
Does my .exe still go in environ("ProgramFiles")?
Do I put my database, EULA and other supporting files in "AppData\Roaming\MyApplication"?
BasicfarmerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jacques Bourgeois (James Burger)PresidentCommented:
You do not need to distribute the controls if you have used only the controls that come with .NET. Since the users need to install the framework before they can use your application, they already have all these controls.

The condition is different however if you use external controls, such as controls from a third party vendor or controls that you developed yourself outside of you application. If you distribute third party controls, look at their documentation to know where they are expected to be installed. If you do not have that information or are distributing your own custom controls, then the best place to store them in .NET is usually in the same directory as the application.

The .exe can go in different places, depending whether the application is 32-bit or 64-bit, and whether it is installed on a 32-bit or 64-bit computer, and depending on how you distribute it (standard installer package, custom installer, ClickOnce). For instance, on a 64-bit computer, 32-bit applications should install under Program Files (x86). If you use a standard installer package, it takes care of that for you. You will find a tool to create one under Other Project Types...Setup and Deployment in the window that you use to create a new project.

Accompanying files that are read-only such as the EULA can be installed in the same directory as the application. For the files that are read-write, the standard is User\AppData\MyCompany\MyApplication. But these are the standards. There are alternatives depending on what the file does and whether it will be shared or not by all the users on the same computer.
0
BasicfarmerAuthor Commented:
James, is ProgramData for windows 7 where i would want to put all of my read/write stuff if all users are to access the application?
0
Jacques Bourgeois (James Burger)PresidentCommented:
From a .NET application, not matter the version of Windows, Program Data is read-only for users who are not administrator. So you can put executables and dlls in there, files that need only to be read, but not files that need to be written to.

Files that needed to be written to are typically stored in 2 places.

If this is a file that the user creates himself, usually with a Save and/or Save As option in the application, then the place to store the file is in Documents (My Documents) by default, but let the user choose to store it somewhere else if he wants to.

However, if the file is not created by the user and is use internally by the application, then the recommended place is to put it in Users\AppData\<YourCompany>\<ApplicationName>.

Since Documents and Users can take different names depending on the OS, the user and the culture, you cannot hardcode them in your application. You need to retrieve them with the following calls.

If you want each user to have its own set of files:
     Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
     Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)

If you want all your users to be able to write to the same files instead of having individual copies, then you would use the following:
     Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments)
     Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

BasicfarmerAuthor Commented:
Thanks for the great insight...
0
BasicfarmerAuthor Commented:
James, I just looked at this and Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)  = "C:\ProgramData". I thought this was read only?

My app uses a database that will be written to, I need all users on the PC to be able to access it.
0
BasicfarmerAuthor Commented:
I also have some xml files that will be written to.
0
Jacques Bourgeois (James Burger)PresidentCommented:
Simply try the following, and you will see that you can write to ProgramData:

            Dim folder As String = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)
            Dim str As New IO.StreamWriter(Path.Combine(folder, "test.txt"))
            str.Write("This is a test 34")
            str.Close()

And if you want, right click on the folder in Windows Explorer, go in the Properties...Security...Advanced and you will see that the Users of the computer have Write access to the folder.
0
BasicfarmerAuthor Commented:
What does "Special" mean? It doesn't say write.
Screen Shot
0
Jacques Bourgeois (James Burger)PresidentCommented:
Ooops. In Windows 8 it shows as Write instead of Special. Special shows only on the previous screen.

There are 2 types of security in the file system.

The standard security is the basic Windows security, that enables you to write in Program Files for instance.

.NET came in while Windows had been around a long time. Microsoft wanted to have a different set of file security options. They closed down writing to Program Files for non administrator, but opened up Program Data. They could not change the standard security however, because it would break older applications.

I suppose that Special reflects the framework having that special Write permission that is usually not there.
0
BasicfarmerAuthor Commented:
So you are saying that I should be ok deploying my files into ProgramData\MyCompany\MyApp?
0
Jacques Bourgeois (James Burger)PresidentCommented:
Yes.

But as always, to make sure, perform some tests before deployment.

You should always test the application in an environment that is similar to the one that the users will be working in.

I have a second user on my development computer that is not administrator and under whose account I very often test my application during development to make sure that I get the SecurityExceptions as soon as possible.

You should also deploy and test the application on another computer from time to time during deployment, so as to maker sure that you have everything that is needed. A computer that has nothing extra installed (specially not Visual Studio) except the prerequisites for the application. Before I was set up with a virtual testing environment, I used to keep my last computer for that purpose, and reinstalled Windows regularly on it in order to have a clean slate for my tests.
0
BasicfarmerAuthor Commented:
Thanks James...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.