You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched issues to ensure it has not already been reported
GitVersion package
GitVersion.MsBuild
GitVersion version
v6.0.0
Operating system
Windows
What are you seeing?
When setting <UseProjectNamespaceForGitVersionInformation>true</UseProjectNamespaceForGitVersionInformation> in the project file, I get the following build error in line 28 in GitVersionInformation.g.cs:
error CS1022: Type or namespace definition, or end-of-file expected
This is because, in the generated code, the namespace declaration for the GitVersionInformation class has a semicolon appended:
//------------------------------------------------------------------------------// <auto-generated>// This code was generated by a tool.// GitVersion//// Changes to this file may cause incorrect behavior and will be lost if// the code is regenerated.// </auto-generated>//------------------------------------------------------------------------------
#ifNET20||NET35||NETCOREAPP1_0||NETCOREAPP1_1||NETSTANDARD1_0||NETSTANDARD1_1||NETSTANDARD1_2||NETSTANDARD1_3||NETSTANDARD1_4||NETSTANDARD1_5||NETSTANDARD1_6namespace System.Diagnostics.CodeAnalysis
{[global::System.AttributeUsage(global::System.AttributeTargets.Assembly |global::System.AttributeTargets.Class |global::System.AttributeTargets.Struct |global::System.AttributeTargets.Constructor |global::System.AttributeTargets.Method |global::System.AttributeTargets.Property |global::System.AttributeTargets.Event, Inherited =false, AllowMultiple =false)]internalsealedclassExcludeFromCodeCoverageAttribute:global::System.Attribute {}}
#endif
namespace My.Project.Namespace;{[global::System.Runtime.CompilerServices.CompilerGenerated][global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]staticclassGitVersionInformation{publicconststringAssemblySemFileVer="3.2.5.0";publicconststringAssemblySemVer="3.2.5.0";publicconststringBranchName="my-branch-name";publicconststringBuildMetaData="";publicconststringCommitDate="2024-09-03";publicconststringCommitsSinceVersionSource="20";publicconststringEscapedBranchName="my-branch-name";publicconststringFullBuildMetaData="Branch.my-branch-name.Sha.ee208cbc6d6dcc5869c29142801a3cc0ef290400";publicconststringFullSemVer="3.2.5-issue16.20";publicconststringInformationalVersion="3.2.5-issue16.20+Branch.my-branch-name.Sha.ee208cbc6d6dcc5869c29142801a3cc0ef290400";publicconststringMajor="3";publicconststringMajorMinorPatch="3.2.5";publicconststringMinor="2";publicconststringPatch="5";publicconststringPreReleaseLabel="issue16";publicconststringPreReleaseLabelWithDash="-issue16";publicconststringPreReleaseNumber="20";publicconststringPreReleaseTag="issue16.20";publicconststringPreReleaseTagWithDash="-issue16.20";publicconststringSemVer="3.2.5-issue16.20";publicconststringSha="ee208cbc6d6dcc5869c29142801a3cc0ef290400";publicconststringShortSha="ee208cb";publicconststringUncommittedChanges="0";publicconststringVersionSourceSha="bcd15e4babf9b0c9818e5a64bbd7b94041785602";publicconststringWeightedPreReleaseNumber="30020";}}
What is expected?
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// GitVersion
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#if NET20 || NET35 || NETCOREAPP1_0 || NETCOREAPP1_1 || NETSTANDARD1_0 || NETSTANDARD1_1 || NETSTANDARD1_2 || NETSTANDARD1_3 || NETSTANDARD1_4 || NETSTANDARD1_5 || NETSTANDARD1_6
namespace System.Diagnostics.CodeAnalysis
{
[global::System.AttributeUsage(
global::System.AttributeTargets.Assembly |
global::System.AttributeTargets.Class |
global::System.AttributeTargets.Struct |
global::System.AttributeTargets.Constructor |
global::System.AttributeTargets.Method |
global::System.AttributeTargets.Property |
global::System.AttributeTargets.Event,
Inherited = false, AllowMultiple = false)]
internal sealed class ExcludeFromCodeCoverageAttribute : global::System.Attribute { }
}
#endif-namespace My.Project.Namespace;+namespace My.Project.Namespace
{
[global::System.Runtime.CompilerServices.CompilerGenerated]
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
static class GitVersionInformation
{
public const string AssemblySemFileVer = "3.2.5.0";
public const string AssemblySemVer = "3.2.5.0";
public const string BranchName = "my-branch-name";
public const string BuildMetaData = "";
public const string CommitDate = "2024-09-03";
public const string CommitsSinceVersionSource = "20";
public const string EscapedBranchName = "my-branch-name";
public const string FullBuildMetaData = "Branch.my-branch-name.Sha.ee208cbc6d6dcc5869c29142801a3cc0ef290400";
public const string FullSemVer = "3.2.5-issue16.20";
public const string InformationalVersion = "3.2.5-issue16.20+Branch.my-branch-name.Sha.ee208cbc6d6dcc5869c29142801a3cc0ef290400";
public const string Major = "3";
public const string MajorMinorPatch = "3.2.5";
public const string Minor = "2";
public const string Patch = "5";
public const string PreReleaseLabel = "issue16";
public const string PreReleaseLabelWithDash = "-issue16";
public const string PreReleaseNumber = "20";
public const string PreReleaseTag = "issue16.20";
public const string PreReleaseTagWithDash = "-issue16.20";
public const string SemVer = "3.2.5-issue16.20";
public const string Sha = "ee208cbc6d6dcc5869c29142801a3cc0ef290400";
public const string ShortSha = "ee208cb";
public const string UncommittedChanges = "0";
public const string VersionSourceSha = "bcd15e4babf9b0c9818e5a64bbd7b94041785602";
public const string WeightedPreReleaseNumber = "30020";
}
}
Steps to Reproduce
Enable <UseProjectNamespaceForGitVersionInformation>true</UseProjectNamespaceForGitVersionInformation> in your project file.
RepositoryFixture Test
No response
Output log or link to your CI build (if appropriate).
No response
The text was updated successfully, but these errors were encountered:
@arturcic This wont work because of the optional declaration of ExcludeFromCodeCoverageAttribute, since there can only be a single file-scoped namespace declaration in a source file.
Prerequisites
GitVersion package
GitVersion.MsBuild
GitVersion version
v6.0.0
Operating system
Windows
What are you seeing?
When setting
<UseProjectNamespaceForGitVersionInformation>true</UseProjectNamespaceForGitVersionInformation>
in the project file, I get the following build error in line 28 in GitVersionInformation.g.cs:This is because, in the generated code, the namespace declaration for the GitVersionInformation class has a semicolon appended:
What is expected?
Steps to Reproduce
Enable
<UseProjectNamespaceForGitVersionInformation>true</UseProjectNamespaceForGitVersionInformation>
in your project file.RepositoryFixture Test
No response
Output log or link to your CI build (if appropriate).
No response
The text was updated successfully, but these errors were encountered: