views:

82

answers:

1

Hi folks,

My Web.Config Transformations are not getting published - and I think the error has to do with these warning(s) I'm getting.

Using Visual Studio 2010, I'm playing around with my Web.Config / Web.Config.Debug files.

In my .Debug file, I get the following warning listed numerous times.

No element in the source document matches '/configuration'

I think it lists it for each section that exists in the .Debug file.

So with the following sample Web.Config.Debug file .. that will be listed twice. (i'm guessing, the first one is for <connectionStrings>..</> and the second is for <system.webServer>...</.> )

<?xml version="1.0"?>

<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xdt:SupressWarnings="false">

    <connectionStrings>
        <add name="Foo" connectionString="Server=foo;Database=Foo;uid=foo;password=foo" providerName="System.Data.SqlClient"
            xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
    </connectionStrings>

    <system.webServer>
        <httpProtocol>
            <customHeaders>
                <clear />
                <add name="ETag" value="Dev_IIS" xdt:Transform="SetAttributes" xdt:Locator="Match(name)" />
            </customHeaders>
        </httpProtocol>
    </system.webServer>

</configuration>

Can anyone help, please?

A: 

I created a new web application project (targetting .net 4.0), changed the Web.Release.config to contain exactly what you pasted above. I then went to web.config and added the following:

    <add name="ApplicationServices"
         connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
         providerName="System.Data.SqlClient" />
    <add name="Foo" />  <------------------------added this
  </connectionStrings>

I then changed the configuration to release and published the web application. The published application contained the following in web.config

<add name="ApplicationServices"
     connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
     providerName="System.Data.SqlClient" />
<add name="Foo"
     connectionString="Server=foo;Database=Foo;uid=foo;password=foo"
     providerName="System.Data.SqlClient" />  <-------this got added

So I am not sure where the problem is in your case.

Raj Kaimal
hmmm :( damn :(
Pure.Krome
Try creating a new project like I did and see if you are able to reproduce the issue.
Raj Kaimal