Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assembly versioning doesn't seem to work like C# #5052

Closed
NinoFloris opened this issue May 31, 2018 · 4 comments
Closed

Assembly versioning doesn't seem to work like C# #5052

NinoFloris opened this issue May 31, 2018 · 4 comments
Labels
Milestone

Comments

@NinoFloris
Copy link
Contributor

Currently working through getting 2.1 production builds up and seeing FSC giving errors like

FSC : warning FS2003: An System.Reflection.AssemblyInformationalVersionAttribute specified version '2.2.0-alpha.1', but this value is invalid and has been ignored

We supply this semantic version through MSBuild and expect it to be cleaned before it's put into the assembly attributes. Doesn't seem to happen here, C# projects have no troubles.

Our msbuild propertygroup helper

  <PropertyGroup>
  <!--
    Build full version from constituent parts
    This will be picked up by the SDK which will pull it apart again
    to form a valid file version, assembly version etc.
  -->
    <Version Condition=" '$(VersionSuffix)' != '' ">$(VersionPrefix)-$(VersionSuffix)</Version>
    <Version Condition=" '$(VersionBuildMetadata)' != '' ">$(VersionPrefix)+$(VersionBuildMetadata)</Version>
    <Version Condition=" '$(VersionSuffix)' != '' AND '$(VersionBuildMetadata)' != '' ">$(VersionPrefix)-$(VersionSuffix)+$(VersionBuildMetadata)</Version>
    <Version Condition=" '$(Version)' == '' ">$(VersionPrefix)</Version>
  </PropertyGroup>

Then we use it like this in a Directory.Build.props file

  <PropertyGroup>
    <VersionPrefix>2.2.0</VersionPrefix>
  </PropertyGroup>

Then in our docker container we invoke through
RUN dotnet publish -c Release --no-restore /p:VersionBuildMetadata="$ART_VERSION_META" /p:VersionSuffix="$ART_VERSION_LABEL" \ -o /output src/entrypointproject/entrypointproject.fsproj

Related: #4430

@matthid
Copy link
Contributor

matthid commented May 31, 2018

I think the difference is that the c# compiler doesn't warn on this particular attribute.

@NinoFloris
Copy link
Contributor Author

NinoFloris commented May 31, 2018

So I opened up both a C# and an F# assembly in dotPeek.

Both projects have set an AssemblyInformationalVersion [assembly: AssemblyInformationalVersion("2.2.0-alpha.1")]
So contrary to what the message leads you to expect it's actually not ignored.

Also the FSC warning in that case is not in line with what C# warns about as it seems they allow both assembly version format and semver in the informational version without warning.

@KevinRansom
Copy link
Member

Yes we validate AssemblyInformationalVersion, I have a bug to fix that.

@KevinRansom
Copy link
Member

@NinoFloris fix is here: #5336

@cartermp cartermp added this to the 16.0 milestone Jul 13, 2018
@cartermp cartermp modified the milestones: 16.0, 15.8 Jul 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants