Release模式打包NuGet包后部分公共类无法访问问题
问题:Release模式打包NuGet包后无法访问所有公共类,Debug模式正常
使用dotnet pack -c Release命令创建NuGet包,在其他项目中引用时,仅能访问Unit类,无法访问其他公共类;但切换为Debug模式打包则可正常访问所有类。
项目文件内容
DTOs.cs
namespace AAUTOGateway.Models { public class Unit { } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v13.0.0.0))")] public enum ConfigurationAssetType { [System.Runtime.Serialization.EnumMember(Value = @"Asset")] Asset = 0, [System.Runtime.Serialization.EnumMember(Value = @"ContactPerson")] ContactPerson = 1, [System.Runtime.Serialization.EnumMember(Value = @"Credential")] Credential = 2, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v13.0.0.0))")] public class ConfigurationSchemaAttributeModel { [System.Text.Json.Serialization.JsonPropertyName("id")] public int Id { get; set; } [System.Text.Json.Serialization.JsonPropertyName("processId")] public int ProcessId { get; set; } [System.Text.Json.Serialization.JsonPropertyName("key")] public string Key { get; set; } [System.Text.Json.Serialization.JsonPropertyName("type")] [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] public ConfigurationAssetType Type { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v13.0.0.0))")] public class ConfigurationScopeAssetModel { [System.Text.Json.Serialization.JsonPropertyName("id")] public int Id { get; set; } [System.Text.Json.Serialization.JsonPropertyName("configurationScopeId")] public int ConfigurationScopeId { get; set; } [System.Text.Json.Serialization.JsonPropertyName("key")] public string Key { get; set; } [System.Text.Json.Serialization.JsonPropertyName("type")] [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] public ConfigurationAssetType Type { get; set; } [System.Text.Json.Serialization.JsonPropertyName("value")] public string Value { get; set; } } ... }
.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net6.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> </PropertyGroup> <PropertyGroup> <GeneratePackageOnBuild>True</GeneratePackageOnBuild> <Title>XXX</Title> <Description>XXX</Description> <VersionPrefix>0.0.1</VersionPrefix> <Company>XXX</Company> </PropertyGroup> </Project>
请问问题原因是什么,或是否有遗漏的配置?
内容的提问来源于stack exchange,提问作者Theodor349
相关产品推荐
相关产品推荐

