Re-enable netcoreapp1.1 tests (part 2)

This commit is contained in:
Pranav K 2017-02-16 15:28:46 -08:00
parent f3a0ee5bdb
commit 075771a12d
4 changed files with 9 additions and 11 deletions

View File

@ -1,7 +0,0 @@
<Project>
<ItemGroup>
<!-- TODO re-enable tests on .NET Core when we upgrade to 2.0. This project started using 2.0 API but we had to drop temporarily to .NET Core 1.1 -->
<ExcludeFromTest Include="$(RepositoryRoot)test\Microsoft.CodeAnalysis.Razor.Test\*.csproj" Condition="'$(OS)' != 'Windows_NT'"/>
<ExcludeFromTest Include="$(RepositoryRoot)test\Microsoft.AspNetCore.Razor.Evolution.Test\*.csproj" Condition="'$(OS)' != 'Windows_NT'" />
</ItemGroup>
</Project>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net46</TargetFrameworks>
<TargetFrameworks>netcoreapp1.1;net452</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp1.1</TargetFrameworks>
<DefaultItemExcludes>$(DefaultItemExcludes);TestFiles\**\*</DefaultItemExcludes>
<PreserveCompilationContext>true</PreserveCompilationContext>
@ -11,6 +11,7 @@
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="TestFiles\**\*" />
<None Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.CodeAnalysis.Razor\Microsoft.CodeAnalysis.Razor.csproj" />

View File

@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
@ -23,13 +24,13 @@ namespace Microsoft.CodeAnalysis.Razor
syntaxTrees = new[] { syntaxTree };
}
var assemblyName = new AssemblyName(typeof(TestCompilation).GetTypeInfo().Assembly.GetName().Name);
var dependencyContext = DependencyContext.Load(Assembly.Load(assemblyName));
var currentAssembly = typeof(TestCompilation).GetTypeInfo().Assembly;
var dependencyContext = DependencyContext.Load(currentAssembly);
var references = dependencyContext.CompileLibraries.SelectMany(l => l.ResolveReferencePaths())
.Select(assemblyPath => MetadataReference.CreateFromFile(assemblyPath));
var compilation = CSharpCompilation.Create("TestAssembly", syntaxTrees, references);
EnsureValidCompilation(compilation);
return compilation;

View File

@ -0,0 +1,3 @@
{
"shadowCopy": false
}