-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Describe the bug
There is a difference in behaviour when building project with --version-suffix
switch locally and using dotnet/sdk image in docker.
I wanted to use --version-suffix
in our main project. I added VersionPrefix tag to main csproj and didn't add anything to other used (and referenced) projects in solution.
When I build locally (I have dotnet sdk 6.0 installed) with command
dotnet publish Service/Service.csproj -c Debug /consoleloggerparameters:ErrorsOnly --version-suffix 20220220-master-1 -r linux-x64 --self-contained false
all is build correctly.
But when the same command is executed inside docker there are errors (for some projects):
obj/Debug/netstandard2.0/SubProject.AssemblyInfo.cs(19,55): error CS7034: The specified version string does not conform to the required format - major[.minor[.build[.revision]]] [/app-src/Subproject/Subproject.csproj]
When I opened local file Subproject/obj/Debug/netstandard2.0/Subproject.AssemblyInfo.cs
I find what it is correct:
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Subproject")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0-20220220-master-1")]
[assembly: System.Reflection.AssemblyProductAttribute("Subproject")]
[assembly: System.Reflection.AssemblyTitleAttribute("Subproject")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
But when I cat
this file from docker builld I see:
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Subproject")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("20220220.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("20220220-master-1")]
[assembly: System.Reflection.AssemblyProductAttribute("Subproject")]
[assembly: System.Reflection.AssemblyTitleAttribute("Subproject")]
[assembly: System.Reflection.AssemblyVersionAttribute("20220220.0.0.0")]
The main project is netcoreapp3.1. Subproject is netstandard2.0.
To Reproduce
https://github.com/AOne-T/versioncheck
Exceptions (if any)
Further technical details
- Include the output of
dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.200
Commit: 4c30de7899
Runtime Environment:
OS Name: ubuntu
OS Version: 20.04
OS Platform: Linux
RID: ubuntu.20.04-x64
Base Path: /usr/share/dotnet/sdk/6.0.200/
Host (useful for support):
Version: 6.0.2
Commit: 839cdfb0ec
.NET SDKs installed:
3.1.416 [/usr/share/dotnet/sdk]
6.0.200 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.22 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.22 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
-
The IDE (VS / VS Code/ VS4Mac) you're running on, and its version
VS code 1.64.2 -
Docker version 20.10.12, build e91ed57
Activity
baronfel commentedon Feb 23, 2022
Can you provide a binlog of the build inside the container?
AOne-T commentedon Feb 24, 2022
Sure. Here it is: https://github.com/AOne-T/versioncheck/raw/master/version_suffix.binlog
AOne-T commentedon Jul 20, 2022
Figured it out finally myself. The problem was that Docker build used
ARG VERSION
which works line environment variable, sodotnet
used it implicitly for SubProject as a Version parameter replacing version (and ignoring--version-suffix
). When I changed toARG VERSION_SUFFIX
- all worked well