File tree Expand file tree Collapse file tree 3 files changed +58
-0
lines changed Expand file tree Collapse file tree 3 files changed +58
-0
lines changed Original file line number Diff line number Diff line change 62
62
<PrivateAssets >all</PrivateAssets >
63
63
</PackageReference >
64
64
</ItemGroup >
65
+
66
+ <UsingTask TaskName =" ReplaceFileText"
67
+ TaskFactory =" RoslynCodeTaskFactory"
68
+ AssemblyFile =" $(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll" >
69
+ <ParameterGroup >
70
+ <InputFilename ParameterType =" System.String" Required =" true" />
71
+ <OutputFilename ParameterType =" System.String" Required =" true" />
72
+ <MatchExpression ParameterType =" System.String" Required =" true" />
73
+ <ReplacementText ParameterType =" System.String" Required =" true" />
74
+ </ParameterGroup >
75
+ <Task >
76
+ <Using Namespace =" System" />
77
+ <Using Namespace =" System.IO" />
78
+ <Using Namespace =" System.Text.RegularExpressions" />
79
+ <Code Type =" Fragment" Language =" cs" >
80
+ <![CDATA[
81
+ File.WriteAllText(
82
+ OutputFilename,
83
+ Regex.Replace(File.ReadAllText(InputFilename), MatchExpression, ReplacementText)
84
+ );
85
+ ]]>
86
+ </Code >
87
+ </Task >
88
+ </UsingTask >
65
89
</Project >
Original file line number Diff line number Diff line change 24
24
<Compile Remove =" **\*" />
25
25
<None Remove =" *.bat;.sh" />
26
26
</ItemGroup >
27
+
28
+ <Target Name =" Fix BenchmarkDotNetVersion"
29
+ BeforeTargets =" Build" >
30
+ <ReplaceFileText
31
+ InputFilename =" templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json"
32
+ OutputFilename =" templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json"
33
+ MatchExpression =' ("defaultValue": )"([\d+\.?]+)"'
34
+ ReplacementText =' ${1}"$(VersionPrefix)"' />
35
+
36
+ <ReplaceFileText
37
+ InputFilename =" templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json"
38
+ OutputFilename =" templates/BenchmarkDotNet.BenchmarkProjectTemplate.FSharp/.template.config/template.json"
39
+ MatchExpression =' ("defaultValue": )"([\d+\.?]+)"'
40
+ ReplacementText =' ${1}"$(VersionPrefix)"' />
41
+
42
+ <ReplaceFileText
43
+ InputFilename =" templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json"
44
+ OutputFilename =" templates/BenchmarkDotNet.BenchmarkProjectTemplate.VB/.template.config/template.json"
45
+ MatchExpression =' ("defaultValue": )"([\d+\.?]+)"'
46
+ ReplacementText =' ${1}"$(VersionPrefix)"' />
47
+ </Target >
27
48
</Project >
Original file line number Diff line number Diff line change
1
+ # Run only from the folder where the shell script is located!
2
+
3
+ dotnet build BenchmarkDotNet.Templates.csproj -c Release
4
+ dotnet pack BenchmarkDotNet.Templates.csproj -c Release
5
+
6
+ # If we install the templates via a folder path, then it will have a different ID (ID=folder path).
7
+ # It will conflict with BDN templates from nuget.
8
+ # We need to install the templates via a FILE path in order to update the template from nuget.
9
+
10
+ nupkg_path=$( find . -name " BenchmarkDotNet.Templates*.nupkg" )
11
+
12
+ dotnet new uninstall " BenchmarkDotNet.Templates"
13
+ dotnet new install $nupkg_path
You can’t perform that action at this time.
0 commit comments