├── .github ├── dependabot.yml ├── funding.yml └── workflows │ └── build.yml ├── .gitignore ├── LICENSE.md ├── NuGetIcon.png ├── README.md ├── SetupRepo.ps1 ├── Templates.csproj ├── TestLocal.ps1 └── templates ├── Avalonia └── AvaloniaSolution │ ├── .editorconfig │ ├── .gitignore │ ├── .template.config │ └── template.json │ ├── Directory.Build.props │ ├── Directory.Build.targets │ ├── Directory.Packages.props │ ├── NuGet.config │ ├── README.md │ ├── SampleAvaloniaApplication.Android │ ├── Icon.png │ ├── MainActivity.cs │ ├── Properties │ │ └── AndroidManifest.xml │ ├── Resources │ │ ├── drawable │ │ │ └── splash_screen.xml │ │ ├── values-night │ │ │ └── colors.xml │ │ └── values │ │ │ ├── colors.xml │ │ │ └── styles.xml │ └── SampleAvaloniaApplication.Android.csproj │ ├── SampleAvaloniaApplication.Browser │ ├── Program.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ └── launchSettings.json │ ├── SampleAvaloniaApplication.Browser.csproj │ ├── runtimeconfig.template.json │ └── wwwroot │ │ ├── app.css │ │ ├── favicon.ico │ │ ├── index.html │ │ └── main.js │ ├── SampleAvaloniaApplication.Desktop │ ├── Program.cs │ ├── SampleAvaloniaApplication.Desktop.csproj │ └── app.manifest │ ├── SampleAvaloniaApplication.iOS │ ├── AppDelegate.cs │ ├── Entitlements.plist │ ├── Info.plist │ ├── Main.cs │ ├── Resources │ │ └── LaunchScreen.xib │ └── SampleAvaloniaApplication.iOS.csproj │ ├── SampleAvaloniaApplication.sln │ ├── SampleAvaloniaApplication │ ├── App.axaml │ ├── App.axaml.cs │ ├── Assets │ │ └── avalonia-logo.ico │ ├── SampleAvaloniaApplication.csproj │ ├── ServiceCollectionExtensions.cs │ ├── ViewModels │ │ └── MainViewModel.cs │ └── Views │ │ ├── MainView.axaml │ │ ├── MainView.axaml.cs │ │ ├── MainWindow.axaml │ │ └── MainWindow.axaml.cs │ ├── Settings.XamlStyler │ └── exclusions.dic ├── Console └── ConsoleApp │ ├── .editorconfig │ ├── .github │ ├── dependabot.yml │ └── workflows │ │ ├── build-and-deploy.yml │ │ └── pr-code-coverage-comment.yml │ ├── .gitignore │ ├── .template.config │ └── template.json │ ├── ConsoleApp.Tests │ ├── ConsoleApp.Tests.csproj │ └── ProgramTests.cs │ ├── ConsoleApp.sln │ ├── ConsoleApp │ ├── ConsoleApp.csproj │ ├── Program.cs │ └── Properties │ │ └── launchSettings.json │ ├── Directory.Build.props │ ├── Directory.Build.targets │ ├── Directory.Packages.props │ ├── NuGet.config │ ├── README.md │ └── exclusions.dic ├── Library └── NuGet │ ├── .editorconfig │ ├── .github │ ├── dependabot.yml │ └── workflows │ │ ├── build-and-deploy.yml │ │ └── pr-code-coverage-comment.yml │ ├── .gitignore │ ├── .template.config │ └── template.json │ ├── Directory.Build.props │ ├── Directory.Build.targets │ ├── Directory.Packages.props │ ├── NuGet.config │ ├── NuGetLib.Tests │ ├── Class1Tests.cs │ └── NuGetLib.Tests.csproj │ ├── NuGetLib.sln │ ├── NuGetLib │ ├── Class1.cs │ ├── NuGetIcon.png │ └── NuGetLib.csproj │ ├── NuGetPackageReadme.md │ ├── README.md │ └── exclusions.dic └── WPF └── WpfApp ├── .editorconfig ├── .github ├── dependabot.yml └── workflows │ ├── build_app.yml │ └── code_coverage_comment.yml ├── .gitignore ├── .template.config └── template.json ├── Directory.Build.props ├── Directory.Build.targets ├── Directory.Packages.props ├── NuGet.config ├── README.md ├── Settings.XamlStyler ├── WpfApp.Tests ├── MainWindowViewModelTests.cs └── WpfApp.Tests.csproj ├── WpfApp.sln ├── WpfApp ├── App.xaml ├── App.xaml.cs ├── AssemblyInfo.cs ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── MainWindowViewModel.cs ├── Resources │ └── AppIcon.ico └── WpfApp.csproj └── exclusions.dic /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "github-actions" 9 | directory: "/" 10 | schedule: 11 | interval: "weekly" 12 | 13 | - package-ecosystem: "nuget" 14 | directory: "/templates/WPF/WpfApp" 15 | schedule: 16 | interval: "weekly" 17 | - package-ecosystem: "github-actions" 18 | directory: "/templates/WPF/WpfApp/.github/workflows" 19 | schedule: 20 | interval: "weekly" 21 | 22 | - package-ecosystem: "nuget" 23 | directory: "/templates/Console/ConsoleApp" 24 | schedule: 25 | interval: "weekly" 26 | - package-ecosystem: "github-actions" 27 | directory: "/templates/Console/ConsoleApp/.github/workflows" 28 | schedule: 29 | interval: "weekly" 30 | 31 | - package-ecosystem: "nuget" 32 | directory: "/templates/Library/NuGet" 33 | schedule: 34 | interval: "weekly" 35 | - package-ecosystem: "github-actions" 36 | directory: "/templates/Library/NuGet/.github/workflows" 37 | schedule: 38 | interval: "weekly" 39 | 40 | - package-ecosystem: "nuget" 41 | directory: "/templates/Avalonia/AvaloniaSolution" 42 | schedule: 43 | interval: "weekly" 44 | - package-ecosystem: "github-actions" 45 | directory: "/templates/Avalonia/AvaloniaSolution/.github/workflows" 46 | schedule: 47 | interval: "weekly" 48 | -------------------------------------------------------------------------------- /.github/funding.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [keboo] -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: .NET Core 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | # Sequence of patterns matched against refs/tags 7 | paths-ignore: 8 | - 'README.md' 9 | pull_request: 10 | branches: [ main ] 11 | workflow_dispatch: 12 | 13 | defaults: 14 | run: 15 | shell: pwsh 16 | 17 | env: 18 | DOTNET_VERSION: 8.x 19 | 20 | jobs: 21 | build: 22 | runs-on: windows-latest 23 | 24 | steps: 25 | - name: Checkout 26 | uses: actions/checkout@v4 27 | 28 | - name: Setup .NET 29 | uses: actions/setup-dotnet@v4 30 | with: 31 | dotnet-version: ${{ env.DOTNET_VERSION }} 32 | 33 | - name: Build 34 | run: dotnet pack --configuration Release -o . 35 | 36 | - name: Upload Artifacts 37 | uses: actions/upload-artifact@v4 38 | with: 39 | name: NuGet 40 | path: ${{ github.workspace }}\*.nupkg 41 | 42 | test-console: 43 | runs-on: ubuntu-latest 44 | needs: build 45 | 46 | steps: 47 | - name: Download NuGet Artifacts 48 | uses: actions/download-artifact@v4 49 | with: 50 | name: NuGet 51 | 52 | - name: Setup .NET 53 | uses: actions/setup-dotnet@v4 54 | with: 55 | dotnet-version: ${{ env.DOTNET_VERSION }} 56 | 57 | - name: Test Template 58 | run: | 59 | dotnet new install $(Get-ChildItem -Path "Keboo.Dotnet.Templates.*.nupkg").Name 60 | mkdir TestConsoleApp 61 | Push-Location TestConsoleApp 62 | dotnet new keboo.console 63 | dotnet test 64 | dotnet pack --configuration Release -o ./NuGet 65 | 66 | test-wpf: 67 | runs-on: windows-latest 68 | needs: build 69 | 70 | steps: 71 | - name: Download NuGet Artifacts 72 | uses: actions/download-artifact@v4 73 | with: 74 | name: NuGet 75 | 76 | - name: Setup .NET 77 | uses: actions/setup-dotnet@v4 78 | with: 79 | dotnet-version: ${{ env.DOTNET_VERSION }} 80 | 81 | - name: Test Template 82 | run: | 83 | dotnet new install $(Get-ChildItem -Path "Keboo.Dotnet.Templates.*.nupkg").Name 84 | mkdir TestWpfApp 85 | Push-Location TestWpfApp 86 | dotnet new keboo.wpf 87 | dotnet test 88 | 89 | test-library: 90 | runs-on: ubuntu-latest 91 | needs: build 92 | 93 | steps: 94 | - name: Download NuGet Artifacts 95 | uses: actions/download-artifact@v4 96 | with: 97 | name: NuGet 98 | 99 | - name: Setup .NET 100 | uses: actions/setup-dotnet@v4 101 | with: 102 | dotnet-version: ${{ env.DOTNET_VERSION }} 103 | 104 | - name: Test Template 105 | run: | 106 | dotnet new install $(Get-ChildItem -Path "Keboo.Dotnet.Templates.*.nupkg").Name 107 | mkdir TestLibrary 108 | Push-Location TestLibrary 109 | dotnet new keboo.nuget 110 | dotnet test 111 | dotnet pack --configuration Release -o ./NuGet 112 | 113 | test-avalonia: 114 | runs-on: windows-latest 115 | needs: build 116 | 117 | steps: 118 | - name: Download NuGet Artifacts 119 | uses: actions/download-artifact@v4 120 | with: 121 | name: NuGet 122 | 123 | - name: Setup .NET 124 | uses: actions/setup-dotnet@v4 125 | with: 126 | dotnet-version: ${{ env.DOTNET_VERSION }} 127 | 128 | - name: Test Template 129 | run: | 130 | dotnet new install $(Get-ChildItem -Path "Keboo.Dotnet.Templates.*.nupkg").Name 131 | mkdir TestAvalonia 132 | Push-Location TestAvalonia 133 | dotnet new keboo.avalonia 134 | dotnet workload restore 135 | dotnet build 136 | 137 | 138 | automerge: 139 | if: ${{ github.event_name == 'pull_request' }} 140 | runs-on: ubuntu-latest 141 | 142 | permissions: 143 | pull-requests: write 144 | contents: write 145 | 146 | steps: 147 | - uses: fastify/github-action-merge-dependabot@v3.11.1 148 | with: 149 | use-github-auto-merge: true 150 | 151 | push_nugets: 152 | if: ${{ github.event_name != 'pull_request' }} 153 | name: Push NuGets 154 | runs-on: ubuntu-latest 155 | needs: [build, test-console, test-wpf, test-library, test-avalonia] 156 | 157 | steps: 158 | - name: Download NuGet Artifacts 159 | uses: actions/download-artifact@v4 160 | with: 161 | name: NuGet 162 | 163 | - name: Push NuGets 164 | run: | 165 | dotnet nuget push *.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate 166 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | 33 | # Visual Studio 2015/2017 cache/options directory 34 | .vs/ 35 | # Uncomment if you have tasks that create the project's static files in wwwroot 36 | #wwwroot/ 37 | 38 | # Visual Studio 2017 auto generated files 39 | Generated\ Files/ 40 | 41 | # MSTest test Results 42 | [Tt]est[Rr]esult*/ 43 | [Bb]uild[Ll]og.* 44 | 45 | # NUnit 46 | *.VisualState.xml 47 | TestResult.xml 48 | nunit-*.xml 49 | 50 | # Build Results of an ATL Project 51 | [Dd]ebugPS/ 52 | [Rr]eleasePS/ 53 | dlldata.c 54 | 55 | # Benchmark Results 56 | BenchmarkDotNet.Artifacts/ 57 | 58 | # .NET Core 59 | project.lock.json 60 | project.fragment.lock.json 61 | artifacts/ 62 | 63 | # StyleCop 64 | StyleCopReport.xml 65 | 66 | # Files built by Visual Studio 67 | *_i.c 68 | *_p.c 69 | *_h.h 70 | *.ilk 71 | *.meta 72 | *.obj 73 | *.iobj 74 | *.pch 75 | *.pdb 76 | *.ipdb 77 | *.pgc 78 | *.pgd 79 | *.rsp 80 | *.sbr 81 | *.tlb 82 | *.tli 83 | *.tlh 84 | *.tmp 85 | *.tmp_proj 86 | *_wpftmp.csproj 87 | *.log 88 | *.vspscc 89 | *.vssscc 90 | .builds 91 | *.pidb 92 | *.svclog 93 | *.scc 94 | 95 | # Chutzpah Test files 96 | _Chutzpah* 97 | 98 | # Visual C++ cache files 99 | ipch/ 100 | *.aps 101 | *.ncb 102 | *.opendb 103 | *.opensdf 104 | *.sdf 105 | *.cachefile 106 | *.VC.db 107 | *.VC.VC.opendb 108 | 109 | # Visual Studio profiler 110 | *.psess 111 | *.vsp 112 | *.vspx 113 | *.sap 114 | 115 | # Visual Studio Trace Files 116 | *.e2e 117 | 118 | # TFS 2012 Local Workspace 119 | $tf/ 120 | 121 | # Guidance Automation Toolkit 122 | *.gpState 123 | 124 | # ReSharper is a .NET coding add-in 125 | _ReSharper*/ 126 | *.[Rr]e[Ss]harper 127 | *.DotSettings.user 128 | 129 | # JustCode is a .NET coding add-in 130 | .JustCode 131 | 132 | # TeamCity is a build add-in 133 | _TeamCity* 134 | 135 | # DotCover is a Code Coverage Tool 136 | *.dotCover 137 | 138 | # AxoCover is a Code Coverage Tool 139 | .axoCover/* 140 | !.axoCover/settings.json 141 | 142 | # Visual Studio code coverage results 143 | *.coverage 144 | *.coveragexml 145 | 146 | # NCrunch 147 | _NCrunch_* 148 | .*crunch*.local.xml 149 | nCrunchTemp_* 150 | 151 | # MightyMoose 152 | *.mm.* 153 | AutoTest.Net/ 154 | 155 | # Web workbench (sass) 156 | .sass-cache/ 157 | 158 | # Installshield output folder 159 | [Ee]xpress/ 160 | 161 | # DocProject is a documentation generator add-in 162 | DocProject/buildhelp/ 163 | DocProject/Help/*.HxT 164 | DocProject/Help/*.HxC 165 | DocProject/Help/*.hhc 166 | DocProject/Help/*.hhk 167 | DocProject/Help/*.hhp 168 | DocProject/Help/Html2 169 | DocProject/Help/html 170 | 171 | # Click-Once directory 172 | publish/ 173 | 174 | # Publish Web Output 175 | *.[Pp]ublish.xml 176 | *.azurePubxml 177 | # Note: Comment the next line if you want to checkin your web deploy settings, 178 | # but database connection strings (with potential passwords) will be unencrypted 179 | *.pubxml 180 | *.publishproj 181 | 182 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 183 | # checkin your Azure Web App publish settings, but sensitive information contained 184 | # in these scripts will be unencrypted 185 | PublishScripts/ 186 | 187 | # NuGet Packages 188 | *.nupkg 189 | # NuGet Symbol Packages 190 | *.snupkg 191 | # The packages folder can be ignored because of Package Restore 192 | **/[Pp]ackages/* 193 | # except build/, which is used as an MSBuild target. 194 | !**/[Pp]ackages/build/ 195 | # Uncomment if necessary however generally it will be regenerated when needed 196 | #!**/[Pp]ackages/repositories.config 197 | # NuGet v3's project.json files produces more ignorable files 198 | *.nuget.props 199 | *.nuget.targets 200 | 201 | # Microsoft Azure Build Output 202 | csx/ 203 | *.build.csdef 204 | 205 | # Microsoft Azure Emulator 206 | ecf/ 207 | rcf/ 208 | 209 | # Windows Store app package directories and files 210 | AppPackages/ 211 | BundleArtifacts/ 212 | Package.StoreAssociation.xml 213 | _pkginfo.txt 214 | *.appx 215 | *.appxbundle 216 | *.appxupload 217 | 218 | # Visual Studio cache files 219 | # files ending in .cache can be ignored 220 | *.[Cc]ache 221 | # but keep track of directories ending in .cache 222 | !?*.[Cc]ache/ 223 | 224 | # Others 225 | ClientBin/ 226 | ~$* 227 | *~ 228 | *.dbmdl 229 | *.dbproj.schemaview 230 | *.jfm 231 | *.pfx 232 | *.publishsettings 233 | orleans.codegen.cs 234 | 235 | # Including strong name files can present a security risk 236 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 237 | #*.snk 238 | 239 | # Since there are multiple workflows, uncomment next line to ignore bower_components 240 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 241 | #bower_components/ 242 | 243 | # RIA/Silverlight projects 244 | Generated_Code/ 245 | 246 | # Backup & report files from converting an old project file 247 | # to a newer Visual Studio version. Backup files are not needed, 248 | # because we have git ;-) 249 | _UpgradeReport_Files/ 250 | Backup*/ 251 | UpgradeLog*.XML 252 | UpgradeLog*.htm 253 | ServiceFabricBackup/ 254 | *.rptproj.bak 255 | 256 | # SQL Server files 257 | *.mdf 258 | *.ldf 259 | *.ndf 260 | 261 | # Business Intelligence projects 262 | *.rdl.data 263 | *.bim.layout 264 | *.bim_*.settings 265 | *.rptproj.rsuser 266 | *- [Bb]ackup.rdl 267 | *- [Bb]ackup ([0-9]).rdl 268 | *- [Bb]ackup ([0-9][0-9]).rdl 269 | 270 | # Microsoft Fakes 271 | FakesAssemblies/ 272 | 273 | # GhostDoc plugin setting file 274 | *.GhostDoc.xml 275 | 276 | # Node.js Tools for Visual Studio 277 | .ntvs_analysis.dat 278 | node_modules/ 279 | 280 | # Visual Studio 6 build log 281 | *.plg 282 | 283 | # Visual Studio 6 workspace options file 284 | *.opt 285 | 286 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 287 | *.vbw 288 | 289 | # Visual Studio LightSwitch build output 290 | **/*.HTMLClient/GeneratedArtifacts 291 | **/*.DesktopClient/GeneratedArtifacts 292 | **/*.DesktopClient/ModelManifest.xml 293 | **/*.Server/GeneratedArtifacts 294 | **/*.Server/ModelManifest.xml 295 | _Pvt_Extensions 296 | 297 | # Paket dependency manager 298 | .paket/paket.exe 299 | paket-files/ 300 | 301 | # FAKE - F# Make 302 | .fake/ 303 | 304 | # CodeRush personal settings 305 | .cr/personal 306 | 307 | # Python Tools for Visual Studio (PTVS) 308 | __pycache__/ 309 | *.pyc 310 | 311 | # Cake - Uncomment if you are using it 312 | # tools/** 313 | # !tools/packages.config 314 | 315 | # Tabs Studio 316 | *.tss 317 | 318 | # Telerik's JustMock configuration file 319 | *.jmconfig 320 | 321 | # BizTalk build output 322 | *.btp.cs 323 | *.btm.cs 324 | *.odx.cs 325 | *.xsd.cs 326 | 327 | # OpenCover UI analysis results 328 | OpenCover/ 329 | 330 | # Azure Stream Analytics local run output 331 | ASALocalRun/ 332 | 333 | # MSBuild Binary and Structured Log 334 | *.binlog 335 | 336 | # NVidia Nsight GPU debugger configuration file 337 | *.nvuser 338 | 339 | # MFractors (Xamarin productivity tool) working folder 340 | .mfractor/ 341 | 342 | # Local History for Visual Studio 343 | .localhistory/ 344 | 345 | # BeatPulse healthcheck temp database 346 | healthchecksdb 347 | 348 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 349 | MigrationBackup/ 350 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2022 Kevin Bost 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /NuGetIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Keboo/DotnetTemplates/13b93a4274369e67d52e1fa8527fe0f9a6d83df0/NuGetIcon.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dotnet Templates 2 | 3 | The repository contains a set of opinionated [dotnet new templates](https://learn.microsoft.com/dotnet/core/tools/custom-templates). I am happy to receive critique/feedback on the existing templates, so feel free to open issues. 4 | 5 | ## Installing 6 | Use [dotnet new install](https://learn.microsoft.com/dotnet/core/tools/dotnet-new-install) to install the templates. 7 | 8 | ```cli 9 | dotnet new install Keboo.Dotnet.Templates 10 | ``` 11 | 12 | ## Updating 13 | If you have previously installed the templates and want to install the latest version, you can use [dotnet new update](https://learn.microsoft.com/dotnet/core/tools/dotnet-new-update) to update your installed templates. 14 | ```cli 15 | dotnet new update 16 | ``` 17 | 18 | # Uninstalling 19 | ```cli 20 | dotnet new uninstall Keboo.Dotnet.Templates 21 | ``` 22 | 23 | ## Included Templates 24 | - [Avalonia Solution](./templates/Avalonia/AvaloniaSolution/README.md) 25 | - [WPF Solution](./templates/WPF/WpfApp/README.md) 26 | - [NuGet Package Solution](./templates/Library/NuGet/README.md) 27 | - [System.CommandLine Solution](./templates/Console/ConsoleApp/README.md) 28 | 29 | 30 | # Local testing 31 | Build the template package: 32 | ```cli 33 | dotnet pack --configuration Release -o . 34 | ``` 35 | 36 | Install the locally built template package 37 | ```cli 38 | dotnet new install . --force 39 | ``` 40 | 41 | You can now test the template by running: 42 | ```cli 43 | dotnet new keboo.wpf 44 | dotnet build 45 | dotent test --no-build 46 | dotnet publish --no-build 47 | ``` 48 | 49 | When done, you can remove the local install of the template package by running: 50 | ```cli 51 | dotnet new uninstall . 52 | ``` 53 | -------------------------------------------------------------------------------- /SetupRepo.ps1: -------------------------------------------------------------------------------- 1 | # This script leverages the GitHub CLI. 2 | # Ensure you have installed and updated it by following the directions here: https://github.com/cli/cli 3 | 4 | # This script assumes it is being executed from the root of a repository 5 | 6 | # Setup acceptable merge types 7 | gh repo edit --enable-merge-commit=false 8 | gh repo edit --enable-squash-merge 9 | gh repo edit --enable-rebase-merge 10 | 11 | # Enable PR Auto Merge 12 | gh repo edit --enable-auto-merge 13 | 14 | #TODO: Setup branch protection rule for default branch -------------------------------------------------------------------------------- /Templates.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Template 5 | 1.7.6 6 | Keboo.Dotnet.Templates 7 | Keboo's .NET Templates 8 | Keboo 9 | .NET Templates built by Keboo 10 | Template;WPF;NuGet;Console 11 | net8.0 12 | MIT 13 | https://github.com/Keboo/DotnetTemplates 14 | NuGetIcon.png 15 | 16 | true 17 | false 18 | content 19 | true 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /TestLocal.ps1: -------------------------------------------------------------------------------- 1 | dotnet new uninstall Keboo.Dotnet.Templates 2 | Remove-Item -Path "Keboo.Dotnet.Templates.*.nupkg" 3 | 4 | dotnet pack -o . 5 | 6 | dotnet new install $(Get-ChildItem -Path "Keboo.Dotnet.Templates.*.nupkg").Name 7 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Ll]og/ 33 | [Ll]ogs/ 34 | 35 | # Visual Studio 2015/2017 cache/options directory 36 | .vs/ 37 | # Uncomment if you have tasks that create the project's static files in wwwroot 38 | #wwwroot/ 39 | 40 | # Visual Studio 2017 auto generated files 41 | Generated\ Files/ 42 | 43 | # MSTest test Results 44 | [Tt]est[Rr]esult*/ 45 | [Bb]uild[Ll]og.* 46 | 47 | # NUnit 48 | *.VisualState.xml 49 | TestResult.xml 50 | nunit-*.xml 51 | 52 | # Build Results of an ATL Project 53 | [Dd]ebugPS/ 54 | [Rr]eleasePS/ 55 | dlldata.c 56 | 57 | # Benchmark Results 58 | BenchmarkDotNet.Artifacts/ 59 | 60 | # .NET 61 | project.lock.json 62 | project.fragment.lock.json 63 | artifacts/ 64 | 65 | # Tye 66 | .tye/ 67 | 68 | # ASP.NET Scaffolding 69 | ScaffoldingReadMe.txt 70 | 71 | # StyleCop 72 | StyleCopReport.xml 73 | 74 | # Files built by Visual Studio 75 | *_i.c 76 | *_p.c 77 | *_h.h 78 | *.ilk 79 | *.meta 80 | *.obj 81 | *.iobj 82 | *.pch 83 | *.pdb 84 | *.ipdb 85 | *.pgc 86 | *.pgd 87 | *.rsp 88 | *.sbr 89 | *.tlb 90 | *.tli 91 | *.tlh 92 | *.tmp 93 | *.tmp_proj 94 | *_wpftmp.csproj 95 | *.log 96 | *.tlog 97 | *.vspscc 98 | *.vssscc 99 | .builds 100 | *.pidb 101 | *.svclog 102 | *.scc 103 | 104 | # Chutzpah Test files 105 | _Chutzpah* 106 | 107 | # Visual C++ cache files 108 | ipch/ 109 | *.aps 110 | *.ncb 111 | *.opendb 112 | *.opensdf 113 | *.sdf 114 | *.cachefile 115 | *.VC.db 116 | *.VC.VC.opendb 117 | 118 | # Visual Studio profiler 119 | *.psess 120 | *.vsp 121 | *.vspx 122 | *.sap 123 | 124 | # Visual Studio Trace Files 125 | *.e2e 126 | 127 | # TFS 2012 Local Workspace 128 | $tf/ 129 | 130 | # Guidance Automation Toolkit 131 | *.gpState 132 | 133 | # ReSharper is a .NET coding add-in 134 | _ReSharper*/ 135 | *.[Rr]e[Ss]harper 136 | *.DotSettings.user 137 | 138 | # TeamCity is a build add-in 139 | _TeamCity* 140 | 141 | # DotCover is a Code Coverage Tool 142 | *.dotCover 143 | 144 | # AxoCover is a Code Coverage Tool 145 | .axoCover/* 146 | !.axoCover/settings.json 147 | 148 | # Coverlet is a free, cross platform Code Coverage Tool 149 | coverage*.json 150 | coverage*.xml 151 | coverage*.info 152 | 153 | # Visual Studio code coverage results 154 | *.coverage 155 | *.coveragexml 156 | 157 | # NCrunch 158 | _NCrunch_* 159 | .*crunch*.local.xml 160 | nCrunchTemp_* 161 | 162 | # MightyMoose 163 | *.mm.* 164 | AutoTest.Net/ 165 | 166 | # Web workbench (sass) 167 | .sass-cache/ 168 | 169 | # Installshield output folder 170 | [Ee]xpress/ 171 | 172 | # DocProject is a documentation generator add-in 173 | DocProject/buildhelp/ 174 | DocProject/Help/*.HxT 175 | DocProject/Help/*.HxC 176 | DocProject/Help/*.hhc 177 | DocProject/Help/*.hhk 178 | DocProject/Help/*.hhp 179 | DocProject/Help/Html2 180 | DocProject/Help/html 181 | 182 | # Click-Once directory 183 | publish/ 184 | 185 | # Publish Web Output 186 | *.[Pp]ublish.xml 187 | *.azurePubxml 188 | # Note: Comment the next line if you want to checkin your web deploy settings, 189 | # but database connection strings (with potential passwords) will be unencrypted 190 | *.pubxml 191 | *.publishproj 192 | 193 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 194 | # checkin your Azure Web App publish settings, but sensitive information contained 195 | # in these scripts will be unencrypted 196 | PublishScripts/ 197 | 198 | # NuGet Packages 199 | *.nupkg 200 | # NuGet Symbol Packages 201 | *.snupkg 202 | # The packages folder can be ignored because of Package Restore 203 | **/[Pp]ackages/* 204 | # except build/, which is used as an MSBuild target. 205 | !**/[Pp]ackages/build/ 206 | # Uncomment if necessary however generally it will be regenerated when needed 207 | #!**/[Pp]ackages/repositories.config 208 | # NuGet v3's project.json files produces more ignorable files 209 | *.nuget.props 210 | *.nuget.targets 211 | 212 | # Microsoft Azure Build Output 213 | csx/ 214 | *.build.csdef 215 | 216 | # Microsoft Azure Emulator 217 | ecf/ 218 | rcf/ 219 | 220 | # Windows Store app package directories and files 221 | AppPackages/ 222 | BundleArtifacts/ 223 | Package.StoreAssociation.xml 224 | _pkginfo.txt 225 | *.appx 226 | *.appxbundle 227 | *.appxupload 228 | 229 | # Visual Studio cache files 230 | # files ending in .cache can be ignored 231 | *.[Cc]ache 232 | # but keep track of directories ending in .cache 233 | !?*.[Cc]ache/ 234 | 235 | # Others 236 | ClientBin/ 237 | ~$* 238 | *~ 239 | *.dbmdl 240 | *.dbproj.schemaview 241 | *.jfm 242 | *.pfx 243 | *.publishsettings 244 | orleans.codegen.cs 245 | 246 | # Including strong name files can present a security risk 247 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 248 | #*.snk 249 | 250 | # Since there are multiple workflows, uncomment next line to ignore bower_components 251 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 252 | #bower_components/ 253 | 254 | # RIA/Silverlight projects 255 | Generated_Code/ 256 | 257 | # Backup & report files from converting an old project file 258 | # to a newer Visual Studio version. Backup files are not needed, 259 | # because we have git ;-) 260 | _UpgradeReport_Files/ 261 | Backup*/ 262 | UpgradeLog*.XML 263 | UpgradeLog*.htm 264 | ServiceFabricBackup/ 265 | *.rptproj.bak 266 | 267 | # SQL Server files 268 | *.mdf 269 | *.ldf 270 | *.ndf 271 | 272 | # Business Intelligence projects 273 | *.rdl.data 274 | *.bim.layout 275 | *.bim_*.settings 276 | *.rptproj.rsuser 277 | *- [Bb]ackup.rdl 278 | *- [Bb]ackup ([0-9]).rdl 279 | *- [Bb]ackup ([0-9][0-9]).rdl 280 | 281 | # Microsoft Fakes 282 | FakesAssemblies/ 283 | 284 | # GhostDoc plugin setting file 285 | *.GhostDoc.xml 286 | 287 | # Node.js Tools for Visual Studio 288 | .ntvs_analysis.dat 289 | node_modules/ 290 | 291 | # Visual Studio 6 build log 292 | *.plg 293 | 294 | # Visual Studio 6 workspace options file 295 | *.opt 296 | 297 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 298 | *.vbw 299 | 300 | # Visual Studio 6 auto-generated project file (contains which files were open etc.) 301 | *.vbp 302 | 303 | # Visual Studio 6 workspace and project file (working project files containing files to include in project) 304 | *.dsw 305 | *.dsp 306 | 307 | # Visual Studio 6 technical files 308 | *.ncb 309 | *.aps 310 | 311 | # Visual Studio LightSwitch build output 312 | **/*.HTMLClient/GeneratedArtifacts 313 | **/*.DesktopClient/GeneratedArtifacts 314 | **/*.DesktopClient/ModelManifest.xml 315 | **/*.Server/GeneratedArtifacts 316 | **/*.Server/ModelManifest.xml 317 | _Pvt_Extensions 318 | 319 | # Paket dependency manager 320 | .paket/paket.exe 321 | paket-files/ 322 | 323 | # FAKE - F# Make 324 | .fake/ 325 | 326 | # CodeRush personal settings 327 | .cr/personal 328 | 329 | # Python Tools for Visual Studio (PTVS) 330 | __pycache__/ 331 | *.pyc 332 | 333 | # Cake - Uncomment if you are using it 334 | # tools/** 335 | # !tools/packages.config 336 | 337 | # Tabs Studio 338 | *.tss 339 | 340 | # Telerik's JustMock configuration file 341 | *.jmconfig 342 | 343 | # BizTalk build output 344 | *.btp.cs 345 | *.btm.cs 346 | *.odx.cs 347 | *.xsd.cs 348 | 349 | # OpenCover UI analysis results 350 | OpenCover/ 351 | 352 | # Azure Stream Analytics local run output 353 | ASALocalRun/ 354 | 355 | # MSBuild Binary and Structured Log 356 | *.binlog 357 | 358 | # NVidia Nsight GPU debugger configuration file 359 | *.nvuser 360 | 361 | # MFractors (Xamarin productivity tool) working folder 362 | .mfractor/ 363 | 364 | # Local History for Visual Studio 365 | .localhistory/ 366 | 367 | # Visual Studio History (VSHistory) files 368 | .vshistory/ 369 | 370 | # BeatPulse healthcheck temp database 371 | healthchecksdb 372 | 373 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 374 | MigrationBackup/ 375 | 376 | # Ionide (cross platform F# VS Code tools) working folder 377 | .ionide/ 378 | 379 | # Fody - auto-generated XML schema 380 | FodyWeavers.xsd 381 | 382 | # VS Code files for those working on multiple tools 383 | .vscode/* 384 | !.vscode/settings.json 385 | !.vscode/tasks.json 386 | !.vscode/launch.json 387 | !.vscode/extensions.json 388 | *.code-workspace 389 | 390 | # Local History for Visual Studio Code 391 | .history/ 392 | 393 | # Windows Installer files from build outputs 394 | *.cab 395 | *.msi 396 | *.msix 397 | *.msm 398 | *.msp 399 | 400 | # JetBrains Rider 401 | *.sln.iml 402 | 403 | ## 404 | ## Visual studio for Mac 405 | ## 406 | 407 | 408 | # globs 409 | Makefile.in 410 | *.userprefs 411 | *.usertasks 412 | config.make 413 | config.status 414 | aclocal.m4 415 | install-sh 416 | autom4te.cache/ 417 | *.tar.gz 418 | tarballs/ 419 | test-results/ 420 | 421 | # Mac bundle stuff 422 | *.dmg 423 | *.app 424 | 425 | # content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore 426 | # General 427 | .DS_Store 428 | .AppleDouble 429 | .LSOverride 430 | 431 | # Icon must end with two \r 432 | Icon 433 | 434 | 435 | # Thumbnails 436 | ._* 437 | 438 | # Files that might appear in the root of a volume 439 | .DocumentRevisions-V100 440 | .fseventsd 441 | .Spotlight-V100 442 | .TemporaryItems 443 | .Trashes 444 | .VolumeIcon.icns 445 | .com.apple.timemachine.donotpresent 446 | 447 | # Directories potentially created on remote AFP share 448 | .AppleDB 449 | .AppleDesktop 450 | Network Trash Folder 451 | Temporary Items 452 | .apdisk 453 | 454 | # content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore 455 | # Windows thumbnail cache files 456 | Thumbs.db 457 | ehthumbs.db 458 | ehthumbs_vista.db 459 | 460 | # Dump file 461 | *.stackdump 462 | 463 | # Folder config file 464 | [Dd]esktop.ini 465 | 466 | # Recycle Bin used on file shares 467 | $RECYCLE.BIN/ 468 | 469 | # Windows Installer files 470 | *.cab 471 | *.msi 472 | *.msix 473 | *.msm 474 | *.msp 475 | 476 | # Windows shortcuts 477 | *.lnk 478 | 479 | # Ignore live unit testing config 480 | *.lutconfig 481 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/.template.config/template.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/template", 3 | "author": "Keboo", 4 | "classifications": [ 5 | "Common", 6 | "Avalonia" 7 | ], 8 | "identity": "Keboo.Avalonia.Solution", 9 | "name": "Keboo Avalonia Application", 10 | "shortName": "keboo.avalonia", 11 | "tags": { 12 | "language": "C#", 13 | "type": "solution" 14 | }, 15 | "preferNameDirectory":true, 16 | "sourceName": "SampleAvaloniaApplication", 17 | "symbols":{ 18 | "user_secrets_id":{ 19 | "type": "generated", 20 | "generator": "guid", 21 | "replaces": "12345678-9abc-0123-4567-890abcdef123", 22 | "parameters": { 23 | "defaultFormat":"d" 24 | } 25 | }, 26 | "no-sln": { 27 | "type": "parameter", 28 | "dataType":"bool", 29 | "defaultValue": "false" 30 | }, 31 | "no-tests": { 32 | "type": "parameter", 33 | "dataType":"bool", 34 | "defaultValue": "false" 35 | } 36 | }, 37 | "sources": [ 38 | { 39 | "modifiers": [ 40 | { 41 | "condition": "(no-sln)", 42 | "exclude": [ 43 | "SampleAvaloniaApplication.sln" 44 | ] 45 | }, 46 | { 47 | "condition": "(no-tests)", 48 | "exclude": [ 49 | "SampleAvaloniaApplication.Tests/*" 50 | ] 51 | } 52 | ] 53 | } 54 | ] 55 | } -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | enable 4 | enable 5 | 13 6 | true 7 | 8 | 9 | 14 | 15 | 12345678-9abc-0123-4567-890abcdef123 16 | 17 | 18 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/Directory.Build.targets: -------------------------------------------------------------------------------- 1 | 5 | 6 | 10 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/Directory.Packages.props: -------------------------------------------------------------------------------- 1 | 6 | 7 | 11 | 12 | 13 | true 14 | 15 | true 16 | 11.3.1 17 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/NuGet.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/README.md: -------------------------------------------------------------------------------- 1 | # Avalonia solution template 2 | This template creates a solution with all needed projects for an [Avalonia UI project](https://avaloniaui.net/). 3 | 4 | 5 | ## Template 6 | Create a new app in your current directory by running. 7 | 8 | ```cli 9 | > dotnet new keboo.avalonia 10 | ``` 11 | 12 | ### Parameters 13 | [Default template options](https://learn.microsoft.com/dotnet/core/tools/dotnet-new#options) 14 | 15 | ## Key Features 16 | 17 | ### Build Customization 18 | [Docs](https://learn.microsoft.com/visualstudio/msbuild/customize-by-directory?view=vs-2022&WT.mc_id=DT-MVP-5003472) 19 | 20 | ### Centralized Package Management 21 | [Docs](https://learn.microsoft.com/nuget/consume-packages/Central-Package-Management?WT.mc_id=DT-MVP-5003472) 22 | 23 | ### CommunityToolkit MVVM 24 | [Docs](https://learn.microsoft.com/dotnet/communitytoolkit/mvvm/?WT.mc_id=DT-MVP-5003472) 25 | 26 | ### NuGet package source mapping 27 | [Docs](https://learn.microsoft.com/nuget/consume-packages/package-source-mapping?WT.mc_id=DT-MVP-5003472) -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.Android/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Keboo/DotnetTemplates/13b93a4274369e67d52e1fa8527fe0f9a6d83df0/templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.Android/Icon.png -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.Android/MainActivity.cs: -------------------------------------------------------------------------------- 1 | using Android.App; 2 | using Android.Content.PM; 3 | 4 | using Avalonia; 5 | using Avalonia.Android; 6 | 7 | namespace SampleAvaloniaApplication.Android; 8 | 9 | [Activity( 10 | Label = "SampleAvaloniaApplication.Android", 11 | Theme = "@style/MyTheme.NoActionBar", 12 | Icon = "@drawable/icon", 13 | MainLauncher = true, 14 | ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)] 15 | public class MainActivity : AvaloniaMainActivity 16 | { 17 | protected override AppBuilder CustomizeAppBuilder(AppBuilder builder) 18 | { 19 | return base.CustomizeAppBuilder(builder) 20 | .WithInterFont(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.Android/Properties/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.Android/Resources/drawable/splash_screen.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.Android/Resources/values-night/colors.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | #212121 4 | 5 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.Android/Resources/values/colors.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | #FFFFFF 4 | 5 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.Android/Resources/values/styles.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.Android/SampleAvaloniaApplication.Android.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Exe 4 | net9.0-android 5 | 21 6 | com.CompanyName.SampleAvaloniaApplication 7 | 1 8 | 1.0 9 | apk 10 | False 11 | 12 | 13 | 14 | 15 | Resources\drawable\Icon.png 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.Browser/Program.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Versioning; 2 | 3 | using Avalonia; 4 | using Avalonia.Browser; 5 | 6 | using SampleAvaloniaApplication; 7 | 8 | [assembly: SupportedOSPlatform("browser")] 9 | 10 | internal partial class Program 11 | { 12 | private static async Task Main(string[] args) => await BuildAvaloniaApp() 13 | .WithInterFont() 14 | .StartBrowserAppAsync("out"); 15 | 16 | public static AppBuilder BuildAvaloniaApp() 17 | => AppBuilder.Configure(); 18 | } 19 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.Browser/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | [assembly:System.Runtime.Versioning.SupportedOSPlatform("browser")] 2 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.Browser/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "SampleAvaloniaApplication.Browser": { 4 | "commandName": "Project", 5 | "launchBrowser": true, 6 | "environmentVariables": { 7 | "ASPNETCORE_ENVIRONMENT": "Development" 8 | }, 9 | "applicationUrl": "https://localhost:5169;http://localhost:5269", 10 | "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.Browser/SampleAvaloniaApplication.Browser.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net9.0-browser 4 | Exe 5 | true 6 | 12 | true 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.Browser/runtimeconfig.template.json: -------------------------------------------------------------------------------- 1 | { 2 | "wasmHostProperties": { 3 | "perHostConfig": [ 4 | { 5 | "name": "browser", 6 | "host": "browser" 7 | } 8 | ] 9 | } 10 | } -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.Browser/wwwroot/app.css: -------------------------------------------------------------------------------- 1 | /* HTML styles for the splash screen */ 2 | .avalonia-splash { 3 | position: absolute; 4 | height: 100%; 5 | width: 100%; 6 | background: white; 7 | font-family: 'Outfit', sans-serif; 8 | justify-content: center; 9 | align-items: center; 10 | display: flex; 11 | pointer-events: none; 12 | } 13 | 14 | /* Light theme styles */ 15 | @media (prefers-color-scheme: light) { 16 | .avalonia-splash { 17 | background: white; 18 | } 19 | 20 | .avalonia-splash h2 { 21 | color: #1b2a4e; 22 | } 23 | 24 | .avalonia-splash a { 25 | color: #0D6EFD; 26 | } 27 | } 28 | 29 | @media (prefers-color-scheme: dark) { 30 | .avalonia-splash { 31 | background: #1b2a4e; 32 | } 33 | 34 | .avalonia-splash h2 { 35 | color: white; 36 | } 37 | 38 | .avalonia-splash a { 39 | color: white; 40 | } 41 | } 42 | 43 | .avalonia-splash h2 { 44 | font-weight: 400; 45 | font-size: 1.5rem; 46 | } 47 | 48 | .avalonia-splash a { 49 | text-decoration: none; 50 | font-size: 2.5rem; 51 | display: block; 52 | } 53 | 54 | .avalonia-splash.splash-close { 55 | transition: opacity 200ms, display 200ms; 56 | display: none; 57 | opacity: 0; 58 | } 59 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.Browser/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Keboo/DotnetTemplates/13b93a4274369e67d52e1fa8527fe0f9a6d83df0/templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.Browser/wwwroot/favicon.ico -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.Browser/wwwroot/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SampleAvaloniaApplication 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 32 |
33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.Browser/wwwroot/main.js: -------------------------------------------------------------------------------- 1 | import { dotnet } from './_framework/dotnet.js' 2 | 3 | const is_browser = typeof window != "undefined"; 4 | if (!is_browser) throw new Error(`Expected to be running in a browser`); 5 | 6 | const dotnetRuntime = await dotnet 7 | .withDiagnosticTracing(false) 8 | .withApplicationArgumentsFromQuery() 9 | .create(); 10 | 11 | const config = dotnetRuntime.getConfig(); 12 | 13 | await dotnetRuntime.runMain(config.mainAssemblyName, [globalThis.location.href]); 14 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.Desktop/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Avalonia; 4 | 5 | namespace SampleAvaloniaApplication.Desktop; 6 | 7 | class Program 8 | { 9 | // Initialization code. Don't use any Avalonia, third-party APIs or any 10 | // SynchronizationContext-reliant code before AppMain is called: things aren't initialized 11 | // yet and stuff might break. 12 | [STAThread] 13 | public static void Main(string[] args) => BuildAvaloniaApp() 14 | .StartWithClassicDesktopLifetime(args); 15 | 16 | // Avalonia configuration, don't remove; also used by visual designer. 17 | public static AppBuilder BuildAvaloniaApp() 18 | => AppBuilder.Configure() 19 | .UsePlatformDetect() 20 | .WithInterFont() 21 | .LogToTrace(); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.Desktop/SampleAvaloniaApplication.Desktop.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | WinExe 4 | 8 | net9.0 9 | true 10 | app.manifest 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.Desktop/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 6 | 7 | 8 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.iOS/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using Avalonia; 2 | using Avalonia.iOS; 3 | 4 | using Foundation; 5 | 6 | namespace SampleAvaloniaApplication.iOS; 7 | 8 | // The UIApplicationDelegate for the application. This class is responsible for launching the 9 | // User Interface of the application, as well as listening (and optionally responding) to 10 | // application events from iOS. 11 | [Register("AppDelegate")] 12 | public partial class AppDelegate : AvaloniaAppDelegate 13 | { 14 | protected override AppBuilder CustomizeAppBuilder(AppBuilder builder) 15 | { 16 | return base.CustomizeAppBuilder(builder) 17 | .WithInterFont(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.iOS/Entitlements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDisplayName 6 | SampleAvaloniaApplication 7 | CFBundleIdentifier 8 | companyName.SampleAvaloniaApplication 9 | CFBundleShortVersionString 10 | 1.0 11 | CFBundleVersion 12 | 1.0 13 | LSRequiresIPhoneOS 14 | 15 | MinimumOSVersion 16 | 10.0 17 | UIDeviceFamily 18 | 19 | 1 20 | 2 21 | 22 | UILaunchStoryboardName 23 | LaunchScreen 24 | UIRequiredDeviceCapabilities 25 | 26 | armv7 27 | 28 | UISupportedInterfaceOrientations 29 | 30 | UIInterfaceOrientationPortrait 31 | UIInterfaceOrientationPortraitUpsideDown 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIStatusBarHidden 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.iOS/Main.cs: -------------------------------------------------------------------------------- 1 | using UIKit; 2 | 3 | namespace SampleAvaloniaApplication.iOS; 4 | 5 | public class Application 6 | { 7 | // This is the main entry point of the application. 8 | static void Main(string[] args) 9 | { 10 | // if you want to use a different Application Delegate class from "AppDelegate" 11 | // you can specify it here. 12 | UIApplication.Main(args, null, typeof(AppDelegate)); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.iOS/Resources/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 21 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.iOS/SampleAvaloniaApplication.iOS.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Exe 4 | net9.0-ios 5 | 10.0 6 | manual 7 | iossimulator-x64 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.10.34707.107 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleAvaloniaApplication", "SampleAvaloniaApplication\SampleAvaloniaApplication.csproj", "{468FB281-79A9-4C1F-9EA7-080DF4E4ECAF}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleAvaloniaApplication.Android", "SampleAvaloniaApplication.Android\SampleAvaloniaApplication.Android.csproj", "{1B4914BF-CE72-4BA5-B7B4-C41C09E74F51}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleAvaloniaApplication.Desktop", "SampleAvaloniaApplication.Desktop\SampleAvaloniaApplication.Desktop.csproj", "{E44C3839-DDFE-4DA3-BC06-796CEC9AC8B9}" 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleAvaloniaApplication.iOS", "SampleAvaloniaApplication.iOS\SampleAvaloniaApplication.iOS.csproj", "{F9460ABD-ED52-4001-A2F1-03FFCF915C47}" 13 | EndProject 14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleAvaloniaApplication.Browser", "SampleAvaloniaApplication.Browser\SampleAvaloniaApplication.Browser.csproj", "{76A3BFA3-4B1E-46B5-8BAA-BA558B258EAD}" 15 | EndProject 16 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2805EDF0-22F4-4F54-BE47-1212AB3BC273}" 17 | ProjectSection(SolutionItems) = preProject 18 | .editorconfig = .editorconfig 19 | .gitignore = .gitignore 20 | Directory.Build.props = Directory.Build.props 21 | Directory.Build.targets = Directory.Build.targets 22 | Directory.Packages.props = Directory.Packages.props 23 | exclusions.dic = exclusions.dic 24 | NuGet.config = NuGet.config 25 | Settings.XamlStyler = Settings.XamlStyler 26 | EndProjectSection 27 | EndProject 28 | Global 29 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 30 | Debug|Any CPU = Debug|Any CPU 31 | Release|Any CPU = Release|Any CPU 32 | EndGlobalSection 33 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 34 | {468FB281-79A9-4C1F-9EA7-080DF4E4ECAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 35 | {468FB281-79A9-4C1F-9EA7-080DF4E4ECAF}.Debug|Any CPU.Build.0 = Debug|Any CPU 36 | {468FB281-79A9-4C1F-9EA7-080DF4E4ECAF}.Release|Any CPU.ActiveCfg = Release|Any CPU 37 | {468FB281-79A9-4C1F-9EA7-080DF4E4ECAF}.Release|Any CPU.Build.0 = Release|Any CPU 38 | {1B4914BF-CE72-4BA5-B7B4-C41C09E74F51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 39 | {1B4914BF-CE72-4BA5-B7B4-C41C09E74F51}.Debug|Any CPU.Build.0 = Debug|Any CPU 40 | {1B4914BF-CE72-4BA5-B7B4-C41C09E74F51}.Debug|Any CPU.Deploy.0 = Debug|Any CPU 41 | {1B4914BF-CE72-4BA5-B7B4-C41C09E74F51}.Release|Any CPU.ActiveCfg = Release|Any CPU 42 | {1B4914BF-CE72-4BA5-B7B4-C41C09E74F51}.Release|Any CPU.Build.0 = Release|Any CPU 43 | {1B4914BF-CE72-4BA5-B7B4-C41C09E74F51}.Release|Any CPU.Deploy.0 = Release|Any CPU 44 | {E44C3839-DDFE-4DA3-BC06-796CEC9AC8B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 45 | {E44C3839-DDFE-4DA3-BC06-796CEC9AC8B9}.Debug|Any CPU.Build.0 = Debug|Any CPU 46 | {E44C3839-DDFE-4DA3-BC06-796CEC9AC8B9}.Release|Any CPU.ActiveCfg = Release|Any CPU 47 | {E44C3839-DDFE-4DA3-BC06-796CEC9AC8B9}.Release|Any CPU.Build.0 = Release|Any CPU 48 | {F9460ABD-ED52-4001-A2F1-03FFCF915C47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 49 | {F9460ABD-ED52-4001-A2F1-03FFCF915C47}.Debug|Any CPU.Build.0 = Debug|Any CPU 50 | {F9460ABD-ED52-4001-A2F1-03FFCF915C47}.Debug|Any CPU.Deploy.0 = Debug|Any CPU 51 | {F9460ABD-ED52-4001-A2F1-03FFCF915C47}.Release|Any CPU.ActiveCfg = Release|Any CPU 52 | {F9460ABD-ED52-4001-A2F1-03FFCF915C47}.Release|Any CPU.Build.0 = Release|Any CPU 53 | {F9460ABD-ED52-4001-A2F1-03FFCF915C47}.Release|Any CPU.Deploy.0 = Release|Any CPU 54 | {76A3BFA3-4B1E-46B5-8BAA-BA558B258EAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 55 | {76A3BFA3-4B1E-46B5-8BAA-BA558B258EAD}.Debug|Any CPU.Build.0 = Debug|Any CPU 56 | {76A3BFA3-4B1E-46B5-8BAA-BA558B258EAD}.Release|Any CPU.ActiveCfg = Release|Any CPU 57 | {76A3BFA3-4B1E-46B5-8BAA-BA558B258EAD}.Release|Any CPU.Build.0 = Release|Any CPU 58 | EndGlobalSection 59 | GlobalSection(SolutionProperties) = preSolution 60 | HideSolutionNode = FALSE 61 | EndGlobalSection 62 | GlobalSection(ExtensibilityGlobals) = postSolution 63 | SolutionGuid = {7005BBD9-1CF6-41F6-AA5D-DF3918043818} 64 | EndGlobalSection 65 | EndGlobal 66 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication/App.axaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication/App.axaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Avalonia; 4 | using Avalonia.Controls.ApplicationLifetimes; 5 | using Avalonia.Data.Core.Plugins; 6 | using Avalonia.Markup.Xaml; 7 | 8 | using Microsoft.Extensions.DependencyInjection; 9 | 10 | using SampleAvaloniaApplication.ViewModels; 11 | using SampleAvaloniaApplication.Views; 12 | 13 | namespace SampleAvaloniaApplication; 14 | public partial class App : Application 15 | { 16 | private IServiceProvider _serviceProvider = null!; 17 | 18 | public override void Initialize() 19 | { 20 | AvaloniaXamlLoader.Load(this); 21 | } 22 | 23 | public override void OnFrameworkInitializationCompleted() 24 | { 25 | // Avoid duplicate validations from both Avalonia and the CommunityToolkit. 26 | // More info: https://docs.avaloniaui.net/docs/guides/development-guides/data-validation#manage-validationplugins 27 | DisableAvaloniaDataAnnotationValidation(); 28 | 29 | // Register all the services needed for the application to run 30 | var services = new ServiceCollection(); 31 | services.AddServices(); 32 | 33 | // Creates a ServiceProvider containing services from the provided IServiceCollection 34 | _serviceProvider = services.BuildServiceProvider(); 35 | 36 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) 37 | { 38 | desktop.MainWindow = _serviceProvider.GetRequiredService(); 39 | } 40 | else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform) 41 | { 42 | singleViewPlatform.MainView = _serviceProvider.GetRequiredService(); 43 | } 44 | 45 | base.OnFrameworkInitializationCompleted(); 46 | } 47 | 48 | private void DisableAvaloniaDataAnnotationValidation() 49 | { 50 | // Get an array of plugins to remove 51 | var dataValidationPluginsToRemove = 52 | BindingPlugins.DataValidators.OfType().ToArray(); 53 | 54 | // remove each entry found 55 | foreach (var plugin in dataValidationPluginsToRemove) 56 | { 57 | BindingPlugins.DataValidators.Remove(plugin); 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication/Assets/avalonia-logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Keboo/DotnetTemplates/13b93a4274369e67d52e1fa8527fe0f9a6d83df0/templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication/Assets/avalonia-logo.ico -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication/SampleAvaloniaApplication.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net9.0 4 | true 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication/ServiceCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using Avalonia.Controls.ApplicationLifetimes; 2 | using Avalonia.Controls; 3 | using Avalonia.Threading; 4 | 5 | using Microsoft.Extensions.DependencyInjection; 6 | using Avalonia; 7 | using SampleAvaloniaApplication.Views; 8 | using SampleAvaloniaApplication.ViewModels; 9 | 10 | namespace SampleAvaloniaApplication; 11 | 12 | public static class ServiceCollectionExtensions 13 | { 14 | public static void AddServices(this IServiceCollection services) 15 | { 16 | services.AddAvaloniaServices(); 17 | services.AddViews(); 18 | } 19 | 20 | private static void AddAvaloniaServices(this IServiceCollection services) 21 | { 22 | services.AddSingleton(_ => Dispatcher.UIThread); 23 | services.AddSingleton(_ => Application.Current?.ApplicationLifetime ?? throw new InvalidOperationException("No application lifetime is set")); 24 | 25 | services.AddSingleton(sp => 26 | sp.GetRequiredService() switch 27 | { 28 | IClassicDesktopStyleApplicationLifetime desktop => desktop.MainWindow ?? throw new InvalidOperationException("No main window set"), 29 | ISingleViewApplicationLifetime singleViewPlatform => TopLevel.GetTopLevel(singleViewPlatform.MainView) ?? throw new InvalidOperationException("Could not find top level element for single view"), 30 | _ => throw new InvalidOperationException($"Could not find {nameof(TopLevel)} element"), 31 | } 32 | ); 33 | 34 | services.AddSingleton(sp => sp.GetRequiredService().StorageProvider); 35 | } 36 | 37 | private static void AddViews(this IServiceCollection services) 38 | { 39 | //NB: Window is only needed for Desktop 40 | services.AddTransient(); 41 | 42 | services.AddView(); 43 | } 44 | 45 | private static void AddView(this IServiceCollection services) 46 | where TView : class 47 | where TViewModel : class 48 | { 49 | services.AddTransient(); 50 | services.AddTransient(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication/ViewModels/MainViewModel.cs: -------------------------------------------------------------------------------- 1 | using CommunityToolkit.Mvvm.ComponentModel; 2 | using CommunityToolkit.Mvvm.Input; 3 | 4 | namespace SampleAvaloniaApplication.ViewModels; 5 | 6 | public partial class MainViewModel : ObservableObject 7 | { 8 | public string Greeting => "Welcome to Avalonia!"; 9 | 10 | [ObservableProperty] 11 | private int _counter; 12 | 13 | [RelayCommand] 14 | public void Increment() => Counter++; 15 | } 16 | -------------------------------------------------------------------------------- /templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication/Views/MainView.axaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |