简体   繁体   English

Split Asp.Net Core Single Project App into multiple projects - 类型与xxx中导入的类型冲突 使用xxx中定义的类型

[英]Split Asp.Net Core Single Project App into multiple projects - The type conflicts with the imported type in xxx Using the type defined in xxx

I have been splitting my single project Asp.net Core app into different projects and I am seeing some strange errors and warnings and think maybe I have done it wrong.我一直在将我的单个项目 Asp.net 核心应用程序拆分为不同的项目,我看到一些奇怪的错误和警告,我想也许我做错了。 The main warning is that all through my files I have:主要警告是通过我的所有文件,我拥有:

The type 'VepoContext' in '/Users/benjaminfarquhar/dev/vepo_back_end/Vepo/Vepo.Data/VepoContext.cs' conflicts with the imported type 'VepoContext' in 'Vepo.Data, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. “/Users/benjaminfarquhar/dev/vepo_back_end/Vepo/Vepo.Data/VepoContext.cs”中的类型“VepoContext”与“Vepo.Data”中的导入类型“VepoContext”冲突,版本=0.0.0.0,文化=中性, PublicKeyToken=null'。 Using the type defined in '/Users/benjaminfarquhar/dev/vepo_back_end/Vepo/Vepo.Data/VepoContext.cs'.使用“/Users/benjaminfarquhar/dev/vepo_back_end/Vepo/Vepo.Data/VepoContext.cs”中定义的类型。 [Vepo, Vepo]csharp(CS0436) [Vepo, Vepo]csharp(CS0436)

On most of my custom Classes.在我的大多数自定义课程上。

I'm also getting:我也得到:

Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute [Vepo]重复的 'global::System.Runtime.Versioning.TargetFrameworkAttribute' 属性 [Vepo]

For which I have applied a few of the widely accepted Stack Overflow fixes, which have not worked.为此,我应用了一些被广泛接受的 Stack Overflow 修复程序,但这些修复程序没有奏效。

This is my project structure.这是我的项目结构。 The project named "Vepo" is the Asp.net Core app and the other projects, Vepo.Data, Vepo.Domain, and Vepo.Common are all Class Library projects.名为“Vepo”的项目是 Asp.net 核心应用程序,其他项目 Vepo.Data、Vepo.Domain 和 Vepo.Common 都是 Class 库项目。 I am wondering if I have placed my data, domain, and common projects inside the Asp.net Core project as it looks like that is the case in VS Code but not in Visual Studio:我想知道我是否已将我的数据、域和通用项目放在 Asp.net 核心项目中,因为在 VS Code 中是这种情况,但在 Visual Studio 中却不是:

In Visual Studio:在 Visual Studio 中: 在此处输入图像描述

In VS Code:在 VS 代码中:

在此处输入图像描述

Yes, you have placed your secondary projects inside the actual Vepo project.是的,您已将辅助项目放置在实际的 Vepo 项目中。 However, you also have the ones outside of the main project.但是,您也有主项目之外的那些。 Make sure to remove the ones inside the main since those are what are most likely causing you to get an error where two of the same types are loaded.确保删除 main 中的那些,因为它们最有可能导致您在加载两种相同类型时出现错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 类型“xxx”在未引用的程序集中定义 - The type 'xxx' is defined in an asembly that is not referenced 类型____与导入的类型冲突 - The type ____ conflicts with imported type 未定义类型“ xxx”,BC30002错误 - Type 'xxx' is not defined, BC30002 error ASP.NET不存在从对象类型XXX.Models.AccountRole到已知的托管提供程序本机类型(一对多关系)的映射 - ASP.NET No mapping exists from object type XXX.Models.AccountRole to a known managed provider native type, one to many relation .Net Core项目类型,用于与多个项目共享布局 - .Net Core project type used to share layout with multiple projects “directory\class.aspx.cs”中的类型“class”与“app”中导入的类型“class”冲突。 使用“directory\class.aspx.cs”中定义的类型 - The type 'class' in 'directory\class.aspx.cs' conflicts with the imported type 'class' in 'app'. Using type defined in 'directory\class.aspx.cs' 找不到 xxx 类型的构造函数 - Constructor on type xxx not found 无法从部件xxx加载类型xxx - Could not load type xxx from assembly xxx 为输入字段 asp.net mvc 输入不正确的数据类型时覆盖错误消息(值“xxx”对年龄无效) - override error message (The value 'xxx' is not valid for Age) when input incorrect data type for input field asp.net mvc 实体框架核心“实体类型‘XXX’需要定义一个主键。” - Entity Framework Core “The entity type 'XXX' requires a primary key to be defined.”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM