Skip to content
This repository was archived by the owner on Jan 20, 2022. It is now read-only.

Commit 2e5098c

Browse files
authored
Merge pull request #103 from brandondahler/features/MetadataOnly_AppendToVersion
Allow metadata-only AppendToVersion
2 parents 096c446 + 4fbd449 commit 2e5098c

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

source/OctoPack.Tasks/CreateOctoPackPackage.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,11 @@ private void UpdateVersionWithAppendValue(XContainer nuSpec)
401401

402402
var version = GetVersionElementFromNuSpec(nuSpec);
403403

404-
version.Value = $"{PackageVersion ?? version.Value}-{AppendToVersion.Trim()}";
404+
if (AppendToVersion[0] != '+')
405+
version.Value = $"{PackageVersion ?? version.Value}-{AppendToVersion.Trim()}";
406+
else
407+
version.Value = $"{PackageVersion ?? version.Value}{AppendToVersion.Trim()}";
408+
405409
PackageVersion = version.Value;
406410
}
407411

source/OctoPack.Tests/Integration/SampleSolutionBuildFixture.cs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,54 @@ public void ShouldAllowAppendingValueToVersionWithExplicitPackageVersion()
494494
"Web.Debug.config"));
495495
}
496496

497+
[Test]
498+
public void ShouldAllowAppendingValueToVersionWithMetadataOnly()
499+
{
500+
MsBuild("Samples.sln /p:RunOctoPack=true /p:OctoPackAppendToVersion=+Foo /p:Configuration=Release /v:m");
501+
502+
AssertPackage(@"Sample.ConsoleApp\obj\octopacked\Sample.ConsoleApp.2.1.0.1+Foo.nupkg",
503+
pkg => pkg.AssertContents(
504+
"Sample.ConsoleApp.exe",
505+
"Sample.ConsoleApp.exe.config",
506+
"Sample.ConsoleApp.pdb"));
507+
508+
AssertPackage(@"Sample.WebApp\obj\octopacked\Sample.WebApp.3.1.0-dev+Foo.nupkg",
509+
pkg => pkg.AssertContents(
510+
"bin\\*.dll",
511+
"bin\\*.xml",
512+
"bin\\Sample.WebApp.dll",
513+
"bin\\Sample.WebApp.pdb",
514+
"Content\\*.css",
515+
"Content\\*.png",
516+
"Content\\LinkedFile.txt",
517+
"Scripts\\*.js",
518+
"Views\\Web.config",
519+
"Views\\*.cshtml",
520+
"Global.asax",
521+
"Web.config",
522+
"Web.Release.config",
523+
"Web.Debug.config"));
524+
525+
AssertPackage(@"Sample.WebAppWithSpec\obj\octopacked\Sample.WebAppWithSpec.1.0.13-demo+Foo.nupkg",
526+
pkg => pkg.AssertContents(
527+
"bin\\*.dll",
528+
"bin\\*.xml",
529+
"bin\\Sample.WebAppWithSpec.dll",
530+
"bin\\Sample.WebAppWithSpec.pdb",
531+
"Content\\*.css",
532+
"Content\\*.png",
533+
"Content\\LinkedFile.txt",
534+
"Scripts\\*.js",
535+
"Views\\Web.config",
536+
"Views\\*.cshtml",
537+
"Views\\Deploy.ps1",
538+
"Deploy.ps1",
539+
"Global.asax",
540+
"Web.config",
541+
"Web.Release.config",
542+
"Web.Debug.config"));
543+
}
544+
497545
[Test]
498546
public void ShouldSupportRelativeOutputDirectories()
499547
{

0 commit comments

Comments
 (0)