Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First, MSBuild files are XML, which you can encode as UTF-8, so you should be able to copy/paste the trademark character directly in the MSBuild script, <strong>without escaping</strong>.</p> <p>If you can't take that approach, <strong>don't escape the ampersand</strong>. There are two levels of escaping things in an MSBuild script. The first is XML-encoding, so that XML-sensitive characters (<code>&lt;</code> and <code>&amp;</code>) can be used and you'll still have safe XML. When MSBuild reads in the file, XML-escape sequences get unescaped. After that process, MSBuild then does its own un-escaping (i.e. <code>%3B</code> for semi-colons).</p> <p>Because you're using <code>&amp;amp;</code> at the beginning of your XMl escape sequence, the XML processor is interpreting that as a <em>literal</em> ampersand, not the special XML ampersand, which denotes an escape sequence. Change your <code>MyProductName</code> item group's value to be:</p> <pre><code>&lt;MyProductName Include="Trademarked&amp;#174; Product" /&gt; </code></pre> <p>Since <code>MyProductName</code> appears to be a scalar value, and not a list, I would use a property instead:</p> <pre><code>&lt;PropertyGroup&gt; &lt;MyProductName&gt;Trademarked® Product&lt;/MyProductName&gt; &lt;/PropertyGroup&gt; </code></pre> <p>In your <code>Exec</code> task you can then use it like this:</p> <pre><code>&lt;Exec Command="msbuild.exe subBuildScript.proj /p:DefineConstants=&amp;quot;MyProductName=$(MyProductName);OtherVar=@(foo);AnotherVar=asdf;&amp;quot; " /&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload