2016-12-20 11 views
4

最近、.NET Core Preview 4 SDKを搭載したVS 2017 RCをインストールしました。内蔵型.NETコアアプリケーションの公開

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

問題は、今、dotnet publish出力dll、ないexeファイル:新しいSDKで は、唯一csprojファイル、何project.jsonはありません。 dotnet publish -r win10-x64を実行しようとしましたが、コンパイルされません。

dotnet 1.1プレビューで自己完結型アプリケーションを作成するにはどうすればよいですか? csprojでセクションruntimeを指定する必要がありますか(jsonで必要だったようです)?

答えて

4

私はあなたが次の操作を行うことになっている、と信じて:

dotnet build -r win10-x64 
dotnet publish -c release -r win10-x64 

あなたが最初にそれを構築する必要があります。

もう1つのことは、.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> 

上記は、あなたが行っているコア/自己完結型機能を指定する適切な方法です。あなたはそれについて多くの情報を見つけることができますhere

+0

ビルドに失敗しました(win10-x64フラグが指定されていない - これは問題ありません) - nugetパッケージでは何も認識されません。 – pwas

+0

コンパイルすることができますが、運はありません。 'Microsoft(R)Build Engineバージョン15.1.458.808 Copyright(C)Microsoft Corporation。全著作権所有。 SquadPlanning-> C:\ Users \ patry \ Documents \ Visual Studio 2017 \ Projects \ SquadPlanning \ src \ SquadPlanning \ bin \ Debug \ netcoreapp1.0 \ SquadPlanning.dll'まだdll。 – pwas

+0

コマンドが使用されました。 'dotnet build -r win10-x64'と' dotnet publish -r win10-x64'です。 – pwas

関連する問題