构建发布版混合ASP.Net和.Net Standard 2.0项目的SGEN错误解决方
发布时间:2020-12-16 03:53:36 所属栏目:asp.Net 来源:网络整理
导读:我正在开发一个包含3个项目的Visual Studio 2017解决方案: .Net Standard 2.0中的两个类库(任何CPU) .Net Framework 4.6.1中的一个ASP.Net(任何CPU) 如果我在调试中构建所有(任何CPU),所有运行正常. 但是如果我在Release(任何CPU)中构建所有内容,则在输出窗
我正在开发一个包含3个项目的Visual Studio 2017解决方案:
.Net Standard 2.0中的两个类库(任何CPU) 如果我在调试中构建所有(任何CPU),所有运行正常.
怎么解决? 解决方法
该错误源于解析dll时NETStandard和NuGet库之间的混淆.把它放到你失败的项目的.csproj文件中(卸载项目,编辑.csproj文件):
<Target Name="ReplaceNetFxNetStandardRefWithLib" AfterTargets="ImplicitlyExpandNETStandardFacades"> <ItemGroup> <Reference Remove="@(_NETStandardLibraryNETFrameworkReference)" Condition="'%(FileName)' != 'netfx.force.conflicts'" /> <Reference Remove="@(_NETStandardLibraryNETFrameworkReference)" Condition="'%(FileName)' != 'System.Configuration.ConfigurationManager'" /> <Reference Include="@(_NETStandardLibraryNETFrameworkLib)"> <Private>true</Private> </Reference> </ItemGroup> </Target> <Target Name="RemoveNetFxForceConflicts" AfterTargets="ResolveAssemblyReferences"> <ItemGroup> <ReferencePath Remove="@(ReferencePath)" Condition="'%(FileName)' == 'netfx.force.conflicts'" /> <ReferencePath Remove="@(ReferencePath)" Condition="'%(FileName)' == 'System.Configuration.ConfigurationManager'" /> </ItemGroup> </Target> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net – ASP MVC外键提交问题
- 使用ASP.NET MVC进行Windows身份验证
- asp.net – 在表单提交时禁用按钮
- asp.net-mvc – Web路由如何工作?
- 如何从ASP.NET身份获取用户列表?
- asp.net-mvc-3 – 在MVC3中使用Page.User.Identity.Name
- asp.net-mvc – 使用List的奇怪剃刀行为
- asp.net-core – AspNetCore Abstractions无法加载
- asp.net – 如何在GridView中隐藏TemplateField列
- .net – 只有在配置中enableSessionState设置为true时才可以