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

ThisAssembly from Nerbank.GitVersioning conflicts with ThisAssembly from "ThisAssembly" #838

Closed
nathanwinder opened this issue Oct 7, 2022 · 3 comments

Comments

@nathanwinder
Copy link

Issue Report to "ThisAssembly"

devlooped/ThisAssembly#124

Describe the Bug

ThisAssembly conflicts with the "ThisAssembly" generated by Nerdbank.GitVersioning
https://github.com/dotnet/Nerdbank.GitVersioning

Steps to Reproduce

  1. Reference both Nerdbank.GitVersioning and ThisAssembly.Project
<PackageReference Include="ThisAssembly.Project" Version="1.0.9" Condition="!Exists('packages.config')"/>
<PackageReference Include="Nerdbank.GitVersioning" Condition="!Exists('packages.config')">
  <PrivateAssets>all</PrivateAssets>
  <Version>3.5.113</Version>
</PackageReference>
public class ReproTest
{
  [Fact]
  public void Repro()
  {
    var fileVersion = ThisAssembly.AssemblyFileVersion; // 'ThisAssembly' does not contain a definition for 'AssemblyName'
  }
}

Expected Behavior

ThisAssembly.Project should not prevent Nerbbank.GitVersioning from creating ThisAssembly properties.

@nathanwinder
Copy link
Author

Did some more research into this and it has something to do with "Directory.Build.props". I have them in nested directories and GitVersioning stopped working. I removed the props in the descendant directory but GitVersioning has stopped working.

-Folder
--Directory.Build.props

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <PackageReference Include="Nerdbank.GitVersioning" Condition="!Exists('packages.config')">
      <PrivateAssets>all</PrivateAssets>
      <Version>3.5.113</Version>
    </PackageReference>
  </ItemGroup>
</Project>

-- SubFolder
---Directory.Build.props

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
   <PackageReference Include="ThisAssembly.Project" Version="1.0.9" Condition="!Exists('packages.config')"/>
  </ItemGroup>
</Project>

---My.sln

GitVersioning stopped working, the package reference was no longer propagating even if I removed the props in the descendant folder. Both will work together if directly referenced from the project.

@AArnott
Copy link
Collaborator

AArnott commented Oct 8, 2022

Nerdbank.GitVersioning generates ThisAssembly the same regardless of how/where you reference nb.gv.
To get along with another ThisAssembly generator, what would it take? Can you include details of the conflict? I see we already use the partial modifier or the class declaration, so I don't know what else we could do. If the properties themselves conflict, maybe you're using two packages that are too similar to be combined in one project.

@alexrp
Copy link
Contributor

alexrp commented Apr 10, 2023

I suppose this can be closed as of #911?

@AArnott AArnott closed this as completed Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants