hvanbakel / CsprojToVs2017

Tooling for converting pre 2017 project to the new Visual Studio 2017 format.
MIT License
1.08k stars 120 forks source link

PostBuildEvent not migrated correctly #285

Open RichardD2 opened 3 years ago

RichardD2 commented 3 years ago

Source project extract:

<PropertyGroup>
    <PostBuildEvent>xcopy "$(TargetPath)" "$(SolutionDir)..\_bin\$(ConfigurationName)\" /y /c
xcopy "$(TargetDir)$(TargetName).pdb" "$(SolutionDir)..\_bin\$(ConfigurationName)\" /y /c
xcopy "$(TargetDir)$(TargetName).xml" "$(SolutionDir)..\_bin\$(ConfigurationName)\" /y /c</PostBuildEvent>
</PropertyGroup>

Expected result:

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
    <Exec Command="xcopy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)..\_bin\$(ConfigurationName)\&quot; /y /c&#xD;&#xA;xcopy &quot;$(TargetDir)$(TargetName).pdb&quot; &quot;$(SolutionDir)..\_bin\$(ConfigurationName)\&quot; /y /c&#xD;&#xA;xcopy &quot;$(TargetDir)$(TargetName).xml&quot; &quot;$(SolutionDir)..\_bin\$(ConfigurationName)\&quot; /y /c" />
</Target>

Actual result:

<PropertyGroup>
    <OutputType>...</OutputType>
    ...
    <PostBuildEvent>xcopy "$(TargetPath)" "$(SolutionDir)..\_bin\$(ConfigurationName)\" /y /c
xcopy "$(TargetDir)$(TargetName).pdb" "$(SolutionDir)..\_bin\$(ConfigurationName)\" /y /c
xcopy "$(TargetDir)$(TargetName).xml" "$(SolutionDir)..\_bin\$(ConfigurationName)\" /y /c</PostBuildEvent>
</PropertyGroup>
...
<PropertyGroup>
    <PostBuildEvent>xcopy "$(TargetPath)" "$(SolutionDir)..\_bin\$(ConfigurationName)\" /y /c
xcopy "$(TargetDir)$(TargetName).pdb" "$(SolutionDir)..\_bin\$(ConfigurationName)\" /y /c
xcopy "$(TargetDir)$(TargetName).xml" "$(SolutionDir)..\_bin\$(ConfigurationName)\" /y /c</PostBuildEvent>
</PropertyGroup>

The command is inserted into the output project twice, and is not converted to the new syntax. VS2019 does not support the old syntax.

Using the latest version (4.1.3).