简体   繁体   English

发布时找不到 CSC 错误元数据文件 dll

[英]Error Metadata file dll could not be found CSC when publishing

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.我有一个包含多个项目的 Visual Studio 解决方案,特别是一个 DotNet5 asp.net 应用程序,上面有几个 netstandard 2.0 引用。 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.它一直专门引用它在 netstandard2 项目中寻找 net5 文件夹。 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.我找不到它从哪里得到这个,有问题的一个曾经是一个针对框架 4.7、4.8 和 net5.0 的多目标项目,但我对多个 dll 感到恼火,只是将它迁移到 standard2.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.我已经尝试了引用的其他一些问题,清理,重建,删除和重新添加对其他项目的引用,从解决方案中删除了 obj 和 bin 文件夹,删除了 sou 文件,尝试了 VS 2019(16.9.0 预览 2 )预览与 2019(16.8.3)版本,不同的计算机(从 lan git 存储库拉回)并得到相同的错误....还尝试在整个解决方案中搜索对 net5.0 的引用但没有找到在预期位置之外,例如 asp.net 项目的 csproj 及其各自的 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.只是为了好玩,我暂时将库项目重新定位回 net5.0,即使列出的确切文件和路径确实存在,它仍然抛出相同的错误。

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. Visual Studio 没有提供错误代码。 Anyone else got any more ideas on what to try?还有其他人对尝试什么有更多想法吗?

Error错误

Metadata file 'C:\Users\UserName\source\repos\Solution\Project 2\bin\Release\net5.0\ref\Project 2.dll' could not be found.找不到元数据文件“C:\Users\UserName\source\repos\Solution\Project 2\bin\Release\net5.0\ref\Project 2.dll”。

Project 1项目一

CSC CSC

0 0

Edit: 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.

===================

And the end of the output window since full thing is a bit too long. output window 的结尾因为完整的东西有点太长了。 still can't figure out where its getting the net5.0 for the one project reference仍然无法弄清楚它在哪里获得 net5.0 作为一个项目参考

/reference:C:\Users\UserName\.nuget\packages\system.xml.xpath.xmldocument\4.0.1\ref\netstandard1.3\System.Xml.XPath.XmlDocument.dll /reference:C:\Users\UserName\.nuget\packages\mysql.data\8.0.22\lib\net5.0\Ubiety.Dns.Core.dll /reference:"C:\Users\UserName\source\repos\CheckNotes\Project 3\bin\Release\netstandard2.0\Project 3.dll" /reference:"C:\Users\UserName\source\repos\CheckNotes\Project 2\bin\Release\net5.0\ref\Project 2.dll" /reference:C:\Users\UserName\source\repos\CheckNotes\Project 4\bin\Release\netstandard2.0\Project 4.dll /reference:"C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\5.0.0\ref\net5.0\WindowsBase.dll" /reference:C:\Users\UserName\.nuget\packages\mysql.data\8.0.22\lib\net5.0\Zstandard.Net.dll /debug+ /debug:portable /filealign:512 /optimize+ /out:"obj\Release\net5.0\CheckNotes Web - Core.dll" /refout:"obj\Release\net5.0\ref\CheckNotes Web - Core.dll" /target:exe /warnaserror- /utf8output /deterministic+ /langversion:9.0 /analyzerconfig:"obj\Release\net5.0\CheckNotes Web - Core.GeneratedMSBuildEditorConfig.editorconfig" /analyzerconfig:"C:\Program Files\dotnet\sdk\5.0.200-preview.20601.7\Sdks\Microsoft.NET.Sdk\analyzers\build\config\AnalysisLevel_5_Default.editorconfig" /analyzer:"C:\Program Files\dotnet\sdk\5.0.200-preview.20601.7\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Analyzers.dll" /analyzer:"C:\Program Files\dotnet\sdk\5.0.200-preview.20601.7\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Mvc.Analyzers.dll" /analyzer:"C:\Program Files\dotnet\sdk\5.0.200-preview.20601.7\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Components.Analyzers.dll" /analyzer:"C:\Program Files\dotnet\sdk\5.0.200-preview.20601.7\Sdks\Microsoft.NET.Sdk\targets\..\analyzers\Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll" /analyzer:"C:\Program Files\dotnet\sdk\5.0.200-preview.20601.7\Sdks\Microsoft.NET.Sdk\targets\..\analyzers\Microsoft.CodeAnalysis.NetAnalyzers.dll" Controllers\AssemblyController.cs Controllers\CheckNotesController.cs Controllers\ContactsController.cs Controllers\CustomerController.cs Controllers\HomeController.cs Controllers\ImageController.cs Controllers\OperatorPagesController.cs Controllers\PalletsController.cs Controllers\SharedController.cs Controllers\StatisticsController.cs Models\ControllerClass\ctrlrAssembly.cs Models\ControllerClass\CtrlrCheckNotes.cs Models\ControllerClass\ctrlrContacts.cs Models\ControllerClass\CtrlrCustomer.cs Models\ControllerClass\CtrlrOperatorPages.cs Models\ControllerClass\CtrlrPallet.cs Models\ControllerClass\ctrlrStats.cs Models\DataClass\AppSettings.cs Models\ErrorViewModel.cs Models\renderAction.cs Program.cs Startup.cs "obj\Release\net5.0\.NETCoreApp,Version=v5.0.AssemblyAttributes.cs" "obj\Release\net5.0\CheckNotes Web - Core.AssemblyInfo.cs" "obj\Release\net5.0\CheckNotes Web - Core.RazorAssemblyInfo.cs" /warnaserror+:NU1605
CSC(0,0): Error CS0006: Metadata file 'C:\Users\UserName\source\repos\CheckNotes\Project 2\bin\Release\net5.0\ref\Project 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 ==========

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.一旦我使用 GUI 编辑它,就坏了....再次生成它。 So far seems ok to edit it manually but TBD.到目前为止似乎可以手动编辑它,但待定。 not sure if the "fix" will survive restarting Visual studio or not.不确定“修复”是否会在重新启动 Visual Studio 后继续存在。

Edit - Scratch that, found the difference.编辑 - 从头开始,发现不同之处。 Remove the following line in Properties/FolderProfile.pubxml and it's fine.删除 Properties/FolderProfile.pubxml 中的以下行就可以了。

<TargetFramework>net5.0</TargetFramework>

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

相关问题 找不到元数据文件的Facades CSC错误 - Metadata file facades dll could not be found CSC error CSC错误CS0006:找不到元数据文件&#39;... dll&#39; - 但文件存在 - CSC error CS0006: Metadata file '…dll' could not be found - But file exists 找不到元数据文件.dll - Metadata file .dll could not be found 找不到元数据文件“.dll” - Metadata file '.dll' could not be found &#39;CSC:CSC(0,0):错误CS2001:找不到源文件[file]。&#39; 在运行门禁签入(C#)时 - 'CSC:CSC(0,0): Error CS2001: Source file [file] could not be found.' when running a gated check in (C#) LINQ无法找到元数据文件“.dll” - Metadata file '.dll' could not be found with LINQ 找不到元数据文件 System.dll - Metadata file System.dll could not be found vs 2015 Error CS0006 Metadata file.dll'找不到 - vs 2015 Error CS0006 Metadata file .dll' could not be found 使用CSharpCodeProvider引用项目时找不到元数据文件&#39;Domain.dll&#39; - Metadata file 'Domain.dll' could not be found when using CSharpCodeProvider referencing project 错误 CS0006 元数据文件; 找不到fileuploadcontrol.dll&#39; - error CS0006 metadata file; fileuploadcontrol.dll'could not be found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM