471,318 Members | 2,063 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,318 software developers and data experts.

Windows Service Deployment

I have a Windows Service that I am deploying by setting a Deployment project
in my solution.

The problem I am having is with the app.config file. This where we store
our connection string and folder locations.

My development app.config is different from my clients.

When I send him an msi file, I have to either add the clients app.config
file into my project in 2 locations (as I am running as an exe as well as a
Service - which calls the code from the exe project) or send him the
app.config and have him replace it.

Is there a way to tell the deployment project to include a different
app.config file than is currently in the project.

Can you set up multiple build type (personalities) to run for testing?

Thanks,

Tom
Jun 27 '08 #1
5 2037
Generally what I do is add an app.config to the application (so the setup can
see and deploy it). Then, I add several other application configurations,
one for each scenario. For example, I'll have the main app.config,
dev.config and release.config.

Then, for each configuration I have a pre-build event that copies the
appropriate config on top of app.config. I then only edit only dev.config or
release.config. This means the appropriate app.config exists in the bin
directory, plus it means when I build the setup the contents of the
release.config is used.

--
Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#
"tshad" wrote:
I have a Windows Service that I am deploying by setting a Deployment project
in my solution.

The problem I am having is with the app.config file. This where we store
our connection string and folder locations.

My development app.config is different from my clients.

When I send him an msi file, I have to either add the clients app.config
file into my project in 2 locations (as I am running as an exe as well as a
Service - which calls the code from the exe project) or send him the
app.config and have him replace it.

Is there a way to tell the deployment project to include a different
app.config file than is currently in the project.

Can you set up multiple build type (personalities) to run for testing?

Thanks,

Tom
Jun 27 '08 #2
On May 6, 12:42*pm, "tshad" <ts...@dslextreme.comwrote:
I have a Windows Service that I am deploying by setting a Deployment project
in my solution.

The problem I am having is with the app.config file. *This where we store
our connection string and folder locations.

My development app.config is different from my clients.

When I send him an msi file, I have to either add the clients app.config
file into my project in 2 locations (as I am running as an exe as well as a
Service - which calls the code from the exe project) or send him the
app.config and have him replace it.

Is there a way to tell the deployment project to include a different
app.config file than is currently in the project.

Can you set up multiple build type (personalities) to run for testing?

Thanks,

Tom
Hi,

Not that I know of. Of course you can change it in your project just
before generating the MSI :)
Now, if each client has a different config file, then you have a
similar problem.
What if you include another program that simply edit the config file
in a user friendly way?
Jun 27 '08 #3

"Peter Ritchie [C# MVP]" <PR****@newsgroups.nospamwrote in message
news:EB**********************************@microsof t.com...
Generally what I do is add an app.config to the application (so the setup
can
see and deploy it). Then, I add several other application
configurations,
one for each scenario. For example, I'll have the main app.config,
dev.config and release.config.

Then, for each configuration I have a pre-build event that copies the
appropriate config on top of app.config. I then only edit only dev.config
or
release.config. This means the appropriate app.config exists in the bin
directory, plus it means when I build the setup the contents of the
release.config is used.
So do you have the 3 config files outside of the solution folders and then
copy (and rename them - ie "copy dev.config app.config")?

How do you do the pre-build event?

Thanks,

Tom
--
Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#
"tshad" wrote:
>I have a Windows Service that I am deploying by setting a Deployment
project
in my solution.

The problem I am having is with the app.config file. This where we store
our connection string and folder locations.

My development app.config is different from my clients.

When I send him an msi file, I have to either add the clients app.config
file into my project in 2 locations (as I am running as an exe as well as
a
Service - which calls the code from the exe project) or send him the
app.config and have him replace it.

Is there a way to tell the deployment project to include a different
app.config file than is currently in the project.

Can you set up multiple build type (personalities) to run for testing?

Thanks,

Tom

Jun 27 '08 #4
Right-click project node in Solution explorer, then properties, and choose
the Build Events property sheet. You can enter either / or a prebuild and
postbuild batch file there.
--Peter
"tshad" <ts***@dslextreme.comwrote in message
news:OW**************@TK2MSFTNGP05.phx.gbl...
>
"Peter Ritchie [C# MVP]" <PR****@newsgroups.nospamwrote in message
news:EB**********************************@microsof t.com...
>Generally what I do is add an app.config to the application (so the setup
can
see and deploy it). Then, I add several other application
configurations,
one for each scenario. For example, I'll have the main app.config,
dev.config and release.config.

Then, for each configuration I have a pre-build event that copies the
appropriate config on top of app.config. I then only edit only
dev.config or
release.config. This means the appropriate app.config exists in the bin
directory, plus it means when I build the setup the contents of the
release.config is used.
So do you have the 3 config files outside of the solution folders and then
copy (and rename them - ie "copy dev.config app.config")?

How do you do the pre-build event?

Thanks,

Tom
>--
Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#
"tshad" wrote:
>>I have a Windows Service that I am deploying by setting a Deployment
project
in my solution.

The problem I am having is with the app.config file. This where we
store
our connection string and folder locations.

My development app.config is different from my clients.

When I send him an msi file, I have to either add the clients app.config
file into my project in 2 locations (as I am running as an exe as well
as a
Service - which calls the code from the exe project) or send him the
app.config and have him replace it.

Is there a way to tell the deployment project to include a different
app.config file than is currently in the project.

Can you set up multiple build type (personalities) to run for testing?

Thanks,

Tom

Jun 27 '08 #5
The configs would still be in the solution so they can be version controlled,
etc.

You can add a pre-build event in the projects properties (right click the
project in the solution explorer and select Properties). In the project
Properties, select the Build Events tab. Enter any commands you want
executed before the build is executed in the "Pre-build event command line"
text box.

If you're dealing with version control, you'll want to add commands to
ensure app.config is not write-protected before copying (or during copy with
XCOPY /R).

--
Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#
"tshad" wrote:
>
"Peter Ritchie [C# MVP]" <PR****@newsgroups.nospamwrote in message
news:EB**********************************@microsof t.com...
Generally what I do is add an app.config to the application (so the setup
can
see and deploy it). Then, I add several other application
configurations,
one for each scenario. For example, I'll have the main app.config,
dev.config and release.config.

Then, for each configuration I have a pre-build event that copies the
appropriate config on top of app.config. I then only edit only dev.config
or
release.config. This means the appropriate app.config exists in the bin
directory, plus it means when I build the setup the contents of the
release.config is used.
So do you have the 3 config files outside of the solution folders and then
copy (and rename them - ie "copy dev.config app.config")?

How do you do the pre-build event?

Thanks,

Tom
--
Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#
"tshad" wrote:
I have a Windows Service that I am deploying by setting a Deployment
project
in my solution.

The problem I am having is with the app.config file. This where we store
our connection string and folder locations.

My development app.config is different from my clients.

When I send him an msi file, I have to either add the clients app.config
file into my project in 2 locations (as I am running as an exe as well as
a
Service - which calls the code from the exe project) or send him the
app.config and have him replace it.

Is there a way to tell the deployment project to include a different
app.config file than is currently in the project.

Can you set up multiple build type (personalities) to run for testing?

Thanks,

Tom


Jun 27 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by raghavendra | last post: by
3 posts views Thread by Jeremy S. | last post: by
reply views Thread by yawnb | last post: by
1 post views Thread by Mahesh Devjibhai Dhola | last post: by
1 post views Thread by kirk.quinbar | last post: by
4 posts views Thread by ochocki | last post: by
2 posts views Thread by Mika M | last post: by
5 posts views Thread by dm3281 | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.