Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I getting a "No attribute 'name' exists for the Match Locator" error when publishing?

I am so confused on this. I want to use the SQL Server on my desktop when I am developing and using the live SQL Server when I publish my project. I am playing with the transformation stuff in Visual Studio 2010.

I get the "No attribute 'name' exists for the Match Locator" when I try to publish my project.

My Web.config file contains:

<connectionStrings>
    <add name="EFDbContext" connectionString="Data Source=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=db" providerName="System.Data.SqlClient"/>
</connectionStrings>

<system.web>
    <sessionState mode="SQLServer" sqlConnectionString="Server=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=ASPState;Application Name=eGov" timeout="20" allowCustomSqlDatabase="true" />
</system.web>

I am still testing it, so for now, my Web.Release.config file contains:

<connectionStrings>
    <add name="EFDbContext"
        connectionString="Data Source=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=db" 
            providerName="System.Data.SqlClient" 
            xdt:Transform="SetAttributes" xdt:Locator="Match(name)" />
</connectionStrings>

<system.web>
    <compilation xdt:Transform="RemoveAttributes(debug)" />
    <sessionState mode="SQLServer"
        sqlConnectionString="Server=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=ASPState;Application Name=app"
        timeout="20" allowCustomSqlDatabase="true"
        xdt:Transform="SetAttributes" xdt:Locator="Match(name)" />
</system.web>

Anything I am seeing online is only confusing me more. Any help to get me up and running?

like image 786
Mike Wills Avatar asked Nov 03 '11 15:11

Mike Wills


1 Answers

xdt:Locator="Match(name) mean that system will match nodes to replace using name tag. If you don't have name attribute then it fails. You must have some unique attribute to use this type of transformation.

like image 168
Marcello Avatar answered Dec 27 '22 14:12

Marcello