问题描述
我有一个包含多个项目的 Visual Studio 解决方案,特别是一个 DotNet5 asp.net 应用程序,上面有几个 netstandard 2.0 参考.它在调试器中构建和运行良好,但不断抛出元数据错误.它一直专门引用它在 netstandard2 项目中寻找 net5 文件夹.我找不到它从哪里得到这个,有问题的一个曾经是一个针对框架 4.7、4.8 和 net5.0 的多目标项目,但我对多个 dll 感到恼火,只是将它迁移到标准 2.0 并且没有问题,直到我想发布它.
I have a Visual studio solution with several projects in it, specifically a DotNet5 asp.net app, that has several netstandard 2.0 references on it. it builds and runs fine in the debugger but continuously throws the metadata errors. It keeps specifically referencing its looking for a net5 folder in the netstandard2 project. I cannot find where its getting this from, the problematic one used to be a multitargeted project against framework 4.7, 4.8, and net5.0, but i got annoyed with the multiple dll's and just migrated it to standard2.0 and had no issues till i want to publish it.
我已经尝试了其他一些引用的问题,清理,重建,删除和重新添加对其他项目的引用,从解决方案中删除了 obj 和 bin 文件夹,删除了 sou 文件,尝试了 VS 2019 (16.9.0 预览 2) 预览 vs 2019 (16.8.3) 版本,不同的计算机(从 lan git 存储库拉回)并得到相同的错误......还尝试搜索整个解决方案以获取对 net5.0 的引用,但没有不要在预期位置之外找到它,例如 asp.net 项目的 csproj 及其各自的 pubxml.只是为了好玩,我暂时将库项目重新定位回 net5.0,即使列出的确切文件和路径确实存在,它仍然抛出相同的错误.
I've tried what a few other questions referenced, cleaning, rebuilding, remove and re add references to other projects, deleted the obj and bin folders out of the solution, the removing the sou file, tried VS 2019 (16.9.0 preview 2) preview vs 2019 (16.8.3) release, different computer (pulled back down from a lan git repository) and got the same error.... also tried searching the entire solution for references to net5.0 and didn't find it outside of the expected locations like the csproj for the asp.net project and its respective pubxml. And just for fun, I temporarily retargeted the library project back to net5.0 and it still threw the same error even when the exact file and path listed did exist.
对错误消息中的不同列使用以下错误输入,并删除敏感"信息.Visual Studio 没有提供错误代码.还有其他人对尝试什么有更多想法吗?
Using enters for the error below for the different columns in the error message, and removed the "sensitive" info. There is no error code provided by Visual Studio. Anyone else got any more ideas on what to try?
错误
找不到元数据文件C:UsersUserNamesourceeposSolutionProject 2inReleaseet5.0efProject 2.dll".
Metadata file 'C:UsersUserNamesourceeposSolutionProject 2inReleaseet5.0efProject 2.dll' could not be found.
项目 1
CSC
0
添加错误消息的其他几个部分:
adding a couple other sections of the error messages:
1/2/2021 7:38:55 PM
System.AggregateException: One or more errors occurred. ---> Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.
--- End of inner exception stack trace ---
---> (Inner Exception #0) Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.<---
Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.
===================
并且输出窗口的结尾因为完整的东西有点太长了.仍然无法弄清楚它从哪里获得net5.0作为一个项目参考
And the end of the output window since full thing is a bit too long. still can't figure out where its getting the net5.0 for the one project reference
/reference:C:UsersUserName.nugetpackagessystem.xml.xpath.xmldocument4.0.1
ef
etstandard1.3System.Xml.XPath.XmlDocument.dll /reference:C:UsersUserName.nugetpackagesmysql.data8.0.22lib
et5.0Ubiety.Dns.Core.dll /reference:"C:UsersUserNamesource
eposCheckNotesProject 3inRelease
etstandard2.0Project 3.dll" /reference:"C:UsersUserNamesource
eposCheckNotesProject 2inRelease
et5.0
efProject 2.dll" /reference:C:UsersUserNamesource
eposCheckNotesProject 4inRelease
etstandard2.0Project 4.dll /reference:"C:Program FilesdotnetpacksMicrosoft.NETCore.App.Ref5.0.0
ef
et5.0WindowsBase.dll" /reference:C:UsersUserName.nugetpackagesmysql.data8.0.22lib
et5.0standard.Net.dll /debug+ /debug:portable /filealign:512 /optimize+ /out:"objRelease
et5.0CheckNotes Web - Core.dll" /refout:"objRelease
et5.0
efCheckNotes Web - Core.dll" /target:exe /warnaserror- /utf8output /deterministic+ /langversion:9.0 /analyzerconfig:"objRelease
et5.0CheckNotes Web - Core.GeneratedMSBuildEditorConfig.editorconfig" /analyzerconfig:"C:Program Filesdotnetsdk5.0.200-preview.20601.7SdksMicrosoft.NET.SdkanalyzersuildconfigAnalysisLevel_5_Default.editorconfig" /analyzer:"C:Program Filesdotnetsdk5.0.200-preview.20601.7SdksMicrosoft.NET.Sdk.WebanalyzerscsMicrosoft.AspNetCore.Analyzers.dll" /analyzer:"C:Program Filesdotnetsdk5.0.200-preview.20601.7SdksMicrosoft.NET.Sdk.WebanalyzerscsMicrosoft.AspNetCore.Mvc.Analyzers.dll" /analyzer:"C:Program Filesdotnetsdk5.0.200-preview.20601.7SdksMicrosoft.NET.Sdk.WebanalyzerscsMicrosoft.AspNetCore.Components.Analyzers.dll" /analyzer:"C:Program Filesdotnetsdk5.0.200-preview.20601.7SdksMicrosoft.NET.Sdk argets..analyzersMicrosoft.CodeAnalysis.CSharp.NetAnalyzers.dll" /analyzer:"C:Program Filesdotnetsdk5.0.200-preview.20601.7SdksMicrosoft.NET.Sdk argets..analyzersMicrosoft.CodeAnalysis.NetAnalyzers.dll" ControllersAssemblyController.cs ControllersCheckNotesController.cs ControllersContactsController.cs ControllersCustomerController.cs ControllersHomeController.cs ControllersImageController.cs ControllersOperatorPagesController.cs ControllersPalletsController.cs ControllersSharedController.cs ControllersStatisticsController.cs ModelsControllerClassctrlrAssembly.cs ModelsControllerClassCtrlrCheckNotes.cs ModelsControllerClassctrlrContacts.cs ModelsControllerClassCtrlrCustomer.cs ModelsControllerClassCtrlrOperatorPages.cs ModelsControllerClassCtrlrPallet.cs ModelsControllerClassctrlrStats.cs ModelsDataClassAppSettings.cs ModelsErrorViewModel.cs Models
enderAction.cs Program.cs Startup.cs "objRelease
et5.0.NETCoreApp,Version=v5.0.AssemblyAttributes.cs" "objRelease
et5.0CheckNotes Web - Core.AssemblyInfo.cs" "objRelease
et5.0CheckNotes Web - Core.RazorAssemblyInfo.cs" /warnaserror+:NU1605
CSC(0,0): Error CS0006: Metadata file 'C:UsersUserNamesource
eposCheckNotesProject 2inRelease
et5.0
efProject 2.dll' could not be found
10>Build failed. Check the Output window for more details.
========== Build: 9 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
推荐答案
准备发布但我很困惑....与发布配置文件有关.如果我删除它并生成一个新的,工作正常.一旦我使用 GUI 编辑它,就坏了....再次生成它.到目前为止,手动编辑它似乎没问题,但待定.不确定是否修复"无论是否重新启动 Visual Studio 都会存活下来.
Got it to publish but I am so confused....something to do with the publish profile. If i delete that and generate a new one, works fine. as soon as i edit it using the GUI, broken....generate it again. So far seems ok to edit it manually but TBD. not sure if the "fix" will survive restarting Visual studio or not.
编辑 - 从头开始,发现不同之处.删除 Properties/FolderProfile.pubxml 中的以下行就可以了.
Edit - Scratch that, found the difference.Remove the following line in Properties/FolderProfile.pubxml and it's fine.
这篇关于发布时无法找到 CSC 错误元数据文件 dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!