Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

CS0433 The type 'type' exists in 'ProjectA' and 'ProjectB'

$
0
0

I have a solution made with .NET Framework 4.7 (c#) in which we have 2 projects that contain the same partial class within the same namespace, those projects are packaged on a nupkg.

From now on we will follow the following logic:

  • Project A: has a part of the partial class and reference to Project B
  • Project B: has another part of the partial class (code generated automatically)
  • Project C: this project has the nupkg referenced but if we try to call any property of the mentioned class when compiling, it gives the following error:CS0433 The type 'Config' exists in 'ProjectA, Version=1.2023.2.21, Culture=neutral, PublicKeyToken=null' and in 'ProjectB, Version=1.2023.2.21, Culture=neutral, PublicKeyToken=null'

I've already tried:

  • Cleaning and rebuilding.
  • Deleting and adding again the references.
  • Removing redundant and useless references.
  • Uninstalling the NuGet from Project C and installing it again.

Here are the conflicting code snippets in each project:

Project A: partial class Config

namespace WhatIsWrong{    using System;    using System.Collections.Generic;    using System.ComponentModel.DataAnnotations;    public partial class Config    {    }}

Project B: partial class Config

namespace WhatIsWrong{    using System;    using System.Collections.Generic;    public partial class Config    {        public string parameter { get; set; }        public string value { get; set; }    }}

Project C

public DbSet<WhatIsWrong.Config> Config { get; set; }

Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>