无法使用VS 2017的Csproj构建/运行多个框架

时间:2017-08-16 18:33:11

标签: visual-studio-2017 csproj

我正在使用JavaScript Services Angular基础架构来构建一个利用Entity Framework的Angular项目。我之前通过修改project.json文件生成了一个类似的项目,但项目设置现在在VS2017的csproj文件中设置。下面是基于Microsoft's recommendations的代码,用于将project.json文件调整为csproj:

<Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework> <-- Tried with and without ths line -->
    <TargetFrameworks>netcoreapp1.1;net452</TargetFrameworks>
    <RuntimeIdentifiers>win7-x64</RuntimeIdentifiers>
    <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
    <IsPackable>false</IsPackable>
  </PropertyGroup>
  <ItemGroup Condition="'$(TargetFramework)' == 'net452'">
    <PackageReference Include="EntityFramework" Version="6.1.3" />
    <PackageReference Include="Microsoft.CSharp" Version="1.0.0" />
  </ItemGroup>
  <ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp1.1'">
    <PackageReference Include="Microsoft.AspNetCore" Version="1.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="1.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.0" />
  </ItemGroup>
  <ItemGroup>
...

On Build我在项目中引用了几个文件时出现以下错误:

Error   CS0012  The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

删除<TargetFramework>标记后,未找到netcoreapp1.1引用。

0 个答案:

没有答案