Use MuxerPath to determine location to dotnet.exe

Fixes $50
This commit is contained in:
Pranav K 2017-06-19 12:49:32 -07:00
parent e300cf175a
commit fe4cc976b9
8 changed files with 74 additions and 6 deletions

View File

@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26516.2
VisualStudioVersion = 15.0.26430.6
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation", "src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.csproj", "{4339FC9B-AEC6-442A-B413-A41555ED76C7}"
EndProject
@ -58,6 +58,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{75244EBD
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86", "tools\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.csproj", "{DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks", "src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj", "{996D4DEB-1701-435E-8048-1E65790C2050}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -284,6 +286,18 @@ Global
{DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D}.Release|x64.Build.0 = Release|Any CPU
{DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D}.Release|x86.ActiveCfg = Release|Any CPU
{DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D}.Release|x86.Build.0 = Release|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Debug|Any CPU.Build.0 = Debug|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Debug|x64.ActiveCfg = Debug|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Debug|x64.Build.0 = Debug|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Debug|x86.ActiveCfg = Debug|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Debug|x86.Build.0 = Debug|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Release|Any CPU.ActiveCfg = Release|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Release|Any CPU.Build.0 = Release|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Release|x64.ActiveCfg = Release|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Release|x64.Build.0 = Release|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Release|x86.ActiveCfg = Release|Any CPU
{996D4DEB-1701-435E-8048-1E65790C2050}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -307,5 +321,6 @@ Global
{779BACC4-B20E-4F73-A9C7-350443CF1941} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{D838D8E1-997A-4053-BB2A-2CBDE9F09A0B} = {0DC7C88C-E3DB-46DF-B47E-AC5ECB2A16B7}
{DFB86DBD-17DA-4A97-A4FD-00D6E5160B3D} = {75244EBD-DFBD-4C4B-9543-C135AC142C7F}
{996D4DEB-1701-435E-8048-1E65790C2050} = {02F7AA35-91AF-491E-9F0E-03CFAF86C720}
EndGlobalSection
EndGlobal

View File

@ -2,6 +2,7 @@
<Import Project="dependencies.props" />
<PropertyGroup>
<TestIncludeViewCompilationTargets Condition="'$(TestIncludeViewCompilationTargets)'==''">$(MvcRazorCompileOnPublish)</TestIncludeViewCompilationTargets>
<_MvcViewCompilationTasksPath>$(MSBuildThisFileDirectory)..\src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks\bin\$(Configuration)\netstandard2.0\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.dll</_MvcViewCompilationTasksPath>
</PropertyGroup>
<Import Project="..\src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation\build\netstandard2.0\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.targets"

View File

@ -3,6 +3,7 @@
<AspNetCoreVersion>2.0.0-*</AspNetCoreVersion>
<AspNetCoreIntegrationTestingVersion>0.4.0-*</AspNetCoreIntegrationTestingVersion>
<InternalAspNetCoreSdkVersion>2.1.0-*</InternalAspNetCoreSdkVersion>
<MsBuildPackageVersions>15.1.1012</MsBuildPackageVersions>
<NETStandardImplicitPackageVersion>2.0.0-*</NETStandardImplicitPackageVersion>
<NETStandardLibraryNETFrameworkVersion>2.0.0-*</NETStandardLibraryNETFrameworkVersion>
<RuntimeFrameworkVersion Condition="'$(TargetFramework)'=='netcoreapp2.0'">2.0.0-*</RuntimeFrameworkVersion>

5
build/repo.props Normal file
View File

@ -0,0 +1,5 @@
<Project>
<ItemGroup>
<ExcludeFromPack Include="$(RepositoryRoot)src\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,21 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Microsoft.Extensions.CommandLineUtils;
namespace Microsoft.AspNetCore.BuildTools
{
public class GetDotNetHost : Task
{
[Output]
public string MuxerPath { get; set; }
public override bool Execute()
{
MuxerPath = DotNetMuxer.MuxerPathOrDefault();
return true;
}
}
}

View File

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<Description>Microsoft Build Tasks supporting Razor view compilation.</Description>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MsBuildPackageVersions)" />
<PackageReference Include="Microsoft.Extensions.CommandLineUtils.Sources" Version="$(AspNetCoreVersion)" PrivateAssets="All" />
</ItemGroup>
</Project>

View File

@ -11,11 +11,13 @@
<PreserveCompilationContext>true</PreserveCompilationContext>
<OutputType>exe</OutputType>
<X86ProjectDirectory>..\..\tools\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86\</X86ProjectDirectory>
<TasksProjectDirectory>..\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks\</TasksProjectDirectory>
<IncludeBuildOutput>false</IncludeBuildOutput>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(X86ProjectDirectory)$(MSBuildThisFileName)-x86.csproj" PrivateAssets="true" ReferenceOutputAssembly="false" Condition="'$(TargetFramework)'=='net461'" />
<ProjectReference Include="$(TasksProjectDirectory)Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tasks.csproj" PrivateAssets="true" ReferenceOutputAssembly="false" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.RazorPages" Version="$(AspNetCoreVersion)" />
@ -25,6 +27,7 @@
<ItemGroup>
<None Include="build\**\*.*" Pack="true" PackagePath="%(Identity)" />
<None Include="$(OutputPath)netcoreapp2.0\$(AssemblyName).dll" Pack="true" PackagePath="build\netstandard2.0\$(AssemblyName).dll" />
<None Include="$(TasksProjectDirectory)bin\$(Configuration)\netstandard2.0\$(AssemblyName).Tasks.dll" Pack="true" PackagePath="build\netstandard2.0\$(AssemblyName).Tasks.dll" />
</ItemGroup>
<ItemGroup Condition="'$(OS)'=='Windows_NT'">

View File

@ -25,21 +25,28 @@
<CallTarget Targets="_MvcRazorPrecompile" />
</Target>
<Target
Name="_MvcRazorPrecompile"
DependsOnTargets="_RunForCore;_RunForDesktop">
<Target Name="_MvcRazorPrecompile" DependsOnTargets="_RunForCore;_RunForDesktop" />
</Target>
<PropertyGroup>
<_MvcViewCompilationTasksPath Condition="'$(_MvcViewCompilationTasksPath)'==''">$(MSBuildThisFileDirectory)$(MSBuildThisFileName).Tasks.dll</_MvcViewCompilationTasksPath>
</PropertyGroup>
<UsingTask TaskName="GetDotNetHost" AssemblyFile="$(_MvcViewCompilationTasksPath)" />
<Target
Name="_RunForCore"
DependsOnTargets="_CreateResponseFileForMvcRazorPrecompile"
Condition="'$(TargetFrameworkIdentifier)'=='.NETCoreApp'">
<GetDotNetHost Condition="'$(MvcRazorRunCommand)'==''">
<Output TaskParameter="MuxerPath" PropertyName="MvcRazorRunCommand" />
</GetDotNetHost>
<PropertyGroup>
<_MvcViewCompilationBinaryPath Condition="'$(_MvcViewCompilationBinaryPath)'==''">$(MSBuildThisFileDirectory)$(MSBuildThisFileName).dll</_MvcViewCompilationBinaryPath>
<ExecArgs>dotnet exec --runtimeconfig &quot;$(ProjectRuntimeConfigFilePath)&quot;</ExecArgs>
<ExecArgs>&quot;$(MvcRazorRunCommand)&quot; exec</ExecArgs>
<ExecArgs>$(ExecArgs) --runtimeconfig &quot;$(ProjectRuntimeConfigFilePath)&quot;</ExecArgs>
<ExecArgs>$(ExecArgs) --depsfile &quot;$(ProjectDepsFilePath)&quot;</ExecArgs>
<ExecArgs>$(ExecArgs) &quot;$(_MvcViewCompilationBinaryPath)&quot;</ExecArgs>
<ExecArgs>$(ExecArgs) @&quot;$(_MvcRazorResponseFilePath)&quot;</ExecArgs>