Fix XML escaping

- #12786
- escape `'<'` chars in attribute values to make the .targets file valid XML
- escape `'\''` chars nested within single-quoted values to make `msbuild` conditions valid
This commit is contained in:
Doug Bunting 2019-07-30 07:18:10 -07:00
parent 7324387bf6
commit 8dd1be9474
1 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@
<Project> <Project>
<PropertyGroup Condition=" '$(OpenApiGenerateDocuments)' == '' "> <PropertyGroup Condition=" '$(OpenApiGenerateDocuments)' == '' ">
<OpenApiGenerateDocuments <OpenApiGenerateDocuments
Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND '$(TargetFrameworkVersion.TrimStart('vV'))' &lt; '2.1' ">false</OpenApiGenerateDocuments> Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND '$(TargetFrameworkVersion.TrimStart(&quot;vV&quot;))' &lt; '2.1' ">false</OpenApiGenerateDocuments>
<OpenApiGenerateDocuments Condition=" '$(OpenApiGenerateDocuments)' == '' ">true</OpenApiGenerateDocuments> <OpenApiGenerateDocuments Condition=" '$(OpenApiGenerateDocuments)' == '' ">true</OpenApiGenerateDocuments>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
@ -16,7 +16,7 @@
</ItemGroup> </ItemGroup>
<Target Name="OpenApiGetDocuments" Returns="@(_OpenApiProjectDocuments)"> <Target Name="OpenApiGetDocuments" Returns="@(_OpenApiProjectDocuments)">
<Error Text="OpenAPI document generation is disabled. Add '<OpenApiGenerateDocuments>true</OpenApiGenerateDocuments>' to the project." <Error Text="OpenAPI document generation is disabled. Add '&lt;OpenApiGenerateDocuments>true&lt;/OpenApiGenerateDocuments>' to the project."
Condition=" '$(OpenApiGenerateDocuments)' != 'true' " /> Condition=" '$(OpenApiGenerateDocuments)' != 'true' " />
<ReadLinesFromFile File="$(_OpenApiDocumentsCache)"> <ReadLinesFromFile File="$(_OpenApiDocumentsCache)">
@ -32,7 +32,7 @@
Inputs="$(TargetPath)" Inputs="$(TargetPath)"
Outputs="$(_OpenApiDocumentsCache)"> Outputs="$(_OpenApiDocumentsCache)">
<Error Text="OpenAPI document generation is not supported when targeting netcoreapp2.0 or earlier. Disable the feature or move to a later target framework." <Error Text="OpenAPI document generation is not supported when targeting netcoreapp2.0 or earlier. Disable the feature or move to a later target framework."
Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND '$(TargetFrameworkVersion.TrimStart('vV'))' &lt; '2.1' " /> Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND '$(TargetFrameworkVersion.TrimStart(&quot;vV&quot;))' &lt; '2.1' " />
<PropertyGroup> <PropertyGroup>
<_Command>dotnet "$(MSBuildThisFileDirectory)/../tools/dotnet-getdocument.dll" --assembly "$(TargetPath)"</_Command> <_Command>dotnet "$(MSBuildThisFileDirectory)/../tools/dotnet-getdocument.dll" --assembly "$(TargetPath)"</_Command>