From 9677553a33638721a306961d4d7f21834754d3ce Mon Sep 17 00:00:00 2001 From: Pranav K Date: Tue, 19 Jun 2018 11:01:39 -0700 Subject: [PATCH] Don't specify MainEntryPoint when compiling Razor assembly --- .../Microsoft.NET.Sdk.Razor.Compilation.targets | 2 +- .../IntegrationTests/BuildIntegrationTest.cs | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Compilation.targets b/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Compilation.targets index c8ec7205db..102315ebc4 100644 --- a/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Compilation.targets +++ b/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Compilation.targets @@ -42,6 +42,7 @@ Copyright (c) .NET Foundation. All rights reserved. Remove @(DocFileItem) Remove PdbFile="$(PdbFile)" Remove OutputRefAssembly="@(IntermediateRefAssembly)" + Remove MainEntryPoint="$(StartupObject)" Remove EmbedAllSources="$(EmbedAllSources)" - not supported by our supported version of MSBuild @@ -133,7 +134,6 @@ Copyright (c) .NET Foundation. All rights reserved. KeyFile="$(KeyOriginatorFile)" LangVersion="$(LangVersion)" LinkResources="@(LinkResource)" - MainEntryPoint="$(StartupObject)" ModuleAssemblyName="$(ModuleAssemblyName)" NoConfig="true" NoLogo="$(NoLogo)" diff --git a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/BuildIntegrationTest.cs b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/BuildIntegrationTest.cs index 541cac3523..030f55dd7b 100644 --- a/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/BuildIntegrationTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/BuildIntegrationTest.cs @@ -553,6 +553,21 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.BuildPassed(result); } + [Fact] + [InitializeTestProject("SimpleMvc")] + public async Task Build_WithStartupObjectSpecified_Works() + { + var result = await DotnetMSBuild("Build", $"/p:StartupObject=SimpleMvc.Program"); + + Assert.BuildPassed(result); + + Assert.FileExists(result, IntermediateOutputPath, "SimpleMvc.Views.dll"); + Assert.FileExists(result, IntermediateOutputPath, "SimpleMvc.Views.pdb"); + + Assert.FileExists(result, IntermediateOutputPath, "SimpleMvc.Views.dll"); + Assert.FileExists(result, IntermediateOutputPath, "SimpleMvc.Views.pdb"); + } + private static DependencyContext ReadDependencyContext(string depsFilePath) { var reader = new DependencyContextJsonReader();