Version string specified for package is incorrect

I am getting this error.

##[error]Version string specified for package reference ‘2.3.8291.31115-svotc/svotcrelease1m’ is invalid.

Good morning @rr.rohitsharma01,

Thank you for contacting Octopus Support and welcome to the forums!

I am sorry to hear you are having issues with packaging applciations in TFS. From the error message you are getting it seems like your package version string is not valid semver.

What version of TFS are you running and what are you putting in the field for Build Number?

We have some documentation on how to configure your build pipeline in ADO / TFS here but the main bit you need to look at is what you have put in here:

This is the value you should be using, or at least your own version of it. If you are running TFS 2012 though we have a few forum posts with messages similar to yours who have had to use another value. This one here is the most helpful.

Are you able to take a look at what value you have in there and if you are running TFS 2012 give the value in the forums a go and see if that fixes the issue.

I look forward to hearing from you,

Kind Regards,

Clare

This is the place where my build is failing.
For build number this is the setting BuildNumber=$(Build.BuildId)

Where should I update. I am little confused as I am new to this.


This the build number format which we have used

Hey @rr.rohitsharma01,

Just running some tests my end on this as what you have should, in theory, work.

Its clearly the version number it does not like, I will get back to you once I have done my tests.

Kind Regards,

Clare

Hey @rr.rohitsharma01,

Thank you for your patience whilst I worked on getting this tested. It seems like the issue is with the / in your pre-release tag:

‘2.3.8291.31115-svotc**/**svotcrelease1m’

I ran my testing on the Octopus CLI to package a folder into a .zip file to test the version numbers, first I ran it with just the numbers which ran fine. I then tried your version number and that threw the same error.

I then changed the / to a - and this worked:

Seems like the / character is not supported in semver versions so you will need to change that to another character.

Let me know if that works for you,

Kind Regards,

Clare

How Can I change it. from / to any other character ? Is there a way ? the build project is inside the folder so its taking the folder/buildproject. How can I configure so that it should not take the folder and ‘/’ ?

Hey @rr.rohitsharma01,

I’m jumping in for Clare as she is offline for the night. From the Microsoft documentation on build variables, the branch name shouldn’t contain the slash. However, in your build command, you have OctopackAppendToVersion command that is likely adding the entire branch to the end of your package name, including the slash. You’d likely need to remove that or alter it to be just the smaller branch name like the Build.SourceBranchName variable. Or you might even change your Octopack command to contain the version number in one command like this:

BuildNumber=$(Build.BuildId).$(Build.SourceBranchName)

Let us know if you’re able to try out those changes and how it goes.

Best,
Brent

Good morning @rr.rohitsharma01

I have some good news for you this morning. Our engineers updated a GitHub Issue we were already working on. Originally the issue was for having letters at the start of Maven packages but due to a few customers having issues such as the one you were facing below the engineers have extended that GitHub issue out to other packages. Also, in addition to SemVer, package retention now supports other version formats. This means that underscores and forward slashes should now be accepted.

The fix for this is out in the builds on the GitHub issue but for convenience, I have included them below:

2022.2.8350

2022.3.10530

2022.4.2549

You can either upgrade when you are ready if you are running Octopus Server or if you are on our Octopus Cloud offering we can force an upgrade (if required) when it’s convenient for you, or you can wait until we upgrade you automatically in your maintenance window.

If you need further information on this please let me know.

Kind Regards,

Clare

Thanks Claire for the update. Really appreciate it.

I have done a workaround in the build I added a task to remove the ‘/’ with which my build worked.

Also, I will take the latest version as we are on Octopus server.

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.