Skip to content

Commit

Permalink
Add VersionPrefix regex to csproj files
Browse files Browse the repository at this point in the history
  • Loading branch information
Invvard committed Feb 28, 2024
1 parent 2aae671 commit f0f6547
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/plugins/csproj-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Plugin, { PluginVersionRegex, VersionPartDelimiter } from "./plugin";

const VERSION_TAG_REGEX: RegExp = /<Version>(.*)<\/Version>/i;
const VERSION_PREFIX_TAG_REGEX: RegExp = /<VersionPrefix>(.*)<\/VersionPrefix>/i;
const ASSEMBLY_VERSION_TAG_REGEX: RegExp = /<AssemblyVersion>(.*)<\/AssemblyVersion>/i;
const FILE_VERSION_TAG_REGEX: RegExp = /<FileVersion>(.*)<\/FileVersion>/i;

Expand All @@ -15,6 +16,11 @@ export default class CsProjPlugin extends Plugin
versionPartDelimiter: VersionPartDelimiter.DOT,
versionType: "<Version> tag"
},
{
regex: VERSION_PREFIX_TAG_REGEX,
versionPartDelimiter: VersionPartDelimiter.DOT,
versionType: "<VersionPrefix> tag"
},
{
regex: ASSEMBLY_VERSION_TAG_REGEX,
versionPartDelimiter: VersionPartDelimiter.DOT,
Expand Down
1 change: 1 addition & 0 deletions test-files/expected-results/Test.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>4.5.6</Version>
<VersionPrefix>4.5.6</VersionPrefix>
<AssemblyVersion>4.5.6</AssemblyVersion>
<FileVersion>4.5.6</FileVersion>
</PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions test-files/input/Test.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>1.2.3</Version>
<VersionPrefix>1.2.3</VersionPrefix>
<AssemblyVersion>1.2.3</AssemblyVersion>
<FileVersion>1.2.3</FileVersion>
</PropertyGroup>
Expand Down

0 comments on commit f0f6547

Please sign in to comment.