dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.21k stars 1.35k forks source link

MSBuild mangles whitespace in attribute strings when preprocessing #362

Open rainersigwald opened 8 years ago

rainersigwald commented 8 years ago

The MSBuild preprocessor makes its output harder to read by collapsing whitespace inside strings (probably due to XML parsing or output). It'd be nice if it kept things as

    <Target
        Name="XamlPreCompile"
        Inputs="$(MSBuildAllProjects);
                @(Compile);
                @(_CoreCompileResourceInputs);
                $(ApplicationIcon);
                $(AssemblyOriginatorKeyFile);
                @(ReferencePath);
                @(CompiledLicenseFile);
                @(LinkResource);
                @(EmbeddedDocumentation);
                $(Win32Resource);
                $(Win32Manifest);
                @(Page);
                @(ApplicationDefinition);
                @(CustomAdditionalCompileInputs);
                $(ResolvedCodeAnalysisRuleSet)"
        Outputs="@(DocFileItem);
                 @(XamlIntermediateAssembly);
                 @(_DebugSymbolsIntermediatePath);
                 $(NonExistentFile);
                 @(CustomAdditionalCompileOutputs)"
        Returns=""
        DependsOnTargets="$(CoreCompileDependsOn)"
        Condition="'@(Page)' != '' Or '@(ApplicationDefinition)' != ''"
    >

instead of turning it into

  <Target Name="XamlPreCompile" Inputs="$(MSBuildAllProjects);&#xD;&#xA;                @(Compile);&#xD;&#xA;                @(_CoreCompileResourceInputs);&#xD;&#xA;                $(ApplicationIcon);&#xD;&#xA;                $(AssemblyOriginatorKeyFile);&#xD;&#xA;                @(ReferencePath);&#xD;&#xA;                @(CompiledLicenseFile);&#xD;&#xA;                @(LinkResource);&#xD;&#xA;                @(EmbeddedDocumentation);&#xD;&#xA;                $(Win32Resource);&#xD;&#xA;                $(Win32Manifest);&#xD;&#xA;                @(Page);&#xD;&#xA;                @(ApplicationDefinition);&#xD;&#xA;                @(CustomAdditionalCompileInputs);&#xD;&#xA;                $(ResolvedCodeAnalysisRuleSet)" Outputs="@(DocFileItem);&#xD;&#xA;                 @(XamlIntermediateAssembly);&#xD;&#xA;                 @(_DebugSymbolsIntermediatePath);&#xD;&#xA;                 $(NonExistentFile);&#xD;&#xA;                 @(CustomAdditionalCompileOutputs)" Returns="" DependsOnTargets="$(CoreCompileDependsOn)" Condition="'@(Page)' != '' Or '@(ApplicationDefinition)' != ''">
stijnherreman commented 5 years ago

This happens (or can happen) when updating a NuGet package.

jakubsuchybio commented 3 years ago

SDK-style csproj with net48 target: image Fix anytime soon? Or is it tracked elsewhere?