Asp.net core 发布自包含的app.NET核心应用程序

Asp.net core 发布自包含的app.NET核心应用程序,asp.net-core,.net-core,Asp.net Core,.net Core,最近,我用.NET Core Preview 4 SDK安装了VS 2017 RC。 在新SDK中,没有project.json,只有csproj文件: <PropertyGroup> <OutputType>winexe</OutputType> <TargetFramework>netcoreapp1.0</TargetFramework> <PreserveCompilationContext>t

最近,我用.NET Core Preview 4 SDK安装了VS 2017 RC。 在新SDK中,没有
project.json
,只有
csproj
文件:

<PropertyGroup>
   <OutputType>winexe</OutputType>
   <TargetFramework>netcoreapp1.0</TargetFramework>
     <PreserveCompilationContext>true</PreserveCompilationContext>
</PropertyGroup

温克斯
netcoreapp1.0
真的

我相信,你应该做到以下几点:

dotnet build -r win10-x64
dotnet publish -c release -r win10-x64
您需要首先构建它

要指出的另一点是,.csproj和project.json函数几乎相同。因此,应配置.csproj:

<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp1.0</TargetFramework>
    <VersionPrefix>1.0.0</VersionPrefix>
    <DebugType>Portable</DebugType>
    <RuntimeIdentifiers>win10-x64;osx.10.11-x64</RuntimeIdentifiers>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="**\*.cs" />
    <EmbeddedResource Include="**\*.resx" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.NETCore.App">
      <Version>1.0.1</Version>
    </PackageReference>
    <PackageReference Include="Newtonsoft.Json">
      <Version>9.0.1</Version>
    </PackageReference>
    <PackageReference Include="Microsoft.NET.Sdk">
      <Version>1.0.0-alpha-20161102-2</Version>
      <PrivateAssets>All</PrivateAssets>
    </PackageReference>
  </ItemGroup>

  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

Exe
netcoreapp1.0
1.0.0
便携式
win10-x64;osx.10.11-x64
1.0.1
9.0.1
1.0.0-alpha-20161102-2
全部的

以上是指定您所追求的核心/自包含功能的正确方法。您可以找到有关它的许多信息。

生成失败(指定了win10-x64标志,没有-确定)-无法识别nuget软件包上的任何内容。已成功编译,但运气不佳:
Microsoft(R)Build Engine版本15.1.458.808版权所有(C)Microsoft Corporation。版权所有。SquadPlanning->C:\Users\patry\Documents\Visual Studio 2017\Projects\SquadPlanning\src\SquadPlanning\bin\Debug\netcoreapp1.0\SquadPlanning.dll
Still dll。使用的命令有:
dotnet build-r win10-x64
和`dotnet publish-r win10-x64`.@pwas你看了我链接的站点吗?是的。但是Docs讲述了.NETCorePreview3,问题发生在Preview4上。以下是我在github上创建的问题: