|
39 | 39 | <ProjectProperty Include="PackageVersion" />
|
40 | 40 | </ItemGroup>
|
41 | 41 |
|
42 |
| - <Target Name="RenderHelp" AfterTargets="Build" Condition="$(DesignTimeBuild) != 'true'"> |
| 42 | + <Target Name="RenderHelp" AfterTargets="Build" Condition="$(DesignTimeBuild) != 'true' and '$(OS)' == 'Windows_NT'"> |
| 43 | + <PropertyGroup> |
| 44 | + <Cli>$(TargetDir)$(TargetName).exe</Cli> |
| 45 | + <HelpCommand>"$(Cli)" --help --tos --unattended</HelpCommand> |
| 46 | + <SyncCommand>"$(Cli)" sync --help --unattended</SyncCommand> |
| 47 | + </PropertyGroup> |
| 48 | + |
43 | 49 | <WriteLinesToFile Lines="```shell" Overwrite="true" Encoding="UTF-8" File="help.md" />
|
44 |
| - <Exec Command="dotnet run --no-build -c:$(Configuration) -- --help --tos --unattended >> help.md" StdOutEncoding="UTF-8" |
45 |
| - EnvironmentVariables="NO_COLOR=true" ContinueOnError="true"> |
| 50 | + |
| 51 | + <Exec Command="$(HelpCommand) >> help.md" StdOutEncoding="UTF-8" EnvironmentVariables="NO_COLOR=true" ContinueOnError="true"> |
46 | 52 | <Output TaskParameter="ExitCode" PropertyName="MSBuildLastExitCode" />
|
47 | 53 | </Exec>
|
48 | 54 | <!-- Run again if it failed, but without the output redirect, for troubleshooting via build logs -->
|
49 |
| - <Exec Condition="$(MSBuildLastExitCode) != '0'" |
50 |
| - Command="dotnet run --no-build -c:$(Configuration) -- --help --tos --unattended" StdOutEncoding="UTF-8" |
51 |
| - EnvironmentVariables="NO_COLOR=true" /> |
| 55 | + <Exec Condition="$(MSBuildLastExitCode) != '0'" Command="$(HelpCommand)" StdOutEncoding="UTF-8" EnvironmentVariables="NO_COLOR=true" /> |
52 | 56 | <Error Text="Failed to get help output." Condition="'$(MSBuildLastExitCode)' != '0'" />
|
| 57 | + |
53 | 58 | <WriteLinesToFile Lines="```" Overwrite="false" Encoding="UTF-8" File="help.md" />
|
54 | 59 |
|
55 | 60 | <WriteLinesToFile Lines="```shell" Overwrite="true" Encoding="UTF-8" File="sync.md" />
|
56 |
| - <Exec Command="dotnet run --no-build -c:$(Configuration) -- sync --help --unattended >> sync.md" StdOutEncoding="UTF-8" |
57 |
| - EnvironmentVariables="NO_COLOR=true" ContinueOnError="true"> |
| 61 | + <Exec Command="$(SyncCommand) >> sync.md" StdOutEncoding="UTF-8" EnvironmentVariables="NO_COLOR=true" ContinueOnError="true"> |
58 | 62 | <Output TaskParameter="ExitCode" PropertyName="MSBuildLastExitCode" />
|
59 | 63 | </Exec>
|
60 | 64 | <!-- Run again if it failed, but without the output redirect, for troubleshooting via build logs -->
|
61 |
| - <Exec Condition="$(MSBuildLastExitCode) != '0'" |
62 |
| - Command="dotnet run --no-build -c:$(Configuration) -- sync --help --unattended" StdOutEncoding="UTF-8" |
63 |
| - EnvironmentVariables="NO_COLOR=true" /> |
| 65 | + <Exec Condition="$(MSBuildLastExitCode) != '0'" Command="$(SyncCommand)" StdOutEncoding="UTF-8" EnvironmentVariables="NO_COLOR=true" /> |
64 | 66 | <Error Text="Failed to get help output." Condition="'$(MSBuildLastExitCode)' != '0'" />
|
65 | 67 | <WriteLinesToFile Lines="```" Overwrite="false" Encoding="UTF-8" File="sync.md" />
|
66 | 68 | </Target>
|
|
0 commit comments