我当前正在尝试构建C#项目,但是MSBuild失败并显示:
C:\Program Files\dotnet\sdk\2.1.401\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.props(33,11): error MSB4226: The imported project "C:\Program Files\MSBuild\15.0\Microsoft.Common.props" was not found. Also, tried to find "15.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\Mono\lib\mono\msbuild\15.0\bin\MSBuild.d
ll.config". Confirm that the path in the <Import> declaration is correct, and that the file exists on disk in one of the search paths.
我的.csproj
如下:
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
<AssemblyName>MyProj</AssemblyName>
<PackageId>MyProj</PackageId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>
</Project>
答案 0 :(得分:0)
使用CentOS中安装的Visual代码时,我遇到了类似的问题。我尝试了一切,但问题没有解决。我所做的只是找到我的dotnet sdk path
,然后尝试在文件夹中找到“ Microsoft.Common.Props” 。在我的情况下,sdK文件夹为:
/usr/share/dotnet/sdk
令人惊讶的是,我在/usr/share/dotnet/sdk/2.2.203/Current
文件夹中找到了该文件,而不是/usr/share/dotnet/sdk//2.2.203/15.0/。因此,我所做的只是将文件复制并粘贴到/ usr/share/dotnet/sdk//2.2.203/15.0/
位置,问题立即消失了!