Fixup project templates to handle project names with dashes (#692)
Fixes #291
14
Blazor.sln
|
|
@ -66,18 +66,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Blazor
|
|||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "templates", "templates", "{E8EBA72C-D555-43AE-BC98-F0B2D05F6A07}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorStandalone.CSharp", "src\Microsoft.AspNetCore.Blazor.Templates\content\BlazorStandalone.CSharp\BlazorStandalone.CSharp.csproj", "{A092FA91-856B-4ACA-B1C2-10BDBA366185}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorStandalone-CSharp", "src\Microsoft.AspNetCore.Blazor.Templates\content\BlazorStandalone-CSharp\BlazorStandalone-CSharp.csproj", "{A092FA91-856B-4ACA-B1C2-10BDBA366185}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BlazorHosted.CSharp", "BlazorHosted.CSharp", "{73DA1DFD-79F0-4BA2-B0B6-4F3A21D2C3F8}"
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BlazorHosted-CSharp", "BlazorHosted-CSharp", "{73DA1DFD-79F0-4BA2-B0B6-4F3A21D2C3F8}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
src\Microsoft.AspNetCore.Blazor.Templates\content\BlazorHosted.CSharp\global.json = src\Microsoft.AspNetCore.Blazor.Templates\content\BlazorHosted.CSharp\global.json
|
||||
src\Microsoft.AspNetCore.Blazor.Templates\content\BlazorHosted-CSharp\global.json = src\Microsoft.AspNetCore.Blazor.Templates\content\BlazorHosted-CSharp\global.json
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorHosted.CSharp.Client", "src\Microsoft.AspNetCore.Blazor.Templates\content\BlazorHosted.CSharp\BlazorHosted.CSharp.Client\BlazorHosted.CSharp.Client.csproj", "{7549444A-9C81-44DE-AD0D-2C55501EAAC7}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorHosted-CSharp.Client", "src\Microsoft.AspNetCore.Blazor.Templates\content\BlazorHosted-CSharp\BlazorHosted-CSharp.Client\BlazorHosted-CSharp.Client.csproj", "{7549444A-9C81-44DE-AD0D-2C55501EAAC7}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorHosted.CSharp.Server", "src\Microsoft.AspNetCore.Blazor.Templates\content\BlazorHosted.CSharp\BlazorHosted.CSharp.Server\BlazorHosted.CSharp.Server.csproj", "{78ED9932-0912-4F36-8F82-33DE850E7A33}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorHosted-CSharp.Server", "src\Microsoft.AspNetCore.Blazor.Templates\content\BlazorHosted-CSharp\BlazorHosted-CSharp.Server\BlazorHosted-CSharp.Server.csproj", "{78ED9932-0912-4F36-8F82-33DE850E7A33}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorHosted.CSharp.Shared", "src\Microsoft.AspNetCore.Blazor.Templates\content\BlazorHosted.CSharp\BlazorHosted.CSharp.Shared\BlazorHosted.CSharp.Shared.csproj", "{F3E02B21-1127-431A-B832-0E53CB72097B}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorHosted-CSharp.Shared", "src\Microsoft.AspNetCore.Blazor.Templates\content\BlazorHosted-CSharp\BlazorHosted-CSharp.Shared\BlazorHosted-CSharp.Shared.csproj", "{F3E02B21-1127-431A-B832-0E53CB72097B}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Blazor.Razor.Extensions.Test", "test\Microsoft.AspNetCore.Blazor.Razor.Extensions.Test\Microsoft.AspNetCore.Blazor.Razor.Extensions.Test.csproj", "{FF25111E-5A3E-48A3-96D8-08A2C5A2A91C}"
|
||||
EndProject
|
||||
|
|
@ -93,7 +93,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarks", "benchmarks",
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Blazor.Performance", "benchmarks\Microsoft.AspNetCore.Blazor.Performance\Microsoft.AspNetCore.Blazor.Performance.csproj", "{50F6820F-D058-4E68-9E15-801F893F514E}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorLibrary.CSharp", "src\Microsoft.AspNetCore.Blazor.Templates\content\BlazorLibrary.CSharp\BlazorLibrary.CSharp.csproj", "{3A457B14-D91B-4FFF-A81A-8F350BDB911F}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorLibrary-CSharp", "src\Microsoft.AspNetCore.Blazor.Templates\content\BlazorLibrary-CSharp\BlazorLibrary-CSharp.csproj", "{3A457B14-D91B-4FFF-A81A-8F350BDB911F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ namespace Microsoft.AspNetCore.Blazor.Razor
|
|||
|
||||
private static readonly char[] PathSeparators = new char[] { '/', '\\' };
|
||||
|
||||
private static readonly char[] NamespaceSeparators = new char[] { '.' };
|
||||
|
||||
/// <summary>
|
||||
/// The base namespace.
|
||||
/// </summary>
|
||||
|
|
@ -141,9 +143,17 @@ namespace Microsoft.AspNetCore.Blazor.Razor
|
|||
}
|
||||
|
||||
var builder = new StringBuilder();
|
||||
builder.Append(baseNamespace); // Don't sanitize, we expect it to contain dots.
|
||||
|
||||
var segments = relativePath.Split(PathSeparators, StringSplitOptions.RemoveEmptyEntries);
|
||||
// Sanitize the base namespace, but leave the dots.
|
||||
var segments = baseNamespace.Split(NamespaceSeparators, StringSplitOptions.RemoveEmptyEntries);
|
||||
builder.Append(CSharpIdentifier.SanitizeClassName(segments[0]));
|
||||
for (var i = 1; i < segments.Length; i++)
|
||||
{
|
||||
builder.Append('.');
|
||||
builder.Append(CSharpIdentifier.SanitizeClassName(segments[i]));
|
||||
}
|
||||
|
||||
segments = relativePath.Split(PathSeparators, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
// Skip the last segment because it's the FileName.
|
||||
for (var i = 0; i < segments.Length - 1; i++)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
<files>
|
||||
<file
|
||||
src="content/**/*"
|
||||
exclude="content/BlazorHosted.CSharp.Client/Properties/launchSettings.json;content/BlazorHosted.CSharp.Server/Properties/launchSettings.json;**/node_modules/**;**/bin/**;**/obj/**;**/*.user;**/.vs/**;**/.vscode/**;content/Directory.Build.*;**/.template.config.src/**"
|
||||
exclude="content/BlazorHosted-CSharp.Client/Properties/launchSettings.json;content/BlazorHosted-CSharp.Server/Properties/launchSettings.json;**/node_modules/**;**/bin/**;**/obj/**;**/*.user;**/.vs/**;**/.vscode/**;content/Directory.Build.*;**/.template.config.src/**"
|
||||
target="Content" />
|
||||
</files>
|
||||
</package>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
|
@ -18,35 +18,35 @@
|
|||
"primaryOutputs": [
|
||||
{
|
||||
"condition": "(HostIdentifier == \"dotnetcli\" || HostIdentifier == \"dotnetcli-preview\")",
|
||||
"path": "BlazorHosted.CSharp.sln"
|
||||
"path": "BlazorHosted-CSharp.sln"
|
||||
},
|
||||
{
|
||||
"condition": "(OS == \"Windows_NT\" && HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")",
|
||||
"path": "BlazorHosted.CSharp.Server\\BlazorHosted.CSharp.Server.csproj"
|
||||
"path": "BlazorHosted-CSharp.Server\\BlazorHosted-CSharp.Server.csproj"
|
||||
},
|
||||
{
|
||||
"condition": "(OS != \"Windows_NT\" && HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")",
|
||||
"path": "BlazorHosted.CSharp.Server/BlazorHosted.CSharp.Server.csproj"
|
||||
"path": "BlazorHosted-CSharp.Server/BlazorHosted-CSharp.Server.csproj"
|
||||
},
|
||||
{
|
||||
"condition": "(OS == \"Windows_NT\" && HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")",
|
||||
"path": "BlazorHosted.CSharp.Client\\BlazorHosted.CSharp.Client.csproj"
|
||||
"path": "BlazorHosted-CSharp.Client\\BlazorHosted-CSharp.Client.csproj"
|
||||
},
|
||||
{
|
||||
"condition": "(OS != \"Windows_NT\" && HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")",
|
||||
"path": "BlazorHosted.CSharp.Client/BlazorHosted.CSharp.Client.csproj"
|
||||
"path": "BlazorHosted-CSharp.Client/BlazorHosted-CSharp.Client.csproj"
|
||||
},
|
||||
{
|
||||
"condition": "(OS == \"Windows_NT\" && HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")",
|
||||
"path": "BlazorHosted.CSharp.Shared\\BlazorHosted.CSharp.Shared.csproj"
|
||||
"path": "BlazorHosted-CSharp.Shared\\BlazorHosted-CSharp.Shared.csproj"
|
||||
},
|
||||
{
|
||||
"condition": "(OS != \"Windows_NT\" && HostIdentifier != \"dotnetcli\" && HostIdentifier != \"dotnetcli-preview\")",
|
||||
"path": "BlazorHosted.CSharp.Shared/BlazorHosted.CSharp.Shared.csproj"
|
||||
"path": "BlazorHosted-CSharp.Shared/BlazorHosted-CSharp.Shared.csproj"
|
||||
}
|
||||
],
|
||||
"shortName": "blazorhosted",
|
||||
"sourceName": "BlazorHosted.CSharp",
|
||||
"sourceName": "BlazorHosted-CSharp",
|
||||
"sources": [
|
||||
{
|
||||
"source": "./",
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BlazorHosted.CSharp.Shared\BlazorHosted.CSharp.Shared.csproj" />
|
||||
<ProjectReference Include="..\BlazorHosted-CSharp.Shared\BlazorHosted-CSharp.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
@using BlazorHosted.CSharp.Shared
|
||||
@using BlazorHosted_CSharp.Shared
|
||||
@page "/fetchdata"
|
||||
@inject HttpClient Http
|
||||
|
||||
|
|
@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Blazor.Browser.Services;
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
|
||||
namespace BlazorHosted.CSharp.Client
|
||||
namespace BlazorHosted_CSharp.Client
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<div class="top-row pl-4 navbar navbar-dark">
|
||||
<a class="navbar-brand" href="/">BlazorHosted.CSharp</a>
|
||||
<a class="navbar-brand" href="/">BlazorHosted-CSharp</a>
|
||||
<button class="navbar-toggler" onclick=@ToggleNavMenu>
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
|
@ -3,5 +3,5 @@
|
|||
@using Microsoft.AspNetCore.Blazor.Components
|
||||
@using Microsoft.AspNetCore.Blazor.Layouts
|
||||
@using Microsoft.AspNetCore.Blazor.Routing
|
||||
@using BlazorHosted.CSharp.Client
|
||||
@using BlazorHosted.CSharp.Client.Shared
|
||||
@using BlazorHosted_CSharp.Client
|
||||
@using BlazorHosted_CSharp.Client.Shared
|
||||
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<title>BlazorHosted.CSharp</title>
|
||||
<title>BlazorHosted-CSharp</title>
|
||||
<base href="/" />
|
||||
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="css/site.css" rel="stylesheet" />
|
||||
|
|
@ -20,8 +20,8 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BlazorHosted.CSharp.Client\BlazorHosted.CSharp.Client.csproj" />
|
||||
<ProjectReference Include="..\BlazorHosted.CSharp.Shared\BlazorHosted.CSharp.Shared.csproj" />
|
||||
<ProjectReference Include="..\BlazorHosted-CSharp.Client\BlazorHosted-CSharp.Client.csproj" />
|
||||
<ProjectReference Include="..\BlazorHosted-CSharp.Shared\BlazorHosted-CSharp.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
using BlazorHosted.CSharp.Shared;
|
||||
using BlazorHosted_CSharp.Shared;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BlazorHosted.CSharp.Server.Controllers
|
||||
namespace BlazorHosted_CSharp.Server.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
public class SampleDataController : Controller
|
||||
|
|
@ -5,7 +5,7 @@ using Microsoft.AspNetCore;
|
|||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace BlazorHosted.CSharp.Server
|
||||
namespace BlazorHosted_CSharp.Server
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
|
|
@ -10,7 +10,7 @@ using Newtonsoft.Json.Serialization;
|
|||
using System.Linq;
|
||||
using System.Net.Mime;
|
||||
|
||||
namespace BlazorHosted.CSharp.Server
|
||||
namespace BlazorHosted_CSharp.Server
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace BlazorHosted.CSharp.Shared
|
||||
namespace BlazorHosted_CSharp.Shared
|
||||
{
|
||||
public class WeatherForecast
|
||||
{
|
||||
|
|
@ -2,11 +2,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27130.2027
|
||||
MinimumVisualStudioVersion = 15.0.26124.0
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorHosted.CSharp.Server", "BlazorHosted.CSharp.Server\BlazorHosted.CSharp.Server.csproj", "{650B3CE7-2E93-4CC4-9F46-466686815EAA}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorHosted-CSharp.Server", "BlazorHosted-CSharp.Server\BlazorHosted-CSharp.Server.csproj", "{650B3CE7-2E93-4CC4-9F46-466686815EAA}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorHosted.CSharp.Client", "BlazorHosted.CSharp.Client\BlazorHosted.CSharp.Client.csproj", "{5990939C-7E7B-4CFA-86FF-44CA5756498A}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorHosted-CSharp.Client", "BlazorHosted-CSharp.Client\BlazorHosted-CSharp.Client.csproj", "{5990939C-7E7B-4CFA-86FF-44CA5756498A}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorHosted.CSharp.Shared", "BlazorHosted.CSharp.Shared\BlazorHosted.CSharp.Shared.csproj", "{0AFFA7FD-4E37-4636-AB91-3753E746DB98}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorHosted-CSharp.Shared", "BlazorHosted-CSharp.Shared\BlazorHosted-CSharp.Shared.csproj", "{0AFFA7FD-4E37-4636-AB91-3753E746DB98}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
|
@ -11,11 +11,11 @@
|
|||
"preferNameDirectory": true,
|
||||
"primaryOutputs": [
|
||||
{
|
||||
"path": "BlazorLibrary.CSharp.csproj"
|
||||
"path": "BlazorLibrary-CSharp.csproj"
|
||||
}
|
||||
],
|
||||
"shortName": "blazorlib",
|
||||
"sourceName": "BlazorLibrary.CSharp",
|
||||
"sourceName": "BlazorLibrary-CSharp",
|
||||
"sources": [
|
||||
{
|
||||
"source": "./",
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
<div class="my-component">
|
||||
This Blazor component is defined in the <strong>BlazorLibrary.CSharp</strong> package.
|
||||
This Blazor component is defined in the <strong>BlazorLibrary-CSharp</strong> package.
|
||||
</div>
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
using System;
|
||||
using Microsoft.AspNetCore.Blazor.Browser.Interop;
|
||||
|
||||
namespace BlazorLibrary.CSharp
|
||||
namespace BlazorLibrary_CSharp
|
||||
{
|
||||
public class ExampleJsInterop
|
||||
{
|
||||
public static string Prompt(string message)
|
||||
{
|
||||
return RegisteredFunction.Invoke<string>(
|
||||
"BlazorLibrary.CSharp.ExampleJsInterop.Prompt",
|
||||
"BlazorLibrary-CSharp.ExampleJsInterop.Prompt",
|
||||
message);
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 378 B After Width: | Height: | Size: 378 B |
|
|
@ -1,6 +1,6 @@
|
|||
// This file is to show how a library package may provide JavaScript interop features
|
||||
// wrapped in a .NET API
|
||||
|
||||
Blazor.registerFunction('BlazorLibrary.CSharp.ExampleJsInterop.Prompt', function (message) {
|
||||
Blazor.registerFunction('BlazorLibrary-CSharp.ExampleJsInterop.Prompt', function (message) {
|
||||
return prompt(message, 'Type anything here');
|
||||
});
|
||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
|
@ -11,11 +11,11 @@
|
|||
"preferNameDirectory": true,
|
||||
"primaryOutputs": [
|
||||
{
|
||||
"path": "BlazorStandalone.CSharp.csproj"
|
||||
"path": "BlazorStandalone-CSharp.csproj"
|
||||
}
|
||||
],
|
||||
"shortName": "blazor",
|
||||
"sourceName": "BlazorStandalone.CSharp",
|
||||
"sourceName": "BlazorStandalone-CSharp",
|
||||
"sources": [
|
||||
{
|
||||
"source": "./",
|
||||
|
|
@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Blazor.Browser.Services;
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
|
||||
namespace BlazorStandalone.CSharp
|
||||
namespace BlazorStandalone_CSharp
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"profiles": {
|
||||
"BlazorStandalone.CSharp": {
|
||||
"BlazorStandalone-CSharp": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<div class="top-row pl-4 navbar navbar-dark">
|
||||
<a class="navbar-brand" href="/">BlazorStandalone.CSharp</a>
|
||||
<a class="navbar-brand" href="/">BlazorStandalone-CSharp</a>
|
||||
<button class="navbar-toggler" onclick=@ToggleNavMenu>
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
|
@ -3,5 +3,5 @@
|
|||
@using Microsoft.AspNetCore.Blazor.Components
|
||||
@using Microsoft.AspNetCore.Blazor.Layouts
|
||||
@using Microsoft.AspNetCore.Blazor.Routing
|
||||
@using BlazorStandalone.CSharp
|
||||
@using BlazorStandalone.CSharp.Shared
|
||||
@using BlazorStandalone_CSharp
|
||||
@using BlazorStandalone_CSharp.Shared
|
||||
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<title>BlazorStandalone.CSharp</title>
|
||||
<title>BlazorStandalone-CSharp</title>
|
||||
<base href="/" />
|
||||
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="css/site.css" rel="stylesheet" />
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
// 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.
|
||||
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNetCore.Blazor.Build.Test
|
||||
{
|
||||
// Integration tests focused on file path handling for class/namespace names
|
||||
public class WorkingDirectoryRazorIntegrationTest : RazorIntegrationTestBase
|
||||
{
|
||||
public WorkingDirectoryRazorIntegrationTest()
|
||||
{
|
||||
WorkingDirectory = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ArbitraryWindowsPath : ArbitraryMacLinuxPath;
|
||||
WorkingDirectory += "-Dir";
|
||||
}
|
||||
|
||||
internal override string WorkingDirectory { get; }
|
||||
|
||||
[Theory]
|
||||
[InlineData("ItemAtRoot.cs", "Test_Dir", "ItemAtRoot")]
|
||||
[InlineData("Dir1\\MyFile.cs", "Test_Dir.Dir1", "MyFile")]
|
||||
[InlineData("Dir1\\Dir2\\MyFile.cs", "Test_Dir.Dir1.Dir2", "MyFile")]
|
||||
public void CreatesClassWithCorrectNameAndNamespace(string relativePath, string expectedNamespace, string expectedClassName)
|
||||
{
|
||||
// Arrange
|
||||
relativePath = relativePath.Replace('\\', Path.DirectorySeparatorChar);
|
||||
|
||||
// Act
|
||||
var result = CompileToAssembly(relativePath, "");
|
||||
|
||||
// Assert
|
||||
Assert.Empty(result.Diagnostics);
|
||||
|
||||
var type = Assert.Single(result.Assembly.GetTypes());
|
||||
Assert.Equal(expectedNamespace, type.Namespace);
|
||||
Assert.Equal(expectedClassName, type.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||