Used builtin write-to-file task

This commit is contained in:
Bekir Ozturk 2020-03-27 16:17:22 +01:00
parent e48b81f37e
commit 819cc4834b

View file

@ -1,34 +1,19 @@
<Project> <Project>
<!-- Used for creating productVersion and productCommit text files. -->
<UsingTask
TaskName="WriteTextToFile"
TaskFactory="RoslynCodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll" >
<ParameterGroup>
<Path Required="true" />
<Content Required="true" />
</ParameterGroup>
<Task>
<Code Type="Fragment" Language="cs">
var dir = System.IO.Path.GetDirectoryName(Path);
if(!string.IsNullOrEmpty(dir))
System.IO.Directory.CreateDirectory(dir);
System.IO.File.WriteAllText(Path, Content);
</Code>
</Task>
</UsingTask>
<Target Name="GenerateBundledVersions" <Target Name="GenerateBundledVersions"
DependsOnTargets="GenerateBundledVersionsProps;GenerateBundledCliToolsProps" > DependsOnTargets="GenerateBundledVersionsProps;GenerateBundledCliToolsProps" >
<WriteTextToFile
Path="$(ArtifactsShippingPackagesDir)productVersion.txt"
Content="$(PackageVersion)" />
<WriteTextToFile <WriteLinesToFile
Path="$(ArtifactsShippingPackagesDir)productCommit-$(Rid).txt" File="$(ArtifactsShippingPackagesDir)productVersion.txt"
Content="$(BUILD_SOURCEVERSION)%0A$(PackageVersion)" /> Lines="$(PackageVersion)"
Overwrite="true"
Encoding="ASCII"/>
<WriteLinesToFile
File="$(ArtifactsShippingPackagesDir)productCommit-$(Rid).txt"
Lines="$(BUILD_SOURCEVERSION)%0A$(PackageVersion)"
Overwrite="true"
Encoding="ASCII"/>
</Target> </Target>