Search code examples
msbuildprojects-and-solutions

How to use ">" in msbuild proj file


I need to use ">" inside a tag in msbuild proj file to redirect devenv output to a file. My code is

<Exec Command='"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe" /build "Release|x86" ..\MySolution.sln ">" log.txt'/>

But it does not work for me. Please answer me how to use ">" inside xml tag.


Solution

  • Use the magic of character entities!

    &gt; or &#62;
    &lt; or &#60;
    &quot; or &#34;
    &apos; or &#39;
    &amp; or &#38;
    

    Output:
    > or >
    < or <
    " or "
    ' or '
    & or &

    <Exec Command='"C:\Program Files (x86)\Microsoft Visual Studio 
    9.0\Common7\IDE\devenv.exe" /build "Release|x86" ..\MySolution.sln &gt; log.txt'/>