asp.net核心将project.json迁移到csproj,现在我无法为linux / mac构建

时间:2017-03-05 21:13:58

标签: linux macos asp.net-core visual-studio-2017 asp.net-core-1.1

我已使用终端上的'Dotnet migrate'命令将project.json迁移到csproj。但是现在我无法再使用像'dotnet build -f osx.10.11-x64'之类的命令构建或发布我的osx或Linux应用程序,当我运行它时输出以下内容。我也不认为迁移工具创建的csproj会创建一个自包含的应用程序,这是我之前从project.json中删除'type = platform'。

C:\Program Files\dotnet\sdk\1.0.0-rc4-004771\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.TargetFrameworkInference.targets(84,5): error : Cannot infer TargetFrameworkIdentifier and/or TargetFrameworkVersion from TargetFramework='osx.10.11-x64'. They must be specified explicitly.

这是我的csproj文件,它是由migrate命令创建的。

    <Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
    <PreserveCompilationContext>true</PreserveCompilationContext>
    <AssemblyName>sample</AssemblyName>
    <OutputType>Exe</OutputType>
    <PackageId>Kosmele</PackageId>
    <RuntimeIdentifiers>osx.10.11-x64;ubuntu.16.04-x64</RuntimeIdentifiers>
    <RuntimeFrameworkVersion>1.0.3</RuntimeFrameworkVersion>
  </PropertyGroup>

  <ItemGroup>
    <Content Update="wwwroot\**\*;web.config">
      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
    </Content>
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.0.1" />
    <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.0.2" />
    <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.0.1" />
    <PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.0.1" />
    <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.0.1" />
    <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="1.0.1" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.0.1" />
    <PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="1.0.1" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.0.1" />
    <PackageReference Include="Serilog.Extensions.Logging.File" Version="1.0.0" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.0.1" />
  </ItemGroup>

</Project>

1 个答案:

答案 0 :(得分:0)

以下裸机RETURN文件(对于ASP.NET MVC项目)在OS X上为我工作。

.csproj