在使用 VSCode 除錯單個測驗(而不是整個套件)的 MacOS 上會出現此問題。當我嘗試使用 vscode 除錯此測驗時,我得到以下輸出:
/usr/local/share/dotnet/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(4650,5): error MSB3883: Unexpected exception: [/Users/username/Documents/coding/CSharp/current_projects/Project-Name/Reusable/Reusable.csproj]
/usr/local/share/dotnet/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(4650,5): error : DirectoryNotFoundException: Could not find a part of the path '/Users/username/Documents/coding/CSharp/current_projects/Project-Name/Reusable/bin/Debug/net6.0/ref/Reusable.dll'. [/Users/username/Documents/coding/CSharp/current_projects/Project-Name/Reusable/Reusable.csproj]
/usr/local/share/dotnet/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(4650,5): error : at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter) [/Users/username/Documents/coding/CSharp/current_projects/Project-Name/Reusable/Reusable.csproj]
/usr/local/share/dotnet/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(4650,5): error : at Interop.CheckIo(Error error, String path, Boolean isDirectory, Func`2 errorRewriter) [/Users/username/Documents/coding/CSharp/current_projects/Project-Name/Reusable/Reusable.csproj]
/usr/local/share/dotnet/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(4650,5): error : at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode) [/Users/username/Documents/coding/CSharp/current_projects/Project-Name/Reusable/Reusable.csproj]
/usr/local/share/dotnet/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(4650,5): error : at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) [/Users/username/Documents/coding/CSharp/current_projects/Project-Name/Reusable/Reusable.csproj]
/usr/local/share/dotnet/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(4650,5): error : at System.IO.File.OpenHandle(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) [/Users/username/Documents/coding/CSharp/current_projects/Project-Name/Reusable/Reusable.csproj]
/usr/local/share/dotnet/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(4650,5): error : at System.IO.FileSystem.CopyFile(String sourceFullPath, String destFullPath, Boolean overwrite) [/Users/username/Documents/coding/CSharp/current_projects/Project-Name/Reusable/Reusable.csproj]
/usr/local/share/dotnet/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(4650,5): error : at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite) [/Users/username/Documents/coding/CSharp/current_projects/Project-Name/Reusable/Reusable.csproj]
/usr/local/share/dotnet/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(4650,5): error : at Microsoft.CodeAnalysis.BuildTasks.CopyRefAssembly.Copy() [/Users/username/Documents/coding/CSharp/current_projects/Project-Name/Reusable/Reusable.csproj]
/usr/local/share/dotnet/sdk/6.0.201/Microsoft.Common.CurrentVersion.targets(4650,5): error : [/Users/username/Documents/coding/CSharp/current_projects/Project-Name/Reusable/Reusable.csproj]
當然,這里的問題是/Users/username/Documents/coding/CSharp/current_projects/Project-Name/Reusable/bin/Debug/net6.0/ref不存在的,但它不是由構建系統生成的!為什么它認為 .dll 在 ref 中而不是在其正上方的檔案夾下?
這只發生在我嘗試在 VS 中除錯測驗時。看起來這是專案的問題......有誰知道可能出了什么問題?如果您需要更多資訊,請告訴我。如有必要,我可以包含專案檔案。
uj5u.com熱心網友回復:
我也遇到過這個。通過將其添加到我的專案檔案中找到了解決方法:
<PropertyGroup>
<ProduceReferenceAssemblyInOutDir>true</ProduceReferenceAssemblyInOutDir>
</PropertyGroup>
在這里發現了這個解決方法https://github.com/microsoft/vscode-azurefunctions/issues/3051
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/441918.html
