Skip to content

Add ASP.NET Core MVC template for Tauri applications #890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion .scripts/generate-templates-matrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const matrixConfig = [
manager: "dotnet",
install_cmd: "",
run_cmd: "cargo",
templates: ["blazor"],
templates: ["aspnet", "blazor"],
},
];

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ Follow along with the prompts to choose your project name, frontend language, pa

```
? Choose your UI template ›
AspNet (https://dotnet.microsoft.com/en-us/apps/aspnet/)
Blazor (https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor/)
```

Expand Down Expand Up @@ -181,6 +182,7 @@ Currently supported template presets include:
- `yew`
- `leptos`
- `sycamore`
- `aspnet`
- `blazor`

You can use `.` for the project name to scaffold in the current directory.
Expand Down
1 change: 1 addition & 0 deletions node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Currently supported template presets include:
- `yew`
- `leptos`
- `sycamore`
- `aspnet`
- `blazor`

You can use `.` for the project name to scaffold in the current directory.
Expand Down
10 changes: 8 additions & 2 deletions src/package_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ impl PackageManager {
Template::Angular,
Template::Preact,
],
PackageManager::Dotnet => &[Template::Blazor],
PackageManager::Dotnet => &[
Template::AspNet,
Template::Blazor
],
}
}

Expand Down Expand Up @@ -133,7 +136,10 @@ impl PackageManager {
Template::Preact,
Template::PreactTs,
],
PackageManager::Dotnet => &[Template::Blazor],
PackageManager::Dotnet => &[
Template::AspNet,
Template::Blazor
],
}
}

Expand Down
13 changes: 8 additions & 5 deletions src/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ pub enum Template {
PreactTs,
Blazor,
Dioxus,
AspNet,
}

impl Display for Template {
Expand All @@ -83,6 +84,7 @@ impl Display for Template {
Template::PreactTs => write!(f, "preact-ts"),
Template::Blazor => write!(f, "blazor"),
Template::Dioxus => write!(f, "dioxus"),
Template::AspNet => write!(f, "aspnet"),
}
}
}
Expand All @@ -109,6 +111,7 @@ impl FromStr for Template {
"preact-ts" => Ok(Template::PreactTs),
"blazor" => Ok(Template::Blazor),
"dioxus" => Ok(Template::Dioxus),
"aspnet" => Ok(Template::AspNet),
_ => Err(format!(
"{YELLOW}{s}{RESET} is not a valid template. Valid templates are [{}]",
Template::ALL
Expand All @@ -134,10 +137,9 @@ impl Template {
Template::Sycamore => "Sycamore - (https://sycamore-rs.netlify.app/)",
Template::Angular => "Angular - (https://angular.dev/)",
Template::Preact => "Preact - (https://preactjs.com/)",
Template::Blazor => {
"Blazor - (https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor/)"
}
Template::Blazor => "Blazor - (https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor/)",
Template::Dioxus => "Dioxus - (https://dioxuslabs.com/)",
Template::AspNet => "AspNet - (https://dotnet.microsoft.com/en-us/apps/aspnet/)",
_ => unreachable!(),
}
}
Expand All @@ -163,6 +165,7 @@ impl<'a> Template {
Template::PreactTs,
Template::Blazor,
Template::Dioxus,
Template::AspNet,
];

pub fn flavors<'b>(&self, pkg_manager: PackageManager) -> Option<&'b [Flavor]> {
Expand Down Expand Up @@ -231,7 +234,7 @@ impl<'a> Template {
Template::Yew | Template::Leptos | Template::Sycamore | Template::Dioxus => {
&[PackageManager::Cargo]
}
Template::Blazor => &[PackageManager::Dotnet],
Template::AspNet | Template::Blazor => &[PackageManager::Dotnet],
}
}

Expand All @@ -251,7 +254,7 @@ impl<'a> Template {
}

pub const fn needs_dotnet(&self) -> bool {
matches!(self, Template::Blazor)
matches!(self, Template::AspNet | Template::Blazor)
}

pub const fn needs_dioxus_cli(&self) -> bool {
Expand Down
9 changes: 9 additions & 0 deletions templates/template-aspnet/.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
beforeDevCommand = dotnet watch run --project src/{% project_name_pascal_case %}.csproj
beforeBuildCommand = dotnet publish -c release src/{% project_name_pascal_case %}.csproj -o dist
devUrl = http://localhost:1420
frontendDist = ../dist/wwwroot
withGlobalTauri = true

[files]
styles.css = src/wwwroot/css/app.css
tauri.svg = src/wwwroot/img/tauri.svg
Loading
Loading