更新到 VS 2022 后无法构建

Cannot build after updating to VS 2022

今天早上用VS2019建了一个项目。决定升级到 VS2022,现在构建失败。

通过 VS 构建时出现错误:

The type or namespace name 'WindowsAzure' does not exist in the namespace 'Microsoft'

通过终端构建时,我得到了一个更详细的错误。

首先是这个警告

C:\Program Files\dotnet\sdk.0.100\Microsoft.Common.CurrentVersion.targets(2304,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.WindowsAzure.Storage". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

然后同样的错误。

如前所述。唯一改变的是 Visual Studio.

的版本

我也遇到了第二个错误。

error MSB4019: The imported project "C:\Program Files\dotnet\sdk.0.100\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk.0.100\Microsoft\VisualStudio\v17.0\WebApplications\Microsoft.WebApplication.targets" is correct, and that the file exists on disk.

通过删除解决方案中的所有 obj 和 bin 文件夹。该解决方案能够再次构建。