-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSupportAdditionalFiles.targets
More file actions
33 lines (33 loc) · 1.77 KB
/
SupportAdditionalFiles.targets
File metadata and controls
33 lines (33 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<Project TreatAsLocalProperty="IsCrossTargetingProject;EditorConfigDir">
<PropertyGroup>
<IsCrossTargetingProject Condition="$(TargetFrameworks) != ''">true</IsCrossTargetingProject>
</PropertyGroup>
<Target
Name="UpdateEditorConfig"
BeforeTargets="DispatchToInnerBuilds;BeforeBuild;CSharpierFormat"
Condition=" '$(IsCrossTargetingProject)' == '$(IsCrossTargetingBuild)' "
>
<PropertyGroup>
<EditorConfigDir>$(SolutionDir)</EditorConfigDir>
<EditorConfigDir
Condition=" ('$(EditorConfigDir)' == '' or '$(EditorConfigDir)' == '*Undefined*') and '$(MSBuildProjectDirectory)' != ''"
>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), Directory.Packages.props))</EditorConfigDir
>
<EditorConfigDir
Condition=" ('$(EditorConfigDir)' == '' or '$(EditorConfigDir)' == '*Undefined*') and '$(ProjectDir)' != '' "
>$([MSBuild]::GetDirectoryNameOfFileAbove($(ProjectDir), Directory.Packages.props))</EditorConfigDir
>
</PropertyGroup>
<PropertyGroup>
<EditorConfigSource>$(MSBuildThisFileDirectory)..\configurations\editorconfig.txt</EditorConfigSource>
<EditorConfigDest>$([MSBuild]::NormalizePath('$(EditorConfigDir)', '.editorconfig'))</EditorConfigDest>
<CopyCommand Condition="'$(OS)' == 'Windows_NT'"
>pwsh -NoProfile -NonInteractive -Command "Copy-Item -Path '$(EditorConfigSource)' -Destination '$(EditorConfigDest)' -Force -ErrorAction SilentlyContinue"</CopyCommand
>
<CopyCommand Condition="'$(OS)' != 'Windows_NT'"
>bash -c "cp -f '$(EditorConfigSource)' '$(EditorConfigDest)' 2>/dev/null || true"</CopyCommand
>
</PropertyGroup>
<Exec Command="$(CopyCommand)" ContinueOnError="true" IgnoreExitCode="true" />
</Target>
</Project>