我正在尝试从.prop文件中获取共享属性like in this tutorial,但正在运行
msbuild propsTests2.sln
给出错误:
C:\...\propsTests2.csproj(8,58):
error MSB4066: The attribute "Version" in element <PackageReference> is unrecognized.
我的档案:
的.csproj
<Project Sdk="Microsoft.NET.Sdk" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project=".\common.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="$(AspNetCoreVersion)" />
</ItemGroup>
</Project>
common.props
<?xml version="1.0" encoding="utf-8" ?>
<Project>
<PropertyGroup>
<AspNetCoreVersion>2.0.0</AspNetCoreVersion>
</PropertyGroup>
</Project>
文件common.props与.csproj文件位于同一目录中。
我正在使用VS2017。