Remove and add connection string
Each add entry in connectionStrings section will be parsed as ConnectionStringSettings at the end of the day.
This class has 3 properties: Name,ConnectionString and ProviderName.
In your provided sample you have defined only the first two.
Your provided sample seems to me a bit too specific/strict:

Replace only the connectionStrings attribute
Match the entity where the name equals MyConnectionString

The same result could be achieved with less specific transformation rules:
&lt;connectionStrings&gt;
    &lt;remove xdt:Transform=&quot;Replace&quot; name=&quot;MyConnectionString&quot; /&gt;
    &lt;add name=&quot;MyConnectionString&quot; connectionString=&quot;...;User Id=******;Password=123;&quot; 
      xdt:Transform=&quot;SetAttributes&quot; xdt:Locator=&quot;Match(name)&quot; /&gt;
  &lt;/connectionStrings&gt;


I've specified the name as an attribute of the add element
I've changed the Locator attribute value from Condition to Match
And I've removed the (connectionString) suffix from the Transform attribute

I've checked the transformation with this tool.