-
Notifications
You must be signed in to change notification settings - Fork 663
Closed
Description
Prerequisites
- I have written a descriptive issue title
- 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>
//------------------------------------------------------------------------------
#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;
{
[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";
}
}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