Deployment in 2.0 - How To Not Overwrite web.config

Discussion in 'ASP .Net' started by =?Utf-8?B?Um9iZXJ0?=, Nov 2, 2005.

  1. I have what I think should be a pretty common scenario in a corporate
    environment. I have a web app and three environments on three servers:
    Development, QA and Production.

    We develop in development and then deploy the updated application to our QA
    server and then once tested to our production server.

    The application has a web.config file. The contents of the file
    (appsettings part) are different in all three environments because each
    enviroment connects to different databases (a dev, qa and the prod database).

    what I'm discovering is that the Publish option in VS2005 won't work in this
    scenario because it will copy web.config from development to QA or production
    and thus result in the incorrect appsettings...i.e. Production all of a
    sudden connecting to the development database.

    Is there any way around this with the Publish command? Or do i have to
    manually use "Copy Web" which is more timeconsuming?

    Excluding web.config does't work because the web.config in the destination
    is still wiped out. I tried setting web.config to Read ONly in QA and
    production but it is still deleted and overwritten by the one from dev.

    Seems like someone really didn't think of this common scenario. An "Exclude
    web.config" checkbox would have been all that was necessary. Or is this
    hidden somewhere?

    Thx.
    R-
    =?Utf-8?B?Um9iZXJ0?=, Nov 2, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?Um9iZXJ0?=

    Greg Burns Guest

    Not sure if this applies, but have your looked at using a user.config file?
    (I assume this still works in 2.0?)

    user.config
    <appSettings>
    <add key="ConnectionString"
    value="server=(local);Trusted_Connection=true;database=bar;Application
    Name=foo" />
    </appSettings>

    web.config
    <appSettings file="user.config">
    <add key="ConnectionString"
    value="server=PRODSERVER;Trusted_Connection=true;database=bar;Application
    Name=foo"/>
    </appSettings>

    My basic understanding is if the user.config is present it will use it,
    otherwise it defaults to the values in web.config. Not sure if Publish,
    copies user.config to server or not. Something to look into, hopefully
    somebody else has a better solution for you.

    Greg



    "Robert" <> wrote in message
    news:...
    >I have what I think should be a pretty common scenario in a corporate
    > environment. I have a web app and three environments on three servers:
    > Development, QA and Production.
    >
    > We develop in development and then deploy the updated application to our
    > QA
    > server and then once tested to our production server.
    >
    > The application has a web.config file. The contents of the file
    > (appsettings part) are different in all three environments because each
    > enviroment connects to different databases (a dev, qa and the prod
    > database).
    >
    > what I'm discovering is that the Publish option in VS2005 won't work in
    > this
    > scenario because it will copy web.config from development to QA or
    > production
    > and thus result in the incorrect appsettings...i.e. Production all of a
    > sudden connecting to the development database.
    >
    > Is there any way around this with the Publish command? Or do i have to
    > manually use "Copy Web" which is more timeconsuming?
    >
    > Excluding web.config does't work because the web.config in the destination
    > is still wiped out. I tried setting web.config to Read ONly in QA and
    > production but it is still deleted and overwritten by the one from dev.
    >
    > Seems like someone really didn't think of this common scenario. An
    > "Exclude
    > web.config" checkbox would have been all that was necessary. Or is this
    > hidden somewhere?
    >
    > Thx.
    > R-
    Greg Burns, Nov 2, 2005
    #2
    1. Advertising

  3. re:
    > An "Exclude web.config" checkbox would have been all that was necessary.


    Doesn't selecting web.config in the Solution Explorer, and then going to the
    menu "Website", and then clicking on "Exclude from project" work for you ?

    What I would do, though, is include *all* connection strings in web.config and,
    depending on the website's location, use the appropiate one.

    Something like (pseudocode ) :

    Dim dnsname As String = Request.Url.Host
    If dnsname = domain1 Then
    ' request connection string 1 here
    Elseif dnsname = domain2 Then
    ' request connection string 2 here
    Else
    ' request connection string 3 here
    End If
    End If


    That should take care of all your problems.




    Juan T. Llibre, ASP.NET MVP
    ASP.NET FAQ : http://asp.net.do/faq/
    Foros de ASP.NET en Español : http://asp.net.do/foros/
    ======================================
    "Robert" <> wrote in message
    news:...
    >I have what I think should be a pretty common scenario in a corporate
    > environment. I have a web app and three environments on three servers:
    > Development, QA and Production.
    >
    > We develop in development and then deploy the updated application to our QA
    > server and then once tested to our production server.
    >
    > The application has a web.config file. The contents of the file
    > (appsettings part) are different in all three environments because each
    > enviroment connects to different databases (a dev, qa and the prod database).
    >
    > what I'm discovering is that the Publish option in VS2005 won't work in this
    > scenario because it will copy web.config from development to QA or production
    > and thus result in the incorrect appsettings...i.e. Production all of a
    > sudden connecting to the development database.
    >
    > Is there any way around this with the Publish command? Or do i have to
    > manually use "Copy Web" which is more timeconsuming?
    >
    > Excluding web.config does't work because the web.config in the destination
    > is still wiped out. I tried setting web.config to Read ONly in QA and
    > production but it is still deleted and overwritten by the one from dev.
    >
    > Seems like someone really didn't think of this common scenario. An "Exclude
    > web.config" checkbox would have been all that was necessary. Or is this
    > hidden somewhere?
    >
    > Thx.
    > R-
    Juan T. Llibre, Nov 2, 2005
    #3
  4. Thanks for your suggestion but it unfortunately is not an option in my case.

    I tried using "exclude". When you use this, .net physically renames the
    file in the dev site where i am developing to "web.config.exclude" which then
    means that the dev site no longer works because there is no web.config.
    Furthermore, when using the "publish" command, all of the files in the
    destination are deleted first, irregardless of any "exclusion".

    Even if I put all of the connection strings in the same web.config so it
    could be identical in each environment i would still need to have a way to
    know which environment i was actually running in and this would mean
    hardcoding the url for example in a compiled file. Additionally in the
    corporate environment where I am it is not permissible that I stored the
    production credentials on the dev and qa sites although i do encrypt them.
    And in some cases, i may not be allowed to know the production database
    credentials which precludes them being the web.configs in each environments.

    I think there really should have been a setting under options that just said
    "exclude web.config" from publishing. And if checked, it 1) didn't delete a
    web.config and 2) didn't copy or overwrite it either.

    I am able to use the "copy web" to still deploy but it is significantly
    slower than using publish and slower than the process under vs 2003.
    Although theoretically if i just need to transfer a file or two, that is
    faster.

    thx.
    r-

    "Juan T. Llibre" wrote:

    > re:
    > > An "Exclude web.config" checkbox would have been all that was necessary.

    >
    > Doesn't selecting web.config in the Solution Explorer, and then going to the
    > menu "Website", and then clicking on "Exclude from project" work for you ?
    >
    > What I would do, though, is include *all* connection strings in web.config and,
    > depending on the website's location, use the appropiate one.
    >
    > Something like (pseudocode ) :
    >
    > Dim dnsname As String = Request.Url.Host
    > If dnsname = domain1 Then
    > ' request connection string 1 here
    > Elseif dnsname = domain2 Then
    > ' request connection string 2 here
    > Else
    > ' request connection string 3 here
    > End If
    > End If
    >
    >
    > That should take care of all your problems.
    >
    >
    >
    >
    > Juan T. Llibre, ASP.NET MVP
    > ASP.NET FAQ : http://asp.net.do/faq/
    > Foros de ASP.NET en Español : http://asp.net.do/foros/
    > ======================================
    > "Robert" <> wrote in message
    > news:...
    > >I have what I think should be a pretty common scenario in a corporate
    > > environment. I have a web app and three environments on three servers:
    > > Development, QA and Production.
    > >
    > > We develop in development and then deploy the updated application to our QA
    > > server and then once tested to our production server.
    > >
    > > The application has a web.config file. The contents of the file
    > > (appsettings part) are different in all three environments because each
    > > enviroment connects to different databases (a dev, qa and the prod database).
    > >
    > > what I'm discovering is that the Publish option in VS2005 won't work in this
    > > scenario because it will copy web.config from development to QA or production
    > > and thus result in the incorrect appsettings...i.e. Production all of a
    > > sudden connecting to the development database.
    > >
    > > Is there any way around this with the Publish command? Or do i have to
    > > manually use "Copy Web" which is more timeconsuming?
    > >
    > > Excluding web.config does't work because the web.config in the destination
    > > is still wiped out. I tried setting web.config to Read ONly in QA and
    > > production but it is still deleted and overwritten by the one from dev.
    > >
    > > Seems like someone really didn't think of this common scenario. An "Exclude
    > > web.config" checkbox would have been all that was necessary. Or is this
    > > hidden somewhere?
    > >
    > > Thx.
    > > R-

    >
    >
    >
    =?Utf-8?B?Um9iZXJ0?=, Nov 3, 2005
    #4
  5. re:
    > Even if I put all of the connection strings in the same web.config so it
    > could be identical in each environment i would still need to have a way to
    > know which environment i was actually running in and this would mean
    > hardcoding the url for example in a compiled file.


    No, no, no !

    The pseudocode I outlined would work in all 3 environments,
    providing the correct connection string to all of them.

    re:
    > And in some cases, i may not be allowed to know the production database
    > credentials which precludes them being the web.configs in each environments.


    You should talk your web admins about the inadvisability of that.

    If you are tasked with developing a production site,
    it's only natural that you have access to the databases there.

    Anything less than that only hobbles you...and not even they want that.


    re:
    > I am able to use the "copy web" to still deploy but
    > it is significantly slower than using publish


    I'll take that any day over not being able to do it at all.

    ;-)




    Juan T. Llibre, ASP.NET MVP
    ASP.NET FAQ : http://asp.net.do/faq/
    Foros de ASP.NET en Español : http://asp.net.do/foros/
    ======================================
    "Robert" <> wrote in message
    news:...
    > Thanks for your suggestion but it unfortunately is not an option in my case.
    >
    > I tried using "exclude". When you use this, .net physically renames the
    > file in the dev site where i am developing to "web.config.exclude" which then
    > means that the dev site no longer works because there is no web.config.
    > Furthermore, when using the "publish" command, all of the files in the
    > destination are deleted first, irregardless of any "exclusion".
    >
    > Even if I put all of the connection strings in the same web.config so it
    > could be identical in each environment i would still need to have a way to
    > know which environment i was actually running in and this would mean
    > hardcoding the url for example in a compiled file. Additionally in the
    > corporate environment where I am it is not permissible that I stored the
    > production credentials on the dev and qa sites although i do encrypt them.
    > And in some cases, i may not be allowed to know the production database
    > credentials which precludes them being the web.configs in each environments.
    >
    > I think there really should have been a setting under options that just said
    > "exclude web.config" from publishing. And if checked, it 1) didn't delete a
    > web.config and 2) didn't copy or overwrite it either.
    >
    > I am able to use the "copy web" to still deploy but it is significantly
    > slower than using publish and slower than the process under vs 2003.
    > Although theoretically if i just need to transfer a file or two, that is
    > faster.
    >
    > thx.
    > r-
    >
    > "Juan T. Llibre" wrote:
    >
    >> re:
    >> > An "Exclude web.config" checkbox would have been all that was necessary.

    >>
    >> Doesn't selecting web.config in the Solution Explorer, and then going to the
    >> menu "Website", and then clicking on "Exclude from project" work for you ?
    >>
    >> What I would do, though, is include *all* connection strings in web.config and,
    >> depending on the website's location, use the appropiate one.
    >>
    >> Something like (pseudocode ) :
    >>
    >> Dim dnsname As String = Request.Url.Host
    >> If dnsname = domain1 Then
    >> ' request connection string 1 here
    >> Elseif dnsname = domain2 Then
    >> ' request connection string 2 here
    >> Else
    >> ' request connection string 3 here
    >> End If
    >> End If
    >>
    >>
    >> That should take care of all your problems.
    >>
    >>
    >>
    >>
    >> Juan T. Llibre, ASP.NET MVP
    >> ASP.NET FAQ : http://asp.net.do/faq/
    >> Foros de ASP.NET en Español : http://asp.net.do/foros/
    >> ======================================
    >> "Robert" <> wrote in message
    >> news:...
    >> >I have what I think should be a pretty common scenario in a corporate
    >> > environment. I have a web app and three environments on three servers:
    >> > Development, QA and Production.
    >> >
    >> > We develop in development and then deploy the updated application to our QA
    >> > server and then once tested to our production server.
    >> >
    >> > The application has a web.config file. The contents of the file
    >> > (appsettings part) are different in all three environments because each
    >> > enviroment connects to different databases (a dev, qa and the prod database).
    >> >
    >> > what I'm discovering is that the Publish option in VS2005 won't work in this
    >> > scenario because it will copy web.config from development to QA or production
    >> > and thus result in the incorrect appsettings...i.e. Production all of a
    >> > sudden connecting to the development database.
    >> >
    >> > Is there any way around this with the Publish command? Or do i have to
    >> > manually use "Copy Web" which is more timeconsuming?
    >> >
    >> > Excluding web.config does't work because the web.config in the destination
    >> > is still wiped out. I tried setting web.config to Read ONly in QA and
    >> > production but it is still deleted and overwritten by the one from dev.
    >> >
    >> > Seems like someone really didn't think of this common scenario. An "Exclude
    >> > web.config" checkbox would have been all that was necessary. Or is this
    >> > hidden somewhere?
    >> >
    >> > Thx.
    >> > R-

    >>
    >>
    >>
    Juan T. Llibre, Nov 3, 2005
    #5
  6. Obviously I'll have to stick with Copy Web. I work for a financial
    institution (bank) and there are very strict government regulations so
    security is currently a very, very big concern.

    Thanks for your suggestions!

    "Juan T. Llibre" wrote:

    > re:
    > > Even if I put all of the connection strings in the same web.config so it
    > > could be identical in each environment i would still need to have a way to
    > > know which environment i was actually running in and this would mean
    > > hardcoding the url for example in a compiled file.

    >
    > No, no, no !
    >
    > The pseudocode I outlined would work in all 3 environments,
    > providing the correct connection string to all of them.
    >
    > re:
    > > And in some cases, i may not be allowed to know the production database
    > > credentials which precludes them being the web.configs in each environments.

    >
    > You should talk your web admins about the inadvisability of that.
    >
    > If you are tasked with developing a production site,
    > it's only natural that you have access to the databases there.
    >
    > Anything less than that only hobbles you...and not even they want that.
    >
    >
    > re:
    > > I am able to use the "copy web" to still deploy but
    > > it is significantly slower than using publish

    >
    > I'll take that any day over not being able to do it at all.
    >
    > ;-)
    >
    >
    >
    >
    > Juan T. Llibre, ASP.NET MVP
    > ASP.NET FAQ : http://asp.net.do/faq/
    > Foros de ASP.NET en Español : http://asp.net.do/foros/
    > ======================================
    > "Robert" <> wrote in message
    > news:...
    > > Thanks for your suggestion but it unfortunately is not an option in my case.
    > >
    > > I tried using "exclude". When you use this, .net physically renames the
    > > file in the dev site where i am developing to "web.config.exclude" which then
    > > means that the dev site no longer works because there is no web.config.
    > > Furthermore, when using the "publish" command, all of the files in the
    > > destination are deleted first, irregardless of any "exclusion".
    > >
    > > Even if I put all of the connection strings in the same web.config so it
    > > could be identical in each environment i would still need to have a way to
    > > know which environment i was actually running in and this would mean
    > > hardcoding the url for example in a compiled file. Additionally in the
    > > corporate environment where I am it is not permissible that I stored the
    > > production credentials on the dev and qa sites although i do encrypt them.
    > > And in some cases, i may not be allowed to know the production database
    > > credentials which precludes them being the web.configs in each environments.
    > >
    > > I think there really should have been a setting under options that just said
    > > "exclude web.config" from publishing. And if checked, it 1) didn't delete a
    > > web.config and 2) didn't copy or overwrite it either.
    > >
    > > I am able to use the "copy web" to still deploy but it is significantly
    > > slower than using publish and slower than the process under vs 2003.
    > > Although theoretically if i just need to transfer a file or two, that is
    > > faster.
    > >
    > > thx.
    > > r-
    > >
    > > "Juan T. Llibre" wrote:
    > >
    > >> re:
    > >> > An "Exclude web.config" checkbox would have been all that was necessary.
    > >>
    > >> Doesn't selecting web.config in the Solution Explorer, and then going to the
    > >> menu "Website", and then clicking on "Exclude from project" work for you ?
    > >>
    > >> What I would do, though, is include *all* connection strings in web.config and,
    > >> depending on the website's location, use the appropiate one.
    > >>
    > >> Something like (pseudocode ) :
    > >>
    > >> Dim dnsname As String = Request.Url.Host
    > >> If dnsname = domain1 Then
    > >> ' request connection string 1 here
    > >> Elseif dnsname = domain2 Then
    > >> ' request connection string 2 here
    > >> Else
    > >> ' request connection string 3 here
    > >> End If
    > >> End If
    > >>
    > >>
    > >> That should take care of all your problems.
    > >>
    > >>
    > >>
    > >>
    > >> Juan T. Llibre, ASP.NET MVP
    > >> ASP.NET FAQ : http://asp.net.do/faq/
    > >> Foros de ASP.NET en Español : http://asp.net.do/foros/
    > >> ======================================
    > >> "Robert" <> wrote in message
    > >> news:...
    > >> >I have what I think should be a pretty common scenario in a corporate
    > >> > environment. I have a web app and three environments on three servers:
    > >> > Development, QA and Production.
    > >> >
    > >> > We develop in development and then deploy the updated application to our QA
    > >> > server and then once tested to our production server.
    > >> >
    > >> > The application has a web.config file. The contents of the file
    > >> > (appsettings part) are different in all three environments because each
    > >> > enviroment connects to different databases (a dev, qa and the prod database).
    > >> >
    > >> > what I'm discovering is that the Publish option in VS2005 won't work in this
    > >> > scenario because it will copy web.config from development to QA or production
    > >> > and thus result in the incorrect appsettings...i.e. Production all of a
    > >> > sudden connecting to the development database.
    > >> >
    > >> > Is there any way around this with the Publish command? Or do i have to
    > >> > manually use "Copy Web" which is more timeconsuming?
    > >> >
    > >> > Excluding web.config does't work because the web.config in the destination
    > >> > is still wiped out. I tried setting web.config to Read ONly in QA and
    > >> > production but it is still deleted and overwritten by the one from dev.
    > >> >
    > >> > Seems like someone really didn't think of this common scenario. An "Exclude
    > >> > web.config" checkbox would have been all that was necessary. Or is this
    > >> > hidden somewhere?
    > >> >
    > >> > Thx.
    > >> > R-
    > >>
    > >>
    > >>

    >
    >
    >
    =?Utf-8?B?Um9iZXJ0?=, Nov 3, 2005
    #6
  7. =?Utf-8?B?Um9iZXJ0?=

    Greg Burns Guest

    http://dvxp.com/discus/messages/1/149.html?1071180598

    This is interesting. The recommendation here is to put the user.config file
    on the production server and not on the development server. That way you
    don't have to worry about it being copied at all.

    Does Publish really purge the destination folder first? I can't get it to
    do that will my quick test.

    Greg


    "Greg Burns" <> wrote in message
    news:ubpqYi$...
    > Not sure if this applies, but have your looked at using a user.config
    > file? (I assume this still works in 2.0?)
    >
    > user.config
    > <appSettings>
    > <add key="ConnectionString"
    > value="server=(local);Trusted_Connection=true;database=bar;Application
    > Name=foo" />
    > </appSettings>
    >
    > web.config
    > <appSettings file="user.config">
    > <add key="ConnectionString"
    > value="server=PRODSERVER;Trusted_Connection=true;database=bar;Application
    > Name=foo"/>
    > </appSettings>
    >
    > My basic understanding is if the user.config is present it will use it,
    > otherwise it defaults to the values in web.config. Not sure if Publish,
    > copies user.config to server or not. Something to look into, hopefully
    > somebody else has a better solution for you.
    >
    > Greg
    >
    >
    >
    > "Robert" <> wrote in message
    > news:...
    >>I have what I think should be a pretty common scenario in a corporate
    >> environment. I have a web app and three environments on three servers:
    >> Development, QA and Production.
    >>
    >> We develop in development and then deploy the updated application to our
    >> QA
    >> server and then once tested to our production server.
    >>
    >> The application has a web.config file. The contents of the file
    >> (appsettings part) are different in all three environments because each
    >> enviroment connects to different databases (a dev, qa and the prod
    >> database).
    >>
    >> what I'm discovering is that the Publish option in VS2005 won't work in
    >> this
    >> scenario because it will copy web.config from development to QA or
    >> production
    >> and thus result in the incorrect appsettings...i.e. Production all of a
    >> sudden connecting to the development database.
    >>
    >> Is there any way around this with the Publish command? Or do i have to
    >> manually use "Copy Web" which is more timeconsuming?
    >>
    >> Excluding web.config does't work because the web.config in the
    >> destination
    >> is still wiped out. I tried setting web.config to Read ONly in QA and
    >> production but it is still deleted and overwritten by the one from dev.
    >>
    >> Seems like someone really didn't think of this common scenario. An
    >> "Exclude
    >> web.config" checkbox would have been all that was necessary. Or is this
    >> hidden somewhere?
    >>
    >> Thx.
    >> R-

    >
    >
    Greg Burns, Nov 3, 2005
    #7
  8. =?Utf-8?B?Um9iZXJ0?=

    Greg Burns Guest

    I guess my test was a little too quick. I see that it DOES purge first.
    bummer

    "Greg Burns" <> wrote in message
    news:...
    > http://dvxp.com/discus/messages/1/149.html?1071180598
    >
    > This is interesting. The recommendation here is to put the user.config
    > file on the production server and not on the development server. That way
    > you don't have to worry about it being copied at all.
    >
    > Does Publish really purge the destination folder first? I can't get it to
    > do that will my quick test.
    >
    > Greg
    >
    >
    > "Greg Burns" <> wrote in message
    > news:ubpqYi$...
    >> Not sure if this applies, but have your looked at using a user.config
    >> file? (I assume this still works in 2.0?)
    >>
    >> user.config
    >> <appSettings>
    >> <add key="ConnectionString"
    >> value="server=(local);Trusted_Connection=true;database=bar;Application
    >> Name=foo" />
    >> </appSettings>
    >>
    >> web.config
    >> <appSettings file="user.config">
    >> <add key="ConnectionString"
    >> value="server=PRODSERVER;Trusted_Connection=true;database=bar;Application
    >> Name=foo"/>
    >> </appSettings>
    >>
    >> My basic understanding is if the user.config is present it will use it,
    >> otherwise it defaults to the values in web.config. Not sure if Publish,
    >> copies user.config to server or not. Something to look into, hopefully
    >> somebody else has a better solution for you.
    >>
    >> Greg
    >>
    >>
    >>
    >> "Robert" <> wrote in message
    >> news:...
    >>>I have what I think should be a pretty common scenario in a corporate
    >>> environment. I have a web app and three environments on three servers:
    >>> Development, QA and Production.
    >>>
    >>> We develop in development and then deploy the updated application to our
    >>> QA
    >>> server and then once tested to our production server.
    >>>
    >>> The application has a web.config file. The contents of the file
    >>> (appsettings part) are different in all three environments because each
    >>> enviroment connects to different databases (a dev, qa and the prod
    >>> database).
    >>>
    >>> what I'm discovering is that the Publish option in VS2005 won't work in
    >>> this
    >>> scenario because it will copy web.config from development to QA or
    >>> production
    >>> and thus result in the incorrect appsettings...i.e. Production all of a
    >>> sudden connecting to the development database.
    >>>
    >>> Is there any way around this with the Publish command? Or do i have to
    >>> manually use "Copy Web" which is more timeconsuming?
    >>>
    >>> Excluding web.config does't work because the web.config in the
    >>> destination
    >>> is still wiped out. I tried setting web.config to Read ONly in QA and
    >>> production but it is still deleted and overwritten by the one from dev.
    >>>
    >>> Seems like someone really didn't think of this common scenario. An
    >>> "Exclude
    >>> web.config" checkbox would have been all that was necessary. Or is this
    >>> hidden somewhere?
    >>>
    >>> Thx.
    >>> R-

    >>
    >>

    >
    >
    Greg Burns, Nov 3, 2005
    #8
  9. re:
    > Does Publish really purge the destination folder first?


    It does...



    Juan T. Llibre, ASP.NET MVP
    ASP.NET FAQ : http://asp.net.do/faq/
    Foros de ASP.NET en Español : http://asp.net.do/foros/
    ======================================
    "Greg Burns" <> wrote in message
    news:...
    > http://dvxp.com/discus/messages/1/149.html?1071180598
    >
    > This is interesting. The recommendation here is to put the user.config file on the
    > production server and not on the development server. That way you don't have to worry
    > about it being copied at all.
    >
    > Does Publish really purge the destination folder first? I can't get it to do that will
    > my quick test.
    >
    > Greg
    >
    >
    > "Greg Burns" <> wrote in message
    > news:ubpqYi$...
    >> Not sure if this applies, but have your looked at using a user.config file? (I assume
    >> this still works in 2.0?)
    >>
    >> user.config
    >> <appSettings>
    >> <add key="ConnectionString"
    >> value="server=(local);Trusted_Connection=true;database=bar;Application Name=foo" />
    >> </appSettings>
    >>
    >> web.config
    >> <appSettings file="user.config">
    >> <add key="ConnectionString"
    >> value="server=PRODSERVER;Trusted_Connection=true;database=bar;Application Name=foo"/>
    >> </appSettings>
    >>
    >> My basic understanding is if the user.config is present it will use it, otherwise it
    >> defaults to the values in web.config. Not sure if Publish, copies user.config to
    >> server or not. Something to look into, hopefully somebody else has a better solution
    >> for you.
    >>
    >> Greg
    >>
    >>
    >>
    >> "Robert" <> wrote in message
    >> news:...
    >>>I have what I think should be a pretty common scenario in a corporate
    >>> environment. I have a web app and three environments on three servers:
    >>> Development, QA and Production.
    >>>
    >>> We develop in development and then deploy the updated application to our QA
    >>> server and then once tested to our production server.
    >>>
    >>> The application has a web.config file. The contents of the file
    >>> (appsettings part) are different in all three environments because each
    >>> enviroment connects to different databases (a dev, qa and the prod database).
    >>>
    >>> what I'm discovering is that the Publish option in VS2005 won't work in this
    >>> scenario because it will copy web.config from development to QA or production
    >>> and thus result in the incorrect appsettings...i.e. Production all of a
    >>> sudden connecting to the development database.
    >>>
    >>> Is there any way around this with the Publish command? Or do i have to
    >>> manually use "Copy Web" which is more timeconsuming?
    >>>
    >>> Excluding web.config does't work because the web.config in the destination
    >>> is still wiped out. I tried setting web.config to Read ONly in QA and
    >>> production but it is still deleted and overwritten by the one from dev.
    >>>
    >>> Seems like someone really didn't think of this common scenario. An "Exclude
    >>> web.config" checkbox would have been all that was necessary. Or is this
    >>> hidden somewhere?
    >>>
    >>> Thx.
    >>> R-

    >>
    >>

    >
    >
    Juan T. Llibre, Nov 3, 2005
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Benny Ng
    Replies:
    9
    Views:
    9,957
    Benny Ng
    Oct 13, 2005
  2. CSharpner
    Replies:
    0
    Views:
    1,019
    CSharpner
    Apr 9, 2007
  3. Andy
    Replies:
    5
    Views:
    573
    =?ISO-8859-1?Q?G=F6ran_Andersson?=
    Jun 12, 2007
  4. pamela fluente
    Replies:
    1
    Views:
    304
    pamela fluente
    Sep 13, 2007
  5. Ira Grollman
    Replies:
    0
    Views:
    137
    Ira Grollman
    Nov 26, 2007
Loading...

Share This Page