2016-11-04 13 views
6

私はVisual Studio 14(VS 2015)Update 3を使用しており、Kestrelをサーバーとして使用してREST APIベースの.Net Core 1を構築したいと考えています。.NET Core .csproj出力パスが正常に動作しない

私は他のプロジェクトでそうであるようにMSBuildのを使用するために、代わりに .xproj古い.csprojを使用できるようにしたいです。これを行うには、tutorial they haveを使用しました。

"OutputPath"を "bin \ Debug"(たとえばデバッグモード用)として定義すると、Visual Studioはプロジェクトをビルドし、ビルドの結果を "bin \ Debug \\ bin \ Debug \ netcoreapp1 .0 \ win7-x64 "となります。

.xprojを使用してビルドすると、結果は "bin \ Debug \ netcoreapp1.0"に格納されます。これは予想される動作です。

何が起こっていますか?

.csproj:

<?xml version="1.0" encoding="utf-8"?> 
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
    <PropertyGroup> 
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> 
    <BaseNuGetRuntimeIdentifier>win7</BaseNuGetRuntimeIdentifier> 
    <TargetFrameworkIdentifier>.NETCoreApp</TargetFrameworkIdentifier> 
    <TargetFrameworkVersion>v1.0</TargetFrameworkVersion> 
    <NoStdLib>true</NoStdLib> 
    <NoWarn>$(NoWarn);1701</NoWarn> 
    <ProjectGuid>{D21ABA46-65F9-4B47-882C-F9C0765052DD}</ProjectGuid> 
    <OutputType>Exe</OutputType> 
    <AppDesignerFolder>Properties</AppDesignerFolder> 
    <RootNamespace>MyAPP</RootNamespace> 
    <AssemblyName>MyAPP</AssemblyName> 
    <FileAlignment>512</FileAlignment> 
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> 
    </PropertyGroup> 
    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> 
    <PlatformTarget>x64</PlatformTarget> 
    <DebugSymbols>true</DebugSymbols> 
    <DebugType>full</DebugType> 
    <Optimize>false</Optimize> 
    <IntermediateOutputPath>.\obj\Debug</IntermediateOutputPath> 
    <OutputPath>.\bin\Debug\</OutputPath> 
    <DefineConstants>DEBUG;TRACE</DefineConstants> 
    <ErrorReport>prompt</ErrorReport> 
    <WarningLevel>4</WarningLevel> 
    </PropertyGroup> 
    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 
    <PlatformTarget>x64</PlatformTarget> 
    <DebugType>pdbonly</DebugType> 
    <Optimize>true</Optimize> 
    <OutputPath>.\bin\Release</OutputPath> 
    <DefineConstants>TRACE</DefineConstants> 
    <ErrorReport>prompt</ErrorReport> 
    <WarningLevel>4</WarningLevel> 
    </PropertyGroup> 
    <ItemGroup> 
    <Compile Include="src\**\*.cs" /> 
    </ItemGroup> 
    <ItemGroup> 
    <None Include="project.json" /> 
    <None Include="appsettings.json" /> 
    </ItemGroup> 
    <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 
    <Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" /> 
    <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
     Other similar extension points exist, see Microsoft.Common.targets. 
    <Target Name="BeforeBuild"> 
    </Target> 
    <Target Name="AfterBuild"> 
    </Target> 
    --> 
    <PropertyGroup> 
    <!-- We don't use any of MSBuild's resolution logic for resolving the framework, so just set these two 
      properties to any folder that exists to skip the GetReferenceAssemblyPaths task (not target) and 
      to prevent it from outputting a warning (MSB3644). 
     --> 
    <_TargetFrameworkDirectories>$(MSBuildThisFileDirectory)</_TargetFrameworkDirectories> 
    <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory)</_FullFrameworkReferenceAssemblyPaths> 
    <!-- MSBuild thinks all EXEs need binding redirects, not so for CoreCLR! --> 
    <AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences> 
    <AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects> 
    <!-- Set up debug options to run with host, and to use the CoreCLR debug engine --> 
    <StartAction>Program</StartAction> 
    <StartProgram>$(TargetDir)</StartProgram> 
    <DebugEngines>{2E36F1D4-B23C-435D-AB41-18E608940038}</DebugEngines> 
    </PropertyGroup> 
</Project> 

project.json:

{ 
    "version": "1.0.0", 

    "buildOptions": { 
    "emitEntryPoint": true, 
    "preserveCompilationContext": true 
    }, 

    "dependencies": { 
    "Microsoft.NETCore.App": { 
     "version": "1.0.0", 
     "type": "build" 
    }, 
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.0", 
    "Microsoft.AspNetCore.Mvc": "1.0.0", 
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0", 
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", 
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0", 
    "Microsoft.Extensions.Configuration.Json": "1.0.0", 
    "Microsoft.Extensions.Logging": "1.0.0", 
    "Microsoft.Extensions.Logging.Console": "1.0.0", 
    "Microsoft.Extensions.Logging.Debug": "1.0.0", 
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0" 
    }, 

    "runtimes": { 
    "win7-x64": {}, 
    "ubuntu.14.04-x64": {}, 
    "osx.10.10-x64": {} 
    }, 

    "frameworks": { 
    "netcoreapp1.0": { 
     "imports": [ "dnxcore50", "portable-net452" ] 
    } 
    }, 

    "runtimeOptions": { 
    "configProperties": { 
     "System.GC.Server": true 
    } 
    }, 

    "publishOptions": { 
    "include": [ 
     "appsettings.json", 
     "web.config" 
    ] 
    }, 

    "scripts": { 
    "postpublish": [ "dotnet publish --publish-folder ./bin" ] 
    } 
} 
+0

代わりにあなたのプロジェクトを移行する必要があります手動でruningて試してみました上でファイルを移植 'DOTNETのmigrate'の.jsonファイルを新しいシステムに上書き – TerribleDev

+0

これはMicrosoftが.csprojに戻る前のことでした。とにかくあなたの答えのおかげで;) –

答えて

0

使用<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>

関連する問題