如何在没有 Visual Studio 的情况下使用 PVS-Studio 运行 .NET Core 项目?

How to run .NET Core project with PVS-Studio without Visual Studio?

我有 PVS-Studiofree license 并且我将该程序安装到 Windows 10 台计算机上没有问题。我通过 Standalone.exe 提供了注册信息,注册成功了。此计算机未安装 Visual Studio(仅 Dotnet 核心 SDK 和 Visual Studio 代码)

当我尝试运行 dotnet 核心项目时

PVS-Studio_Cmd.exe -t C:\Users\someuser\projects\myproject.csproj

我收到以下错误

PVS-Studio Command Line Analyzer 7.0.29703.1460 Copyright (c) 2008-2019 OOO "Program Verification Systems" Using default settings file: C:\Users\someuser\AppData\Roaming\PVS-Studio\Settings.xml Exception message: The imported project "C:\Windows\Microsoft.NET\Framework64.0\Microsoft.Common.props" was not found. Also, tried to find ".0\Microsoft.Common.props" in the fallback search path(s) for $(MSBuildExtensionsPath) - "C:\Program Files (x86)\MSBuild" . These search paths are defined in "c:\Program Files (x86)\PVS-Studio\PVS-Studio_Cmd.exe.Config". Confirm that the path in the declaration is correct, and that the file exists on disk in one of the search paths. C:\Program Files\dotnet\sdk.1.301\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.props

那么我该如何解决这个问题?

可以使用 dotnet build 命令正确构建项目。

此问题将在即将发布的 PVS-Studio 7.02 版本中得到解决,该版本还将添加对 Visual Studio 2019 的支持。现在无需安装即可分析 .NET Core 项目 Visual Studio.