Skip to content

Commit 74667ed

Browse files
committed
Don't specify MainEntryPoint when compiling Razor assembly
1 parent e7db3f8 commit 74667ed

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.Compilation.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Copyright (c) .NET Foundation. All rights reserved.
4242
Remove @(DocFileItem)
4343
Remove PdbFile="$(PdbFile)"
4444
Remove OutputRefAssembly="@(IntermediateRefAssembly)"
45+
Remove MainEntryPoint="$(StartupObject)"
4546
4647
Remove EmbedAllSources="$(EmbedAllSources)" - not supported by our supported version of MSBuild
4748
@@ -133,7 +134,6 @@ Copyright (c) .NET Foundation. All rights reserved.
133134
KeyFile="$(KeyOriginatorFile)"
134135
LangVersion="$(LangVersion)"
135136
LinkResources="@(LinkResource)"
136-
MainEntryPoint="$(StartupObject)"
137137
ModuleAssemblyName="$(ModuleAssemblyName)"
138138
NoConfig="true"
139139
NoLogo="$(NoLogo)"

test/Microsoft.AspNetCore.Razor.Design.Test/IntegrationTests/BuildIntegrationTest.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,21 @@ public async Task Build_WithP2P_WorksWhenBuildProjectReferencesIsDisabled()
553553
Assert.BuildPassed(result);
554554
}
555555

556+
[Fact]
557+
[InitializeTestProject("SimpleMvc")]
558+
public async Task Build_WithStartupObjectSpecified_Works()
559+
{
560+
var result = await DotnetMSBuild("Build", $"/p:StartupObject=SimpleMvc.Program");
561+
562+
Assert.BuildPassed(result);
563+
564+
Assert.FileExists(result, IntermediateOutputPath, "SimpleMvc.Views.dll");
565+
Assert.FileExists(result, IntermediateOutputPath, "SimpleMvc.Views.pdb");
566+
567+
Assert.FileExists(result, IntermediateOutputPath, "SimpleMvc.Views.dll");
568+
Assert.FileExists(result, IntermediateOutputPath, "SimpleMvc.Views.pdb");
569+
}
570+
556571
private static DependencyContext ReadDependencyContext(string depsFilePath)
557572
{
558573
var reader = new DependencyContextJsonReader();

0 commit comments

Comments
 (0)