Skip to content

Commit fa48b09

Browse files
Merge pull request #70 from BalassaMarton/versioning-minver
Switch from GitVersion to MinVer
2 parents 8071293 + 2dd016c commit fa48b09

File tree

6 files changed

+32
-18
lines changed

6 files changed

+32
-18
lines changed

DotNetPlease.sln

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_", "_", "{515E17A9-0C5F-44
1111
ProjectSection(SolutionItems) = preProject
1212
CONTRIBUTING.md = CONTRIBUTING.md
1313
DISCLAIMER = DISCLAIMER
14-
GitVersion.yml = GitVersion.yml
1514
LICENSE = LICENSE
1615
NOTICE = NOTICE
1716
README.md = README.md

DotNetPlease.sln.DotSettings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ to in writing, software distributed under the License is distributed on an
3030
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
3131
or implied. See the License for the specific language governing permissions
3232
and limitations under the License.</s:String>
33+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002ECodeCleanup_002EFileHeader_002EFileHeaderSettingsMigrate/@EntryIndexedValue">True</s:Boolean>
3334
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
3435
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
3536
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>

DotNetPlease/DotNetPlease.csproj

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<TargetFramework>net6.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
<Configurations>Debug;Release</Configurations>
8-
<VersionPrefix>1.0.0</VersionPrefix>
98
<PackageId>MorganStanley.DotNetPlease</PackageId>
109
<Description>dotnet-please global tool for streamlining repetitive tasks around Visual Studio projects and solutions.</Description>
1110
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
1211
<DisableMSBuildAssemblyCopyCheck>true</DisableMSBuildAssemblyCopyCheck>
1312
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
13+
<MinVerTagPrefix>v</MinVerTagPrefix>
1414
</PropertyGroup>
1515

1616
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
@@ -24,10 +24,6 @@
2424
</ItemGroup>
2525

2626
<ItemGroup>
27-
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0">
28-
<PrivateAssets>all</PrivateAssets>
29-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
30-
</PackageReference>
3127
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
3228
<PackageReference Include="MediatR" Version="8.0.0" />
3329
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="8.0.0" />
@@ -37,6 +33,10 @@
3733
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
3834
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
3935
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="6.0.0" />
36+
<PackageReference Include="MinVer" Version="4.3.0">
37+
<PrivateAssets>all</PrivateAssets>
38+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
39+
</PackageReference>
4040
<PackageReference Include="NuGet.Versioning" Version="6.5.0" />
4141
<PackageReference Include="System.Collections.Immutable" Version="6.0.0" />
4242
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20574.7" />
@@ -47,4 +47,13 @@
4747
<InternalsVisibleTo Include="DotNetPlease.Tests" />
4848
</ItemGroup>
4949

50+
<Target Name="GeneratePackageVersionAttribute" AfterTargets="MinVer">
51+
<ItemGroup>
52+
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
53+
<_Parameter1>PackageVersion</_Parameter1>
54+
<_Parameter2>$(PackageVersion)</_Parameter2>
55+
</AssemblyAttribute>
56+
</ItemGroup>
57+
</Target>
58+
5059
</Project>

DotNetPlease/Program.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
// and limitations under the License.
1212

1313
using System;
14+
using System.Linq;
15+
using System.Reflection;
1416
using System.Text;
1517
using System.Threading.Tasks;
1618

@@ -22,7 +24,7 @@ static Task<int> Main(string[] args)
2224
{
2325
Console.OutputEncoding = Encoding.UTF8;
2426
Console.WriteLine("dotnet-please from Morgan Stanley");
25-
Console.WriteLine(GitVersionInformation.NuGetVersionV2);
27+
Console.WriteLine(ReadVersion() ?? "<unknown version>");
2628
Console.WriteLine("Visit us at https://github.com/morganstanley");
2729
Console.WriteLine();
2830
try
@@ -36,5 +38,13 @@ static Task<int> Main(string[] args)
3638
return Task.FromResult(e.HResult);
3739
}
3840
}
41+
42+
static string? ReadVersion()
43+
{
44+
return Assembly.GetEntryAssembly()
45+
.GetCustomAttributes<AssemblyMetadataAttribute>()
46+
.FirstOrDefault(a => a.Key == "PackageVersion")
47+
?.Value;
48+
}
3949
}
4050
}

DotNetPlease/packages.lock.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22
"version": 1,
33
"dependencies": {
44
"net6.0": {
5-
"GitVersion.MsBuild": {
6-
"type": "Direct",
7-
"requested": "[5.12.0, )",
8-
"resolved": "5.12.0",
9-
"contentHash": "dJuigXycpJNOiLT9or7mkHSkGFHgGW3/p6cNNYEKZBa7Hhp1FdX/cvqYWWYhRLpfoZOedeA7aRbYiOB3vW/dvA=="
10-
},
115
"JetBrains.Annotations": {
126
"type": "Direct",
137
"requested": "[2019.1.3, )",
@@ -94,6 +88,12 @@
9488
"resolved": "6.0.0",
9589
"contentHash": "ip8jnL1aPiaPeKINCqaTEbvBFDmVx9dXQEBZ2HOBRXPD1eabGNqP/bKlsIcp7U2lGxiXd5xIhoFcmY8nM4Hdiw=="
9690
},
91+
"MinVer": {
92+
"type": "Direct",
93+
"requested": "[4.3.0, )",
94+
"resolved": "4.3.0",
95+
"contentHash": "YNVAW3loCFW4kTwensApaZUl+7xREK75QQNOFSbsbXx2sCSm9/IHBjUHsJGn3u0UA5r/sAqrdYBNUlOFfLhUrA=="
96+
},
9797
"NuGet.Versioning": {
9898
"type": "Direct",
9999
"requested": "[6.5.0, )",

GitVersion.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)