From 8c822a8e771bae4fb1268e822e866846f4581678 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Fri, 26 May 2017 12:12:03 -0700 Subject: [PATCH] Move away from `Assembly.Load` to Assembly.LoadFile - Fixes build break. --- .../PublishWithEmbedViewSourcesTest.cs | 4 ---- .../Controllers/HomeController.cs | 7 +++++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs index 3d7566d..ac378c4 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests/PublishWithEmbedViewSourcesTest.cs @@ -33,10 +33,6 @@ namespace Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.FunctionalTests }; var expectedText = "Hello Index!"; - var assemblyPath = Path.Combine( - Fixture.DeploymentResult.DeploymentParameters.PublishedApplicationRootPath, - $"{ApplicationName}.PrecompiledViews.dll"); - // Act - 1 var response1 = await Fixture.HttpClient.GetStringWithRetryAsync( "Home/Index", diff --git a/testapps/PublishWithEmbedViewSources/Controllers/HomeController.cs b/testapps/PublishWithEmbedViewSources/Controllers/HomeController.cs index 8d93240..b97b40f 100644 --- a/testapps/PublishWithEmbedViewSources/Controllers/HomeController.cs +++ b/testapps/PublishWithEmbedViewSources/Controllers/HomeController.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Reflection; using Microsoft.AspNetCore.Mvc; @@ -13,8 +14,10 @@ namespace PublishWithEmbedViewSources.Controllers public string GetPrecompiledResourceNames() { - var precompiledAssembly = Assembly.Load( - new AssemblyName("PublishWithEmbedViewSources.PrecompiledViews")); + var precompiledAssemblyPath = Path.Combine( + Path.GetDirectoryName(GetType().Assembly.Location), + "PublishWithEmbedViewSources.PrecompiledViews.dll"); + var precompiledAssembly = Assembly.LoadFile(precompiledAssemblyPath); return string.Join( Environment.NewLine, precompiledAssembly.GetManifestResourceNames());