diff --git a/samples/HostedInAspNet.Server/HostedInAspNet.Server.csproj b/samples/HostedInAspNet.Server/HostedInAspNet.Server.csproj
index bec134f6ce..04af4dc546 100644
--- a/samples/HostedInAspNet.Server/HostedInAspNet.Server.csproj
+++ b/samples/HostedInAspNet.Server/HostedInAspNet.Server.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/samples/HostedInAspNet.Server/Startup.cs b/samples/HostedInAspNet.Server/Startup.cs
index 92ce6854c6..732ec7f498 100644
--- a/samples/HostedInAspNet.Server/Startup.cs
+++ b/samples/HostedInAspNet.Server/Startup.cs
@@ -23,7 +23,7 @@ namespace HostedInAspNet.Server
app.UseDeveloperExceptionPage();
}
- app.UseBlazor("HostedInAspNet.Client");
+ app.UseBlazor();
}
}
}
diff --git a/samples/MonoSanity/MonoSanity.csproj b/samples/MonoSanity/MonoSanity.csproj
index 5f9d0ad148..6beda8c9d2 100644
--- a/samples/MonoSanity/MonoSanity.csproj
+++ b/samples/MonoSanity/MonoSanity.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/samples/MonoSanity/Startup.cs b/samples/MonoSanity/Startup.cs
index 68d05ca3ae..fc13003004 100644
--- a/samples/MonoSanity/Startup.cs
+++ b/samples/MonoSanity/Startup.cs
@@ -12,7 +12,7 @@ namespace MonoSanity
{
app.UseDeveloperExceptionPage();
app.UseFileServer(new FileServerOptions { EnableDefaultFiles = true });
- app.UseBlazor("MonoSanityClient");
+ app.UseBlazor();
}
}
}
diff --git a/samples/MonoSanityClient/Program.cs b/samples/MonoSanityClient/Program.cs
new file mode 100644
index 0000000000..829c3507d0
--- /dev/null
+++ b/samples/MonoSanityClient/Program.cs
@@ -0,0 +1,12 @@
+// 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.
+
+namespace MonoSanityClient
+{
+ // Note: Not used at runtime. This exists only to give the server app some type to reference.
+ // In realistic scenarios you'd have a Program class for real.
+
+ public class Program
+ {
+ }
+}
diff --git a/src/Microsoft.AspNetCore.Blazor.Server/BlazorAppBuilderExtensions.cs b/src/Microsoft.AspNetCore.Blazor.Server/BlazorAppBuilderExtensions.cs
index d86ac6966d..3e25d4c7c9 100644
--- a/src/Microsoft.AspNetCore.Blazor.Server/BlazorAppBuilderExtensions.cs
+++ b/src/Microsoft.AspNetCore.Blazor.Server/BlazorAppBuilderExtensions.cs
@@ -16,18 +16,15 @@ namespace Microsoft.AspNetCore.Builder
///
/// Configures the middleware pipeline to work with Blazor.
///
+ /// Any type from the client app project. This is used to identify the client app assembly.
///
- /// The name of the client assembly relative to the current bin directory.
- public static void UseBlazor(
- this IApplicationBuilder applicationBuilder,
- string clientAssemblyName)
+ public static void UseBlazor(
+ this IApplicationBuilder applicationBuilder)
{
- var binDir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
- var clientAssemblyPath = Path.Combine(binDir, $"{clientAssemblyName}.dll");
+ var clientAssemblyInServerBinDir = typeof(TProgram).Assembly;
applicationBuilder.UseBlazor(new BlazorOptions
{
- ClientAssemblyPath = clientAssemblyPath,
+ ClientAssemblyPath = clientAssemblyInServerBinDir.Location,
});
}