File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -837,10 +837,20 @@ module MainModuleBuilder =
837837 v
838838
839839 let productVersionToILVersionInfo ( version : string ) : ILVersionInfo =
840- let parseOrZero v = match System.UInt16.TryParse v with ( true , i) -> i | ( false , _) -> 0 us
840+ let parseOrZero i ( v : string ) =
841+ let v =
842+ // When i = 3 then this is the 4th part of the version. The last part of the version can be trailed by any characters so we trim them off
843+ if i <> 3 then v
844+ else
845+ v |> Seq.fold( fun ( finished , v ) c -> match finished with
846+ | false when Char.IsDigit( c) -> false , v + c.ToString()
847+ | _ -> true , v) ( false , " " ) |> snd
848+ match System.UInt16.TryParse v with
849+ | ( true , i) -> i
850+ | ( false , _) -> 0 us
841851 let validParts =
842852 version.Split( '.' )
843- |> Seq.map parseOrZero
853+ |> Array.mapi ( fun i v -> parseOrZero i v )
844854 |> Seq.toList
845855 match validParts @ [ 0 us; 0 us; 0 us; 0 us] with
846856 | major :: minor :: build :: rev :: _ -> ILVersionInfo( major, minor, build, rev)
You can’t perform that action at this time.
0 commit comments