我正在开发一个Visual Studio 2010扩展,想要给MSBuild项目添加一个属性,如下所示:
<EmbeddedResource Include="SomeFile.xml">
<FooAttribute>%(Filename)%(Extension)</FooAttribute>
</EmbeddedResource>
目前我找到的唯一方法是使用 IVsBuildPropertyStorage.SetItemAttribute
方法。这对于简单字符串可以正常工作,但当我尝试使用MSBuild中特殊的字符时,会得到以下结果:
<EmbeddedResource Include="SomeFile.xml">
<FooAttribute>%29%25%28Filename%29%25%28Extension%29</FooAttribute>
</EmbeddedResource>
这意味着
SetItemAttribute
会自动转义MsBuild字符,而我不希望这样。