jetbrains-rider 相关问题


如何使用 Rider IDE 将身份脚手架添加到 ASP.NET CORE 应用程序

我正在观看有关 ASP.NET CORE Identity 的教程,其中讲师通过使用 Visual Studio 搭建脚手架来添加身份,但现在我正在使用 Rider IDE,但我没有看到这样的选项,。 ..


使用 ASP.NET Core 和 TailwindCSS 进行热重载(或者:向 dotnet watch 添加额外的命令)

我正在研究将 TailwindCSS 与 ASP.NET 结合使用的良好热重载工作流程。 我决定使用 VSCode,因为 VisualStudio 没有良好的顺风扩展,而 Rider 的扩展也不支持...


为什么springinitializr让项目继承spring-boot-starter-parent而不是使用spring-boot-dependency

当使用 spring initalizr 创建项目时,pom.xml 继承自 spring-boot-starter-parent: 当使用 spring initalizr 创建项目时,pom.xml继承自spring-boot-starter-parent: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>3.1.3</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.example</groupId> <artifactId>demo</artifactId> <version>0.0.1-SNAPSHOT</version> <name>demo</name> 与在spring-boot-dependencies中指定<dependencyManagement/>相比,这似乎不太灵活,因为如果我们需要使用生成的结构作为多模块项目的子模块,或者使用公司范围的父模块,我们需要将BOM移动到提到的部分: <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>${spring-boot.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> 使用 spring-boot-starter-parent 作为父级而不是在创建时立即声明 <dependencyManagement/> 部分是否有任何具体原因? 有人投票决定关闭问题,坚称这是基于意见的,但事实并非如此。 插件配置的存在(顺便说一句,乍一看这些配置的目的是为了修复maven插件的一些“小故障”,但是,其中一些配置不再需要了,例如:https://github.com/maven-plugin)。 com/JetBrains/kotlin/pull/1501)并不是以下之间的唯一区别: <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>3.1.3</version> <relativePath/> <!-- lookup parent from repository --> </parent> 和 <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>${spring-boot.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> 在第一种情况下,maven 项目通过父子关系继承 dependencyManagement,因此,由于 spring-boot 团队通过 properties 部分定义依赖项版本,子项目也可以通过 properties 部分覆盖依赖项版本,例如如果我们的目标是更改 spring-framework 的版本而不更改 spring-boot 的版本,我们可以定义如下内容: <properties> <spring-framework.version>6.0.15</spring-framework.version> </properties> 这显然在第二个配置的情况下不起作用 - maven 只是从 independentBoM 导入 dependencyManagement 部分。 尚不清楚哪种方法“更灵活”(我们更愿意同时避开这两种方法),但是它们与依赖管理的角度也不同。


如何在C#中正确导入不同项目的Proto文件?

我的解决方案中有 2 个项目 /Common/Common.csproj /数据/Data.csproj 我的 Data.csproj 中有一个 Proto 文件: 我的解决方案中有 2 个项目 /通用/Common.csproj /数据/Data.csproj 我的 Data.csproj 中有一个 Proto 文件: <Protobuf Include=".\Protos\UserService.proto" GrpcServices="Server" /> 看起来像这样: service UserService { rpc AddUser (UserRequest) returns (SimpleResponse); } .... 现在应该从 Common 导入 SimpleReponse,所以我在这个项目中的路径 /Common/Protos/common.proto 中创建了一个 common.proto,我想导入它: 导入“common.proto”; 服务用户服务{ rpc AddUser(UserRequest) 返回(SimpleResponse); } .... 然后 Rider 显示 SimpleResponse 仍为红色,以及 common.proto 导入。当我快捷键 Space + .它会向我显示我所做的“添加到原始导入”。 因此,在全局设置中,路径现在已正确设置 - 原型和响应不再是红色,我可以按 F12 来查看它们。当我现在尝试构建时,我仍然收到错误: 我尝试在csproj中添加路径 <Protobuf Include="..\Common\Protos\common.proto" Link="..\Common\Protos\common.proto" /> 但仍然是同样的错误。 有什么想法吗? 从不同项目导入原始文件非常棘手,我发现这个解决方案非常费力。所以我想与社区分享 我正在使用微服务架构,我希望我的消息 ProtoFiles 应该在 SharedProto 项目中并在不同的项目中使用它们 假设我在 SharedProto 中有消息 Proto 文件 SharedProto --Protos ----company_dto.proto ----branch_dto.proto ---- ... company_dto.proto的内容 syntax = "proto3"; option csharp_namespace = "SharedProto.Protos"; package sharedproto.protos; // *** DTO message CompanyDto { int32 Id = 1; string Code = 2; string Name = 3; string Logo = 4; string Website = 5; } SharedProto.csproj 的内容 .... <ItemGroup> <Protobuf Include="Protos\company_dto.proto" GrpcServices="None"> <Protobuf Include="Protos\branch_dto.proto" GrpcServices="None"> </ItemGroup> .... 我拥有服务原型的项目组织 Organization ... --Protos ----company_rpc.proto ----branch_rpc.proto ... 我想将 comapany_dto.proto(属于 SharedProto 项目的一部分)导入到 comapany_rpc.proto(属于 Organization 项目的一部分)。让我们看看 .csproj 文件,因为所有的技巧都在这里: 组织.csproj的内容 <ItemGroup> <ProjectReference Include="..\SharedProto\SharedProto.csproj"> <GlobalPropertiesToRemove></GlobalPropertiesToRemove> </ProjectReference> </ItemGroup> <ItemGroup> <!-- DTOs --> <Protobuf Include="..\SharedProto\Protos\company_dto.proto" ProtoRoot=".." GrpcServices="None" Link="Protos\company_dto.proto" /> <Protobuf Include="Protos\company_rpc.proto" AdditionalImportDirs="../SharedProto" GrpcServices="Server" /> </ItemGroup> 如果您看到上面的 Organzation.csproj 文件,那么您需要了解一些非常重要的要点,以避免 file not found error 从其他项目导入 proto 文件。 ProtoRoot=".." 和 Link="Protos\company_dto.proto" 之后,将此 AdditionalImportDirs="../SharedProto" 添加到要导入文件的 <Protobuf Include=.... 上。但是,在这些设置之后,您可以在其他项目中导入 SharedProto 文件,在我的例子中它是组织项目。看看吧 company_rpc.proto内容 syntax = "proto3"; import "google/protobuf/empty.proto"; import "Protos/company_dto.proto"; package organization.companyrpc; // *** Rpc-Service service CompanyRpcService { // Retrieve All rpc GetAllCompanies (google.protobuf.Empty) returns (GetCompanyListResponse){ } .... } // Response: Retrieve All message GetCompanyListResponse { repeated sharedproto.protos.CompanyDto DtoRows = 1; string Message = 2; } 如果您看到我的company_rpc.proto文件,您就会了解我如何导入它(import "Protos/company_dto.proto";)以及我如何使用它(sharedproto.protos.CompanyDto DtoRows) 记住这个sharedproto.protos来自company_dto.proto文件中的包名称 上述设置适用于我的 .net core grpc 2.60.0 和 .net core 8


© www.soinside.com 2019 - 2024. All rights reserved.