C# deployment project - overwriting config

N

Nuno Magalhaes

Hello,

I've made an application that consists on 2 files:
HelloWorld.exe
HelloWorld.exe.config

When I increase the version of the setup project from 1.0.0 to 1.1.0
(and the product code as recommended) the upgrade does not update
HelloWorld.exe.config that remains as in version 1.0.0.
How can I upgrade the file HelloWorld.exe.config through the setup
project deployment?

Regards,
Nuno
 
N

Nuno Magalhaes

First, it is typical to use the Project/Add New Item.../Application
Configuration File to put a config file in your project.  This creates a
file named "App.config" that VS then knows to use for various settings,
and which is renamed to the assembly output name (plus the .config) at
compile time.  (It's created automatically if you add settings via the
Designer, so that the defaults for the settings can be stored and deployed).

But second, by default a config file wouldn't typically have application
version information in it.  So your question isn't very clear.

Normally, assembly information such as the version is stored in the
AssemblyInfo.cs file under the Properties folder of the project.
Perhaps you can clarify why it is a) your project item is named
"HelloWorld.exe.config" instead of "App.config" and b) what version
information is in that file that you expect VS to update?

Pete

Hi Pete, thanks for your response.

a) I'm adding the files manually and I would like to stay that way
because in the future there will be more directories and more
applications in one single install package (there will be also data
files that I would like to be updated/upgraded). The version I expect
to update is always to the latest version.

b) I guess there is no version information on HelloWorld.exe.config
nor in the possible future .png data files for example but I would
really want those files to be upgraded/updated.

Regards,
Nuno
 
N

Nuno Magalhaes

[...]
a) I'm adding the files manually and I would like to stay that way
because in the future there will be more directories and more
applications in one single install package (there will be also data
files that I would like to be updated/upgraded). The version I expect
to update is always to the latest version.
b) I guess there is no version information on HelloWorld.exe.config
nor in the possible future .png data files for example but I would
really want those files to be upgraded/updated.

Sorry, I cannot make sense of your question.  If you acknowledge that
the .config file contains no version information, what is it that you
think VS should be doing to the file in terms of being
"upgraded/updated" and why?

In any case, I also don't see how you can insist on adding files
manually, but then be concerned about having to maintain the same files
manually.  It seems to me that the two go hand in hand.  If you bypass
Visual Studio's mechanisms for dealing with automatically maintained
files, that's an implicit agreement to maintain the files yourself
rather than to have VS do it.

Again, for the .config file it's a moot point anyway, since it doesn't
contain version information.  But even for other files that might
contain version information, if you are not allowing VS to add the files
in the first place, it should not be surprising that VS might not
necessarily identify the files as being special and in need of automatic
maintenance.

Pete

Hi Pete,

Sorry to be so confusing but I think I found what I want.
I edited the resulting .msi file with ORCA MSI Editor and set in the
Properties table the flag REINSTALLMODE=amus which is the same as
invoking "msiexec.exe /i HelloWorld.msi REINSTALLMODE=amus".
From what I read in some sites:
• a - Force all files to be reinstalled, regardless of version.
• m - Rewrite all registry keys that go to HKEY_LOCAL_MACHINE or
HKEY_CLASSES_ROOT.
• u - Rewrite all registry keys that go to HKEY_CURRENT_USER or
HKEY_USERS.
• s - Reinstall shortcuts and icons.

Nuno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top