Skip to content

Commit

Permalink
Support for XML-based solution file (slnx) #97
Browse files Browse the repository at this point in the history
  • Loading branch information
egvijayanand committed Aug 20, 2024
1 parent 4f96393 commit 0506a8f
Show file tree
Hide file tree
Showing 31 changed files with 358 additions and 54 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,24 @@ dotnet new update --check-only
dotnet new update
```

And from [v4.3.0](https://www.nuget.org/packages/VijayAnand.BlazorTemplates/4.3.0) of the template package, support for XML-based solution file (slnx) format.

* SLNX Solution File Format (Short notation: -slnx):

Introduces support for the new, simplified, and easily understandable XML-based solution file format.

This would be an explicit option since the SLNX feature is currently in the preview stage and is only supported on VS2022.

`-slnx` | `--use-slnx` - Default value is `false`.

```shell
dotnet new winforms-blazor -o MyApp -slnx
```

```shell
dotnet new wpf-blazor -o MyApp -slnx
```

#### Project names referenced by these templates:

Windows Forms: **winforms-blazor**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"$schema": "http://json.schemastore.org/dotnetcli.host",
"symbolInfo": {
"Framework": {
"longName": "framework"
"$schema": "http://json.schemastore.org/dotnetcli.host",
"symbolInfo": {
"Framework": {
"longName": "framework"
},
"use-slnx": {
"shortName": "slnx"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
"$schema": "http://json.schemastore.org/vs-2017.3.host",
"icon": "ide/icon.png",
"symbolInfo": [
{
"id": "use-slnx",
"name": {
"text": "Use XML-based solution file (sln_x)."
},
"isVisible": true,
"defaultValue": "false"
},
{
"id": "central-pkg-mgmt",
"name": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@
"replaces": "DOTNET_TFM",
"defaultValue": "net8.0"
},
"use-slnx": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "false",
"description": "Option to use XML-based solution file (slnx).",
"displayName": "Option to use XML-based solution file (sln_x)"
},
"central-pkg-mgmt": {
"type": "parameter",
"datatype": "bool",
Expand Down Expand Up @@ -105,6 +112,13 @@
"defaultValue": "false",
"description": "Option to skip creating a solution file."
},
"XmlEncodedName": {
"type": "derived",
"datatype": "string",
"replaces": "SAFE-NAME",
"valueSource": "name",
"valueTransform": "xmlEncode"
},
"NonWindows": {
"type": "computed",
"value": "(enable-windows-targeting)"
Expand All @@ -121,6 +135,10 @@
"type": "computed",
"value": "(!no-solution-file)"
},
"UseSlnx": {
"type": "computed",
"value": "(use-slnx)"
},
"HostIdentifier": {
"type": "bind",
"binding": "HostIdentifier"
Expand All @@ -143,8 +161,24 @@
"modifiers": [
{
"condition": "(!(SolnFile || RazorLib))",
"exclude": [
"BlazorWinForms.1.sln",
"BlazorWinForms.1.xml"
]
},
{
"condition": "(UseSlnx)",
"exclude": [
"BlazorWinForms.1.sln"
],
"rename": {
"BlazorWinForms.1.xml": "BlazorWinForms.1.slnx"
}
},
{
"condition": "(!UseSlnx)",
"exclude": [
"BlazorWinForms.1.xml"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<!--#if (RazorLib)-->

<ItemGroup>
<ProjectReference Include="..\BlazorWinForms.1.RazorLib\BlazorWinForms.1.RazorLib.csproj" />
<ProjectReference Include="..\SAFE-NAME.RazorLib\SAFE-NAME.RazorLib.csproj" />
</ItemGroup>
<!--#endif-->

Expand Down
17 changes: 17 additions & 0 deletions src/BlazorTemplatesCLI/BlazorWinForms/BlazorWinForms.1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Solution>
<!--#if (CentralPkgMgmt)-->
<Folder Name="/Solution Items/">
<File Path="Directory.Packages.props" />
</Folder>
<!--#endif-->
<!--#if (RazorLib)-->
<Project Path="SAFE-NAME\SAFE-NAME.csproj" />
<Project Path="SAFE-NAME.RazorLib\SAFE-NAME.RazorLib.csproj" />
<!--#else-->
<Project Path="SAFE-NAME.csproj" />
<!--#endif-->
<Properties Name="Visual Studio">
<!-- Support is provisionally available on Visual Studio 17.10 and later versions. -->
<Property Name="OpenWith" Value="17" />
</Properties>
</Solution>
12 changes: 6 additions & 6 deletions src/BlazorTemplatesCLI/BlazorWinForms/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
</PropertyGroup>
<ItemGroup>
<!--#if (Net9)-->
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="9.0.0-preview.5.24306.11" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebView.WindowsForms" Version="9.0.0-preview.5.24307.10" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.0-preview.5.24306.7" />
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="9.0.0-preview.7.24406.2" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebView.WindowsForms" Version="9.0.0-preview.7.24407.4" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.0-preview.7.24405.7" />
<!--#elif (Net8)-->
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="8.0.6" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebView.WindowsForms" Version="8.0.60" />
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="8.0.8" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebView.WindowsForms" Version="8.0.80" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<!--#elif (Net7)-->
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="7.0.20" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebView.WindowsForms" Version="7.0.101" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<!--#else-->
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="6.0.31" />
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="6.0.33" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebView.WindowsForms" Version="6.0.553" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<!--#endif-->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"$schema": "http://json.schemastore.org/dotnetcli.host",
"symbolInfo": {
"Framework": {
"longName": "framework"
"$schema": "http://json.schemastore.org/dotnetcli.host",
"symbolInfo": {
"Framework": {
"longName": "framework"
},
"use-slnx": {
"shortName": "slnx"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
"$schema": "http://json.schemastore.org/vs-2017.3.host",
"icon": "ide/icon.png",
"symbolInfo": [
{
"id": "use-slnx",
"name": {
"text": "Use XML-based solution file (sln_x)."
},
"isVisible": true,
"defaultValue": "false"
},
{
"id": "central-pkg-mgmt",
"name": {
Expand Down
34 changes: 34 additions & 0 deletions src/BlazorTemplatesCLI/BlazorWpf/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@
"replaces": "DOTNET_TFM",
"defaultValue": "net8.0"
},
"use-slnx": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "false",
"description": "Option to use XML-based solution file (slnx).",
"displayName": "Option to use XML-based solution file (sln_x)"
},
"central-pkg-mgmt": {
"type": "parameter",
"datatype": "bool",
Expand Down Expand Up @@ -105,6 +112,13 @@
"defaultValue": "false",
"description": "Option to skip creating a solution file."
},
"XmlEncodedName": {
"type": "derived",
"datatype": "string",
"replaces": "SAFE-NAME",
"valueSource": "name",
"valueTransform": "xmlEncode"
},
"NonWindows": {
"type": "computed",
"value": "(enable-windows-targeting)"
Expand All @@ -121,6 +135,10 @@
"type": "computed",
"value": "(!no-solution-file)"
},
"UseSlnx": {
"type": "computed",
"value": "(use-slnx)"
},
"HostIdentifier": {
"type": "bind",
"binding": "HostIdentifier"
Expand All @@ -143,8 +161,24 @@
"modifiers": [
{
"condition": "(!(SolnFile || RazorLib))",
"exclude": [
"BlazorWpf.1.sln",
"BlazorWpf.1.xml"
]
},
{
"condition": "(UseSlnx)",
"exclude": [
"BlazorWpf.1.sln"
],
"rename": {
"BlazorWpf.1.xml": "BlazorWpf.1.slnx"
}
},
{
"condition": "(!UseSlnx)",
"exclude": [
"BlazorWpf.1.xml"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/BlazorTemplatesCLI/BlazorWpf/BlazorWpf.1.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<!--#if (RazorLib)-->

<ItemGroup>
<ProjectReference Include="..\BlazorWpf.1.RazorLib\BlazorWpf.1.RazorLib.csproj" />
<ProjectReference Include="..\SAFE-NAME.RazorLib\SAFE-NAME.RazorLib.csproj" />
</ItemGroup>
<!--#endif-->

Expand Down
17 changes: 17 additions & 0 deletions src/BlazorTemplatesCLI/BlazorWpf/BlazorWpf.1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Solution>
<!--#if (CentralPkgMgmt)-->
<Folder Name="/Solution Items/">
<File Path="Directory.Packages.props" />
</Folder>
<!--#endif-->
<!--#if (RazorLib)-->
<Project Path="SAFE-NAME\SAFE-NAME.csproj" />
<Project Path="SAFE-NAME.RazorLib\SAFE-NAME.RazorLib.csproj" />
<!--#else-->
<Project Path="SAFE-NAME.csproj" />
<!--#endif-->
<Properties Name="Visual Studio">
<!-- Support is provisionally available on Visual Studio 17.10 and later versions. -->
<Property Name="OpenWith" Value="17" />
</Properties>
</Solution>
12 changes: 6 additions & 6 deletions src/BlazorTemplatesCLI/BlazorWpf/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
</PropertyGroup>
<ItemGroup>
<!--#if (Net9)-->
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="9.0.0-preview.5.24306.11" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebView.Wpf" Version="9.0.0-preview.5.24307.10" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.0-preview.5.24306.7" />
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="9.0.0-preview.7.24406.2" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebView.Wpf" Version="9.0.0-preview.7.24407.4" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.0-preview.7.24405.7" />
<!--#elif (Net8)-->
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="8.0.6" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebView.Wpf" Version="8.0.60" />
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="8.0.8" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebView.Wpf" Version="8.0.80" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<!--#elif (Net7)-->
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="7.0.20" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebView.Wpf" Version="7.0.101" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<!--#else-->
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="6.0.31" />
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="6.0.33" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebView.Wpf" Version="6.0.553" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<!--#endif-->
Expand Down
2 changes: 1 addition & 1 deletion src/BlazorTemplatesCLI/PackageVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.2.0
4.3.0
16 changes: 15 additions & 1 deletion src/BlazorTemplatesCLI/release-notes.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
Join me on Developer Thoughts (https://egvijayanand.in/), an exclusive blog for articles on .NET MAUI and Blazor.

What's new in ver. 4.2.0:
What's new in ver. 4.3.0:
-------------------------
1. Templates updated to support .NET 9 Preview 7 and the latest .NET 8 release.

2. Introduced an option to support the XML-based solution file (slnx) format.

This would be an explicit option since the SLNX feature is currently in the preview stage and is only supported on VS2022.

-slnx | --use-slnx - Default value is false

dotnet new winforms-blazor -o MyApp -slnx

dotnet new wpf-blazor -o MyApp -slnx

v4.2.0:

1. Introduced using the NuGet CPM feature from within Visual Studio IDE.

2. Templates updated to support .NET 9 Preview 5 and latest .NET 8 release.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"$schema": "http://json.schemastore.org/dotnetcli.host",
"symbolInfo": {
"Framework": {
"longName": "framework"
"$schema": "http://json.schemastore.org/dotnetcli.host",
"symbolInfo": {
"Framework": {
"longName": "framework"
},
"use-slnx": {
"shortName": "slnx"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
"$schema": "http://json.schemastore.org/vs-2017.3.host",
"icon": "ide/icon.png",
"symbolInfo": [
{
"id": "use-slnx",
"name": {
"text": "Use XML-based solution file (sln_x)."
},
"isVisible": true,
"defaultValue": "false"
},
{
"id": "central-pkg-mgmt",
"name": {
Expand Down
Loading

0 comments on commit 0506a8f

Please sign in to comment.