Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
bin/
obj/
/packages/
.idea/
.vs/
*.user
/packages/
.idea/
/OldAspNetApp/_framework/**
.vs/
*.user
8 changes: 8 additions & 0 deletions BlazorWasmApp/App.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData"/>
</Found>
<NotFound>
<p>Sorry, there's nothing at this address.</p>
</NotFound>
</Router>
24 changes: 24 additions & 0 deletions BlazorWasmApp/BlazorWasmApp.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>7.3</LangVersion>
<RazorLangVersion>3.0</RazorLangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview9.19465.2" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview9.19465.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.0.0-preview9.19465.2" />
<Content Update="web.config">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<Target Name="CopyToOldAspNetApp" AfterTargets="Build">
<Exec Command="xcopy $(TargetDir)web.config $(TargetDir)dist\_framework\ /Y" />
<Exec Command="xcopy $(TargetDir)dist $(SolutionDir)OldAspNetApp /Y /S" />
</Target>

</Project>
20 changes: 20 additions & 0 deletions BlazorWasmApp/Pages/About.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@page "/Home/About"

<div class="panel panel-primary">
<div class="panel-heading">
Blazor WASM app
</div>
<div class="panel-body">
<p>Current count: @currentCount</p>
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
</div>
</div>

@code {
int currentCount = 0;

void IncrementCount()
{
currentCount++;
}
}
20 changes: 20 additions & 0 deletions BlazorWasmApp/Pages/Contact.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@page "/Home/Contact"

<div class="panel panel-warning">
<div class="panel-heading">
Blazor WASM app
</div>
<div class="panel-body">
<p>Current count: @currentCount</p>
<button class="btn btn-warning" @onclick="IncrementCount">Click me</button>
</div>
</div>

@code {
int currentCount = 0;

void IncrementCount()
{
currentCount++;
}
}
20 changes: 20 additions & 0 deletions BlazorWasmApp/Pages/Index.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@page "/"

<div class="panel panel-success">
<div class="panel-heading">
Blazor WASM app
</div>
<div class="panel-body">
<p>Current count: @currentCount</p>
<button class="btn btn-success" @onclick="IncrementCount">Click me</button>
</div>
</div>

@code {
int currentCount = 0;

void IncrementCount()
{
currentCount++;
}
}
16 changes: 16 additions & 0 deletions BlazorWasmApp/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Microsoft.AspNetCore.Blazor.Hosting;

namespace BlazorWasmApp
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}

public static IWebAssemblyHostBuilder CreateHostBuilder(string[] args) =>
BlazorWebAssemblyHost.CreateDefaultBuilder()
.UseBlazorStartup<Startup>();
}
}
25 changes: 25 additions & 0 deletions BlazorWasmApp/Startup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components.Builder;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.Extensions.DependencyInjection;

namespace BlazorWasmApp
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<INavigationInterception>(new DisabledNavigationInterception());
}

public void Configure(IComponentsApplicationBuilder app)
{
app.AddComponent<App>("BlazorWasmApp");
}

public class DisabledNavigationInterception : INavigationInterception
{
public Task EnableNavigationInterceptionAsync() => Task.CompletedTask;
}
}
}
5 changes: 5 additions & 0 deletions BlazorWasmApp/_Imports.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@using System.Net.Http
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.JSInterop
29 changes: 29 additions & 0 deletions BlazorWasmApp/web.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<configuration>
<system.webServer>
<handlers>
<clear />
<add
name="StaticFile"
path="*" verb="*"
modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule"
resourceType="Either"
requireAccess="Read" />
</handlers>
<staticContent>
<remove fileExtension=".dll" />
<remove fileExtension=".json" />
<remove fileExtension=".wasm" />
<remove fileExtension=".pdb" />
<mimeMap fileExtension=".dll" mimeType="application/octet-stream" />
<mimeMap fileExtension=".json" mimeType="application/json" />
<mimeMap fileExtension=".wasm" mimeType="application/wasm" />
<mimeMap fileExtension=".pdb" mimeType="text/plain" />
</staticContent>
<httpProtocol>
<customHeaders>
<!-- https://github.com/SteveSandersonMS/BlazorMigration/commit/a82fd5099ea0d690c7709bd1217230046f576530 -->
<add name="Cache-Control" value="no-cache" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
6 changes: 6 additions & 0 deletions Gaev.BlazorOnAspNet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OldAspNetApp", "OldAspNetApp\OldAspNetApp.csproj", "{6856E24E-42F3-4D6C-A177-B3AF7FF67D1E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorWasmApp", "BlazorWasmApp\BlazorWasmApp.csproj", "{CEAC856F-6F18-4FDA-91C8-838380946527}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -12,5 +14,9 @@ Global
{6856E24E-42F3-4D6C-A177-B3AF7FF67D1E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6856E24E-42F3-4D6C-A177-B3AF7FF67D1E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6856E24E-42F3-4D6C-A177-B3AF7FF67D1E}.Release|Any CPU.Build.0 = Release|Any CPU
{CEAC856F-6F18-4FDA-91C8-838380946527}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CEAC856F-6F18-4FDA-91C8-838380946527}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CEAC856F-6F18-4FDA-91C8-838380946527}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CEAC856F-6F18-4FDA-91C8-838380946527}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
1 change: 1 addition & 0 deletions OldAspNetApp/OldAspNetApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
<Content Include="Views\_ViewStart.cshtml"/>
<Content Include="Views\Shared\Error.cshtml"/>
<Content Include="Views\Shared\_Layout.cshtml"/>
<Content Include="Views\Shared\BlazorWasmApp.cshtml" />
<Content Include="Views\Home\About.cshtml"/>
<Content Include="Views\Home\Contact.cshtml"/>
<Content Include="Views\Home\Index.cshtml"/>
Expand Down
3 changes: 3 additions & 0 deletions OldAspNetApp/Views/Home/About.cshtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
@{
ViewBag.Title = "About";
}

@Html.Partial("BlazorWasmApp")

<h2>@ViewBag.Title.</h2>
<h3>@ViewBag.Message</h3>

Expand Down
3 changes: 3 additions & 0 deletions OldAspNetApp/Views/Home/Contact.cshtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
@{
ViewBag.Title = "Contact";
}

@Html.Partial("BlazorWasmApp")

<h2>@ViewBag.Title.</h2>
<h3>@ViewBag.Message</h3>

Expand Down
2 changes: 2 additions & 0 deletions OldAspNetApp/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
ViewBag.Title = "Home Page";
}

@Html.Partial("BlazorWasmApp")

<div class="jumbotron">
<h1>ASP.NET</h1>
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
Expand Down
3 changes: 3 additions & 0 deletions OldAspNetApp/Views/Shared/BlazorWasmApp.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<BlazorWasmApp>Blazor WASM app loading...</BlazorWasmApp>
<base href="/"/>
<script src="/_framework/blazor.webassembly.js"></script>