Skip to content

Commit

Permalink
Merge pull request #70 from BalassaMarton/versioning-minver
Browse files Browse the repository at this point in the history
Switch from GitVersion to MinVer
  • Loading branch information
BalassaMarton committed Feb 1, 2024
2 parents 8071293 + 2dd016c commit fa48b09
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 18 deletions.
1 change: 0 additions & 1 deletion DotNetPlease.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_", "_", "{515E17A9-0C5F-44
ProjectSection(SolutionItems) = preProject
CONTRIBUTING.md = CONTRIBUTING.md
DISCLAIMER = DISCLAIMER
GitVersion.yml = GitVersion.yml
LICENSE = LICENSE
NOTICE = NOTICE
README.md = README.md
Expand Down
1 change: 1 addition & 0 deletions DotNetPlease.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ to in writing, software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the License for the specific language governing permissions
and limitations under the License.</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002ECodeCleanup_002EFileHeader_002EFileHeaderSettingsMigrate/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
Expand Down
19 changes: 14 additions & 5 deletions DotNetPlease/DotNetPlease.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<Configurations>Debug;Release</Configurations>
<VersionPrefix>1.0.0</VersionPrefix>
<PackageId>MorganStanley.DotNetPlease</PackageId>
<Description>dotnet-please global tool for streamlining repetitive tasks around Visual Studio projects and solutions.</Description>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<DisableMSBuildAssemblyCopyCheck>true</DisableMSBuildAssemblyCopyCheck>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<MinVerTagPrefix>v</MinVerTagPrefix>
</PropertyGroup>

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

<ItemGroup>
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
<PackageReference Include="MediatR" Version="8.0.0" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="8.0.0" />
Expand All @@ -37,6 +33,10 @@
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="6.0.0" />
<PackageReference Include="MinVer" Version="4.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NuGet.Versioning" Version="6.5.0" />
<PackageReference Include="System.Collections.Immutable" Version="6.0.0" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20574.7" />
Expand All @@ -47,4 +47,13 @@
<InternalsVisibleTo Include="DotNetPlease.Tests" />
</ItemGroup>

<Target Name="GeneratePackageVersionAttribute" AfterTargets="MinVer">
<ItemGroup>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>PackageVersion</_Parameter1>
<_Parameter2>$(PackageVersion)</_Parameter2>
</AssemblyAttribute>
</ItemGroup>
</Target>

</Project>
12 changes: 11 additions & 1 deletion DotNetPlease/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
// and limitations under the License.

using System;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

Expand All @@ -22,7 +24,7 @@ static Task<int> Main(string[] args)
{
Console.OutputEncoding = Encoding.UTF8;
Console.WriteLine("dotnet-please from Morgan Stanley");
Console.WriteLine(GitVersionInformation.NuGetVersionV2);
Console.WriteLine(ReadVersion() ?? "<unknown version>");
Console.WriteLine("Visit us at https://github.com/morganstanley");
Console.WriteLine();
try
Expand All @@ -36,5 +38,13 @@ static Task<int> Main(string[] args)
return Task.FromResult(e.HResult);
}
}

static string? ReadVersion()
{
return Assembly.GetEntryAssembly()

Check warning on line 44 in DotNetPlease/Program.cs

View workflow job for this annotation

GitHub Actions / build / build

Possible null reference argument for parameter 'element' in 'IEnumerable<AssemblyMetadataAttribute> CustomAttributeExtensions.GetCustomAttributes<AssemblyMetadataAttribute>(Assembly element)'.

Check warning on line 44 in DotNetPlease/Program.cs

View workflow job for this annotation

GitHub Actions / build / build

Possible null reference argument for parameter 'element' in 'IEnumerable<AssemblyMetadataAttribute> CustomAttributeExtensions.GetCustomAttributes<AssemblyMetadataAttribute>(Assembly element)'.
.GetCustomAttributes<AssemblyMetadataAttribute>()
.FirstOrDefault(a => a.Key == "PackageVersion")
?.Value;
}
}
}
12 changes: 6 additions & 6 deletions DotNetPlease/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
"version": 1,
"dependencies": {
"net6.0": {
"GitVersion.MsBuild": {
"type": "Direct",
"requested": "[5.12.0, )",
"resolved": "5.12.0",
"contentHash": "dJuigXycpJNOiLT9or7mkHSkGFHgGW3/p6cNNYEKZBa7Hhp1FdX/cvqYWWYhRLpfoZOedeA7aRbYiOB3vW/dvA=="
},
"JetBrains.Annotations": {
"type": "Direct",
"requested": "[2019.1.3, )",
Expand Down Expand Up @@ -94,6 +88,12 @@
"resolved": "6.0.0",
"contentHash": "ip8jnL1aPiaPeKINCqaTEbvBFDmVx9dXQEBZ2HOBRXPD1eabGNqP/bKlsIcp7U2lGxiXd5xIhoFcmY8nM4Hdiw=="
},
"MinVer": {
"type": "Direct",
"requested": "[4.3.0, )",
"resolved": "4.3.0",
"contentHash": "YNVAW3loCFW4kTwensApaZUl+7xREK75QQNOFSbsbXx2sCSm9/IHBjUHsJGn3u0UA5r/sAqrdYBNUlOFfLhUrA=="
},
"NuGet.Versioning": {
"type": "Direct",
"requested": "[6.5.0, )",
Expand Down
5 changes: 0 additions & 5 deletions GitVersion.yml

This file was deleted.

0 comments on commit fa48b09

Please sign in to comment.