10000 Use of nested project structure causes CS0579 · Issue #14286 · dotnet/sdk · GitHub
[go: up one dir, main page]

Skip to content

Use of nested project structure causes CS0579 #14286

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

Closed
Yuri6037 opened this issue Oct 22, 2020 · 3 comments
Closed

Use of nested project structure causes CS0579 #14286

Yuri6037 opened this issue Oct 22, 2020 · 3 comments
Milestone

Comments

@Yuri6037
Copy link
Yuri6037 commented Oct 22, 2020

A lot of errors are generated when using a nested project structure.

MyProject
    MyProject.sln
    MySubProject
        MySubProject.csproj
        ....
    MyProject.csproj
    ....

Error log:

  .NETStandard,Version=v2.1.AssemblyAttributes.cs(4, 12): [CS0579] Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute
  X.AssemblyInfo.cs(13, 12): [CS0579] Duplicate 'System.Reflection.AssemblyCompanyAttribute' attribute
  X.AssemblyInfo.cs(14, 12): [CS0579] Duplicate 'System.Reflection.AssemblyConfigurationAttribute' attribute
  X.AssemblyInfo.cs(15, 12): [CS0579] Duplicate 'System.Reflection.AssemblyFileVersionAttribute' attribute
  X.AssemblyInfo.cs(16, 12): [CS0579] Duplicate 'System.Reflection.AssemblyInformationalVersionAttribute' attribute
  X.AssemblyInfo.cs(17, 12): [CS0579] Duplicate 'System.Reflection.AssemblyProductAttribute' attribute
  X.AssemblyInfo.cs(18, 12): [CS0579] Duplicate 'System.Reflection.AssemblyTitleAttribute' attribute
  X.AssemblyInfo.cs(19, 12): [CS0579] Duplicate 'System.Reflection.AssemblyVersionAttribute' attribute

No matter what I try nothing can fix it except adding all kinds of weird properties to EVERY project in the solution:

        <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
        <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
        <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
        <GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
        <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
        <GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
        <GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
        <GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
@marcpopMSFT marcpopMSFT added the untriaged Request triage from a team member label Oct 23, 2020
@wli3
Copy link
wli3 commented Oct 27, 2020

Could you give me a sample project? It is likely there is another project nested inside another project's folder structure.

@wli3 wli3 removed the untriaged Request triage from a team member label Oct 27, 2020
@wli3 wli3 added this to the Backlog milestone Oct 27, 2020
@wli3 wli3 removed their assignment Oct 27, 2020
@Yuri6037
Copy link
Author
Yuri6037 commented Oct 27, 2020

Could you give me a sample project? It is likely there is another project nested inside another project's folder structure.

Indeed it is a nested project structure.
One project is a class library with a special .targets file to ensure correct copy of native assets; the other is a unit test project.
However I recently refactored. I'll update the title in case it's actually the nested project that causes problems.

EDIT: As you indeed identified the problem is not RuntimeIdentifier. The problem is actually nested projects.

@Yuri6037 Yuri6037 changed the title Use of RuntimeIdentifier causes a whole lot of errors Use of nested project structure causes CS0579 Oct 27, 2020
@wli3 wli3 closed this as completed Oct 27, 2020
@wli3
Copy link
wli3 commented Oct 27, 2020

We don't support nested project structure by default. You can disable the dotnet core project default items. More detail here https://docs.microsoft.com/en-us/dotnet/core/tools/csproj#default-compilation-includes-in-net-core-projects

Viir added a commit to pine-vm/pine that referenced this issue Aug 10, 2021
…ibute'

`dotnet test` in `implement/test-elm-fullstack` sometimes failed with errors like these:

```
elm-fullstack\implement\test-elm-fullstack\obj\Debug\netcoreapp3.1\.NETCoreApp,Version=v3.1.AssemblyAttributes.cs(4,12): error CS0579: Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute [elm-fullstack\implement\test-elm-fullstack\test-elm-fullstack.csproj]
elm-fullstack\implement\test-elm-fullstack\obj\Debug\netcoreapp3.1\test-elm-fullstack.AssemblyInfo.cs(14,12): error CS0579: Duplicate 'System.Reflection.AssemblyCompanyAttribute' attribute [elm-fullstack\implement\test-elm-fullstack\test-elm-fullstack.csproj]
[...]
```

An alternative way to work around these errors is to remove garbage files in the repository automatically created by .net tooling.

For discussion of this issue, see also dotnet/sdk#12297 and dotnet/sdk#14286
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
0