├── .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 |
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 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication/Views/MainView.axaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 |
3 | using SampleAvaloniaApplication.ViewModels;
4 |
5 | namespace SampleAvaloniaApplication.Views;
6 |
7 | public partial class MainView : UserControl
8 | {
9 | // This constructor is used when the view is created by the XAML Previewer
10 | public MainView()
11 | {
12 | InitializeComponent();
13 | }
14 |
15 | // This constructor is used when the view is created via dependency injection
16 | public MainView(MainViewModel viewModel)
17 | : this()
18 | {
19 | DataContext = viewModel;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication/Views/MainWindow.axaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
--------------------------------------------------------------------------------
/templates/Avalonia/AvaloniaSolution/SampleAvaloniaApplication/Views/MainWindow.axaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 |
3 | namespace SampleAvaloniaApplication.Views;
4 |
5 | public partial class MainWindow : Window
6 | {
7 | // This constructor is used when the view is created by the XAML Previewer
8 | public MainWindow()
9 | {
10 | InitializeComponent();
11 | }
12 |
13 | // This constructor is used when the view is created via dependency injection
14 | public MainWindow(MainView mainView)
15 | : this()
16 | {
17 | Content = mainView;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/templates/Avalonia/AvaloniaSolution/Settings.XamlStyler:
--------------------------------------------------------------------------------
1 | {
2 | "IndentSize": 2,
3 | "AttributesTolerance": 2,
4 | "KeepFirstAttributeOnSameLine": true,
5 | "MaxAttributeCharactersPerLine": 0,
6 | "MaxAttributesPerLine": 1,
7 | "NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransform, SkewTransform, RotateTransform, TranslateTransform, Trigger, MultiTrigger, DataTrigger, MultiDataTrigger, Condition, Setter, SolidColorBrush, Pen",
8 | "SeparateByGroups": false,
9 | "AttributeIndentation": 0,
10 | "AttributeIndentationStyle": "Spaces",
11 | "RemoveDesignTimeReferences": false,
12 | "EnableAttributeReordering": true,
13 | "AttributeOrderingRuleGroups": [
14 | "x:Class",
15 | "xmlns, xmlns:x",
16 | "xmlns:*",
17 | "x:Key, Key, x:Name, Name, x:Uid, Uid, Title",
18 | "Grid.Row, Grid.RowSpan, Grid.Column, Grid.ColumnSpan, Canvas.Left, Canvas.Top, Canvas.Right, Canvas.Bottom",
19 | "Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight",
20 | "Margin, Padding, HorizontalAlignment, VerticalAlignment, HorizontalContentAlignment, VerticalContentAlignment, Panel.ZIndex",
21 | "*:*, *",
22 | "PageSource, PageIndex, Offset, Color, TargetName, Property, Value, StartPoint, EndPoint",
23 | "*:Freeze, mc:Ignorable, d:IsDataSource, d:LayoutOverrides, d:IsStaticText",
24 | "Storyboard.*, From, To, Duration",
25 | "TargetType",
26 | "BasedOn"
27 | ],
28 | "FirstLineAttributes": "",
29 | "OrderAttributesByName": true,
30 | "PutEndingBracketOnNewLine": false,
31 | "RemoveEndingTagOfEmptyElement": true,
32 | "SpaceBeforeClosingSlash": true,
33 | "RootElementLineBreakRule": "Always",
34 | "ReorderVSM": "First",
35 | "ReorderGridChildren": false,
36 | "ReorderCanvasChildren": false,
37 | "ReorderSetters": "TargetNameThenProperty",
38 | "FormatMarkupExtension": true,
39 | "NoNewLineMarkupExtensions": "x:Bind, Binding, TemplateBinding, x:Static, DynamicResource, ComponentResourceKey, iconPacks:Modern, iconPacks:Material",
40 | "ThicknessSeparator": "Comma",
41 | "ThicknessAttributes": "Margin, Padding, BorderThickness, ThumbnailClipMargin",
42 | "FormatOnSave": false,
43 | "CommentPadding": 1
44 | }
45 |
--------------------------------------------------------------------------------
/templates/Avalonia/AvaloniaSolution/exclusions.dic:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Keboo/DotnetTemplates/13b93a4274369e67d52e1fa8527fe0f9a6d83df0/templates/Avalonia/AvaloniaSolution/exclusions.dic
--------------------------------------------------------------------------------
/templates/Console/ConsoleApp/.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: "nuget" # See documentation for possible values
9 | directory: "/" # Location of package manifests
10 | schedule:
11 | interval: "weekly"
12 |
13 | - package-ecosystem: "github-actions" # See documentation for possible values
14 | directory: "/" # Location of package manifests
15 | schedule:
16 | interval: "weekly"
17 |
--------------------------------------------------------------------------------
/templates/Console/ConsoleApp/.github/workflows/build-and-deploy.yml:
--------------------------------------------------------------------------------
1 | name: Build and deploy
2 |
3 | on:
4 | push:
5 | branches: [ main ]
6 | pull_request:
7 | branches: [ main ]
8 | workflow_dispatch:
9 |
10 | defaults:
11 | run:
12 | shell: pwsh
13 |
14 | jobs:
15 | build:
16 | runs-on: ubuntu-latest
17 |
18 | steps:
19 | - uses: actions/checkout@v4
20 |
21 | - name: Set up .NET Core
22 | uses: actions/setup-dotnet@v4
23 | with:
24 | dotnet-version: '8.x'
25 |
26 | - name: dotnet restore
27 | run: dotnet restore
28 |
29 | - name: dotnet build
30 | run: dotnet build --configuration Release --no-restore
31 |
32 | - name: dotnet test
33 | run: dotnet test --configuration Release --no-build --collect:"XPlat Code Coverage" --results-directory ./code-coverage
34 |
35 | - name: ReportGenerator
36 | uses: danielpalme/ReportGenerator-GitHub-Action@5.4.7
37 | with:
38 | reports: code-coverage/**/coverage.cobertura.xml
39 | targetdir: coveragereport
40 | reporttypes: Html;MarkdownSummaryGithub
41 | title: 'Code Coverage'
42 |
43 | - name: Write PR Number
44 | if: ${{ github.event_name == 'pull_request' }}
45 | run: |
46 | echo ${{ github.event.number }} > ./coveragereport/PullRequestNumber
47 |
48 | - name: Upload Code Coverage Report
49 | uses: actions/upload-artifact@v4
50 | with:
51 | name: CodeCoverage
52 | path: coveragereport/
53 | if-no-files-found: error
54 |
55 | - name: dotnet pack
56 | run: dotnet pack --configuration Release --no-build -o ./NuGet
57 |
58 | - name: Upload NuGet artifact
59 | uses: actions/upload-artifact@v4
60 | with:
61 | name: NuGet
62 | path: ./NuGet
63 |
64 | automerge:
65 | if: ${{ github.event_name == 'pull_request' }}
66 | runs-on: ubuntu-latest
67 |
68 | permissions:
69 | pull-requests: write
70 | contents: write
71 |
72 | steps:
73 | - uses: fastify/github-action-merge-dependabot@v3.11.1
74 | with:
75 | use-github-auto-merge: true
76 |
77 | deploy-nuget:
78 | if: ${{ github.event_name != 'pull_request' }}
79 | runs-on: ubuntu-latest
80 | needs: build
81 |
82 | steps:
83 | - name: Download artifact from build job
84 | uses: actions/download-artifact@v4
85 | with:
86 | name: NuGet
87 |
88 | - name: Push NuGet
89 | run: dotnet nuget push ${{ github.workspace }}/*nupkg --source https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }} --skip-duplicate
90 |
--------------------------------------------------------------------------------
/templates/Console/ConsoleApp/.github/workflows/pr-code-coverage-comment.yml:
--------------------------------------------------------------------------------
1 | name: Post Code Coverage on Pull Request
2 |
3 | on:
4 | workflow_run:
5 | workflows: [Build and deploy]
6 | types:
7 | - completed
8 |
9 | defaults:
10 | run:
11 | shell: pwsh
12 |
13 | jobs:
14 | post-code-coverage:
15 | runs-on: ubuntu-latest
16 | if: >
17 | github.event.workflow_run.event == 'pull_request' &&
18 | github.event.workflow_run.conclusion == 'success'
19 | steps:
20 | - name: Download artifacts
21 | run: gh run download ${{ github.event.workflow_run.id }} -n CodeCoverage --repo ${{ github.repository }}
22 | env:
23 | GH_TOKEN: ${{ github.token }}
24 |
25 | - name: 'Get PR Number'
26 | id: get-pr-number
27 | run: |
28 | $pr_number = (cat PullRequestNumber)
29 | "pr_number=$pr_number" >> $env:GITHUB_OUTPUT
30 |
31 | - uses: marocchino/sticky-pull-request-comment@v2
32 | with:
33 | recreate: true
34 | number: ${{ steps.get-pr-number.outputs.pr_number }}
35 | path: SummaryGithub.md
--------------------------------------------------------------------------------
/templates/Console/ConsoleApp/.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/Console/ConsoleApp/.template.config/template.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/template",
3 | "author": "Keboo",
4 | "classifications": [
5 | "Common",
6 | "CommandLine"
7 | ],
8 | "identity": "Keboo.Console.ConsoleApp",
9 | "name": "Keboo CLI Application",
10 | "shortName": "keboo.console",
11 | "tags": {
12 | "language": "C#",
13 | "type": "solution"
14 | },
15 | "preferNameDirectory":true,
16 | "sourceName": "ConsoleApp",
17 | "symbols":{
18 | "createdDate": {
19 | "type": "generated",
20 | "generator": "now",
21 | "parameters": {
22 | "format": "yyyy"
23 | },
24 | "replaces":"1970"
25 | },
26 | "user_secrets_id":{
27 | "type": "generated",
28 | "generator": "guid",
29 | "replaces": "12345678-9abc-0123-4567-890abcdef123",
30 | "parameters": {
31 | "defaultFormat":"d"
32 | }
33 | },
34 | "no-sln": {
35 | "type": "parameter",
36 | "dataType":"bool",
37 | "defaultValue": "false"
38 | },
39 | "no-tests": {
40 | "type": "parameter",
41 | "dataType":"bool",
42 | "defaultValue": "false"
43 | }
44 | },
45 | "sources": [
46 | {
47 | "modifiers": [
48 | {
49 | "condition": "(no-sln)",
50 | "exclude": [
51 | "ConsoleApp.sln"
52 | ]
53 | },
54 | {
55 | "condition": "(no-tests)",
56 | "exclude": [
57 | "ConsoleApp.Tests/*"
58 | ]
59 | }
60 | ]
61 | }
62 | ]
63 | }
--------------------------------------------------------------------------------
/templates/Console/ConsoleApp/ConsoleApp.Tests/ConsoleApp.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 |
6 | false
7 |
8 |
9 |
10 |
11 | all
12 | runtime; build; native; contentfiles; analyzers; buildtransitive
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | all
21 | runtime; build; native; contentfiles; analyzers; buildtransitive
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/templates/Console/ConsoleApp/ConsoleApp.Tests/ProgramTests.cs:
--------------------------------------------------------------------------------
1 | using System.CommandLine;
2 |
3 | namespace ConsoleApp.Tests;
4 |
5 | public class ProgramTests
6 | {
7 | [Fact]
8 | public async Task Invoke_WithHelpOption_DisplaysHelp()
9 | {
10 | using StringWriter stdOut = new();
11 | int exitCode = await Invoke("--help", stdOut);
12 |
13 | Assert.Equal(0, exitCode);
14 | Assert.Contains("--help", stdOut.ToString());
15 | }
16 |
17 | [Fact]
18 | public async Task Invoke_AddWithTwoNumbers_DisplaysResult()
19 | {
20 | using StringWriter stdOut = new();
21 | int exitCode = await Invoke("add 4 2", stdOut);
22 |
23 | Assert.Equal(0, exitCode);
24 | Assert.Contains("The result is 6", stdOut.ToString());
25 | }
26 |
27 | private static Task Invoke(string commandLine, StringWriter console)
28 | {
29 | CliConfiguration configuration = Program.GetConfiguration();
30 | configuration.Output = console;
31 | return configuration.InvokeAsync(commandLine);
32 | }
33 | }
--------------------------------------------------------------------------------
/templates/Console/ConsoleApp/ConsoleApp.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.0.31903.59
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp", "ConsoleApp\ConsoleApp.csproj", "{55D459AD-9D92-4A4A-ADAB-D0143BA39451}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp.Tests", "ConsoleApp.Tests\ConsoleApp.Tests.csproj", "{E0A57BAE-FFD5-46A6-9A93-33DF9195362B}"
9 | EndProject
10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D88D7F20-19C5-42B4-8561-874CC78B134A}"
11 | ProjectSection(SolutionItems) = preProject
12 | .editorconfig = .editorconfig
13 | Directory.Build.props = Directory.Build.props
14 | Directory.Build.targets = Directory.Build.targets
15 | Directory.Packages.props = Directory.Packages.props
16 | exclusions.dic = exclusions.dic
17 | NuGet.config = NuGet.config
18 | EndProjectSection
19 | EndProject
20 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{6E32D310-8A68-4061-82C9-4A0040537448}"
21 | ProjectSection(SolutionItems) = preProject
22 | .github\dependabot.yml = .github\dependabot.yml
23 | EndProjectSection
24 | EndProject
25 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{D73E76B4-8613-4EF2-A925-0766B9E8B02C}"
26 | ProjectSection(SolutionItems) = preProject
27 | .github\workflows\build-and-deploy.yml = .github\workflows\build-and-deploy.yml
28 | .github\workflows\pr-code-coverage-comment.yml = .github\workflows\pr-code-coverage-comment.yml
29 | EndProjectSection
30 | EndProject
31 | Global
32 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
33 | Debug|Any CPU = Debug|Any CPU
34 | Release|Any CPU = Release|Any CPU
35 | EndGlobalSection
36 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
37 | {55D459AD-9D92-4A4A-ADAB-D0143BA39451}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
38 | {55D459AD-9D92-4A4A-ADAB-D0143BA39451}.Debug|Any CPU.Build.0 = Debug|Any CPU
39 | {55D459AD-9D92-4A4A-ADAB-D0143BA39451}.Release|Any CPU.ActiveCfg = Release|Any CPU
40 | {55D459AD-9D92-4A4A-ADAB-D0143BA39451}.Release|Any CPU.Build.0 = Release|Any CPU
41 | {E0A57BAE-FFD5-46A6-9A93-33DF9195362B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
42 | {E0A57BAE-FFD5-46A6-9A93-33DF9195362B}.Debug|Any CPU.Build.0 = Debug|Any CPU
43 | {E0A57BAE-FFD5-46A6-9A93-33DF9195362B}.Release|Any CPU.ActiveCfg = Release|Any CPU
44 | {E0A57BAE-FFD5-46A6-9A93-33DF9195362B}.Release|Any CPU.Build.0 = Release|Any CPU
45 | EndGlobalSection
46 | GlobalSection(SolutionProperties) = preSolution
47 | HideSolutionNode = FALSE
48 | EndGlobalSection
49 | GlobalSection(NestedProjects) = preSolution
50 | {6E32D310-8A68-4061-82C9-4A0040537448} = {D88D7F20-19C5-42B4-8561-874CC78B134A}
51 | {D73E76B4-8613-4EF2-A925-0766B9E8B02C} = {6E32D310-8A68-4061-82C9-4A0040537448}
52 | EndGlobalSection
53 | GlobalSection(ExtensibilityGlobals) = postSolution
54 | SolutionGuid = {DF353750-2089-4072-9508-65E9DC66DF2D}
55 | EndGlobalSection
56 | EndGlobal
57 |
--------------------------------------------------------------------------------
/templates/Console/ConsoleApp/ConsoleApp/ConsoleApp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net8.0
6 | 0.0.1
7 |
8 |
9 |
13 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/templates/Console/ConsoleApp/ConsoleApp/Program.cs:
--------------------------------------------------------------------------------
1 | using System.CommandLine;
2 |
3 | namespace ConsoleApp;
4 |
5 | public sealed class Program
6 | {
7 | private static Task Main(string[] args)
8 | {
9 | CliConfiguration configuration = GetConfiguration();
10 | return configuration.InvokeAsync(args);
11 | }
12 |
13 | public static CliConfiguration GetConfiguration()
14 | {
15 | CliArgument number1 = new("number1")
16 | {
17 | Description = "The first number to add"
18 | };
19 | CliArgument number2 = new("number2")
20 | {
21 | Description = "The second number to add"
22 | };
23 | CliCommand addCommand = new("add", "Add two numbers together")
24 | {
25 | number1,
26 | number2
27 | };
28 | addCommand.SetAction((ParseResult parseResult) =>
29 | {
30 | int value1 = parseResult.CommandResult.GetValue(number1);
31 | int value2 = parseResult.CommandResult.GetValue(number2);
32 | int result = value1 + value2;
33 | parseResult.Configuration.Output.WriteLine($"The result is {result}");
34 | });
35 |
36 | CliRootCommand rootCommand = new("A starter console app by Keboo")
37 | {
38 | addCommand
39 | };
40 | return new CliConfiguration(rootCommand);
41 | }
42 | }
--------------------------------------------------------------------------------
/templates/Console/ConsoleApp/ConsoleApp/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "ConsoleApp": {
4 | "commandName": "Project"
5 | },
6 | "Display Help": {
7 | "commandName": "Project",
8 | "commandLineArgs": "--help"
9 | }
10 | }
11 | }
--------------------------------------------------------------------------------
/templates/Console/ConsoleApp/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
5 |
6 |
10 |
11 |
12 | enable
13 | enable
14 | 12
15 | true
16 |
17 |
21 |
22 |
23 |
24 |
29 |
30 | 12345678-9abc-0123-4567-890abcdef123
31 |
32 |
33 |
--------------------------------------------------------------------------------
/templates/Console/ConsoleApp/Directory.Build.targets:
--------------------------------------------------------------------------------
1 |
5 |
6 |
10 |
--------------------------------------------------------------------------------
/templates/Console/ConsoleApp/Directory.Packages.props:
--------------------------------------------------------------------------------
1 |
6 |
7 |
11 |
12 |
13 | true
14 |
15 | true
16 |
17 |
21 |
22 |
23 | runtime; build; native; contentfiles; analyzers; buildtransitive
24 | all
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | runtime; build; native; contentfiles; analyzers; buildtransitive
35 | all
36 |
37 |
38 |
--------------------------------------------------------------------------------
/templates/Console/ConsoleApp/NuGet.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/templates/Console/ConsoleApp/README.md:
--------------------------------------------------------------------------------
1 | # Command line app template
2 | This template creates a [System.CommandLine](https://github.com/dotnet/command-line-api) solution, along with unit tests.
3 |
4 |
5 | ## Template
6 | Create a new app in your current directory by running.
7 |
8 | ```cli
9 | > dotnet new keboo.console
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 | ### NuGet package source mapping
24 | [Docs](https://learn.microsoft.com/nuget/consume-packages/package-source-mapping?WT.mc_id=DT-MVP-5003472)
--------------------------------------------------------------------------------
/templates/Console/ConsoleApp/exclusions.dic:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Keboo/DotnetTemplates/13b93a4274369e67d52e1fa8527fe0f9a6d83df0/templates/Console/ConsoleApp/exclusions.dic
--------------------------------------------------------------------------------
/templates/Library/NuGet/.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: "nuget" # See documentation for possible values
9 | directory: "/" # Location of package manifests
10 | schedule:
11 | interval: "weekly"
12 | ignore:
13 | - dependency-name: "Microsoft.CodeAnalysis.Common"
14 | - dependency-name: "Microsoft.CodeAnalysis.CSharp"
15 |
16 | - package-ecosystem: "github-actions" # See documentation for possible values
17 | directory: "/" # Location of package manifests
18 | schedule:
19 | interval: "weekly"
20 |
--------------------------------------------------------------------------------
/templates/Library/NuGet/.github/workflows/build-and-deploy.yml:
--------------------------------------------------------------------------------
1 | name: Build and deploy
2 |
3 | on:
4 | push:
5 | branches: [ main ]
6 | pull_request:
7 | branches: [ main ]
8 | workflow_dispatch:
9 |
10 | defaults:
11 | run:
12 | shell: pwsh
13 |
14 | jobs:
15 | build:
16 | runs-on: ubuntu-latest
17 |
18 | steps:
19 | - uses: actions/checkout@v4
20 |
21 | - name: Set up .NET Core
22 | uses: actions/setup-dotnet@v4
23 | with:
24 | dotnet-version: '8.x'
25 | include-prerelease: true
26 |
27 | - name: dotnet restore
28 | run: dotnet restre --configuration Release
29 |
30 | - name: dotnet build
31 | run: dotnet build --configuration Release --no-restore
32 | #if (!no-tests)
33 | - name: dotnet test
34 | run: dotnet test --configuration Release --no-build --collect:"XPlat Code Coverage" --results-directory ./code-coverage
35 |
36 | - name: ReportGenerator
37 | uses: danielpalme/ReportGenerator-GitHub-Action@5.4.7
38 | with:
39 | reports: coverage/**/coverage.cobertura.xml
40 | targetdir: coveragereport
41 | reporttypes: Html;MarkdownSummaryGithub
42 | title: 'Code Coverage'
43 |
44 | - name: Write PR Number
45 | if: ${{ github.event_name == 'pull_request' }}
46 | run: |
47 | echo ${{ github.event.number }} > ./coveragereport/PullRequestNumber
48 |
49 | - name: Upload Code Coverage Report
50 | uses: actions/upload-artifact@v4
51 | with:
52 | name: CodeCoverage
53 | path: coveragereport/
54 | if-no-files-found: error
55 | #endif
56 |
57 | - name: dotnet pack
58 | run: dotnet pack --configuration Release --no-build -o .${{env.DOTNET_ROOT}}/NuGet
59 |
60 | - name: Upload NuGet artifact
61 | uses: actions/upload-artifact@v4
62 | with:
63 | name: NuGet
64 | path: ${{env.DOTNET_ROOT}}/NuGet
65 |
66 | automerge:
67 | if: ${{ github.event_name == 'pull_request' }}
68 | runs-on: ubuntu-latest
69 |
70 | permissions:
71 | pull-requests: write
72 | contents: write
73 |
74 | steps:
75 | - uses: fastify/github-action-merge-dependabot@v3.11.1
76 |
77 | deploy-nuget:
78 | if: ${{ github.event_name != 'pull_request' }}
79 | runs-on: ubuntu-latest
80 | needs: build
81 |
82 | steps:
83 | - name: Download artifact from build job
84 | uses: actions/download-artifact@v4
85 | with:
86 | name: NuGet
87 |
88 | - name: Push NuGet
89 | run: dotnet nuget push ${{ github.workspace }}/*nupkg --source https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }} --skip-duplicate
90 |
--------------------------------------------------------------------------------
/templates/Library/NuGet/.github/workflows/pr-code-coverage-comment.yml:
--------------------------------------------------------------------------------
1 | name: Post Code Coverage on Pull Request
2 |
3 | on:
4 | workflow_run:
5 | workflows: [Build and deploy]
6 | types:
7 | - completed
8 |
9 | defaults:
10 | run:
11 | shell: pwsh
12 |
13 | jobs:
14 | post-code-coverage:
15 | runs-on: ubuntu-latest
16 | if: >
17 | github.event.workflow_run.event == 'pull_request' &&
18 | github.event.workflow_run.conclusion == 'success'
19 | steps:
20 | - name: Download artifacts
21 | run: gh run download ${{ github.event.workflow_run.id }} -n CodeCoverage --repo ${{ github.repository }}
22 | env:
23 | GH_TOKEN: ${{ github.token }}
24 |
25 | - name: 'Get PR Number'
26 | id: get-pr-number
27 | run: |
28 | $pr_number = (cat PullRequestNumber)
29 | "pr_number=$pr_number" >> $env:GITHUB_OUTPUT
30 |
31 | - uses: marocchino/sticky-pull-request-comment@v2
32 | with:
33 | recreate: true
34 | number: ${{ steps.get-pr-number.outputs.pr_number }}
35 | path: SummaryGithub.md
--------------------------------------------------------------------------------
/templates/Library/NuGet/.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/Library/NuGet/.template.config/template.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/template",
3 | "author": "Keboo",
4 | "classifications": [
5 | "Common",
6 | "NuGet"
7 | ],
8 | "identity": "Keboo.Library.NuGet",
9 | "name": "Keboo Class Library for NuGet",
10 | "shortName": "keboo.nuget",
11 | "tags": {
12 | "language": "C#",
13 | "type": "solution"
14 | },
15 | "preferNameDirectory":true,
16 | "sourceName": "NuGetLib",
17 | "symbols":{
18 | "createdDate": {
19 | "type": "generated",
20 | "generator": "now",
21 | "parameters": {
22 | "format": "yyyy"
23 | },
24 | "replaces":"1970"
25 | },
26 | "user_secrets_id":{
27 | "type": "generated",
28 | "generator": "guid",
29 | "replaces": "12345678-9abc-0123-4567-890abcdef123",
30 | "parameters": {
31 | "defaultFormat":"d"
32 | }
33 | },
34 | "no-sln": {
35 | "type": "parameter",
36 | "dataType":"bool",
37 | "defaultValue": "false"
38 | },
39 | "no-tests": {
40 | "type": "parameter",
41 | "dataType":"bool",
42 | "defaultValue": "false"
43 | }
44 | },
45 | "sources": [
46 | {
47 | "modifiers": [
48 | {
49 | "condition": "(no-sln)",
50 | "exclude": [
51 | "NuGetLib.sln"
52 | ]
53 | },
54 | {
55 | "condition": "(no-tests)",
56 | "exclude": [
57 | "NuGetLib.Tests/*",
58 | ".github/.workflows/pr-code-coverage-comment.yml"
59 | ]
60 | }
61 | ]
62 | }
63 | ]
64 | }
--------------------------------------------------------------------------------
/templates/Library/NuGet/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
5 |
6 |
10 |
11 |
12 | enable
13 | enable
14 | 12
15 | true
16 |
20 |
21 |
22 |
23 |
28 |
29 | 12345678-9abc-0123-4567-890abcdef123
30 |
31 |
32 |
36 |
37 | CHANGEME: Keboo.NuGet
38 | CHANGEME: Keboo.Template
39 | CHANGEME: A library generated from Keboo's template. https://github.com/Keboo/DotnetTemplates
40 | Copyright © 1970-$([System.DateTime]::Now.ToString("yyyy"))
41 | MIT
42 |
43 | NuGetIcon.png
44 | https://github.com/CHANGEME_RepoOwner/CHANGEME_RepoName
45 |
46 |
47 | NuGetPackageReadme.md
48 | true
49 |
50 |
51 |
52 |
56 | snupkg
57 |
58 |
64 |
65 |
68 |
72 |
77 |
78 |
82 | true
83 | true
84 | true
85 | true
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/templates/Library/NuGet/Directory.Build.targets:
--------------------------------------------------------------------------------
1 |
5 |
6 |
10 |
--------------------------------------------------------------------------------
/templates/Library/NuGet/Directory.Packages.props:
--------------------------------------------------------------------------------
1 |
6 |
7 |
11 |
12 |
13 | true
14 |
15 | true
16 |
17 |
21 |
22 |
23 | runtime; build; native; contentfiles; analyzers; buildtransitive
24 | all
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | runtime; build; native; contentfiles; analyzers; buildtransitive
33 | all
34 |
35 |
36 |
--------------------------------------------------------------------------------
/templates/Library/NuGet/NuGet.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/templates/Library/NuGet/NuGetLib.Tests/Class1Tests.cs:
--------------------------------------------------------------------------------
1 | namespace NuGetLib.Tests;
2 |
3 | public class Class1Tests
4 | {
5 | [Fact]
6 | public void Method_WithPositiveValue_AddsOne()
7 | {
8 | //Arrange
9 | AutoMocker mocker = new();
10 |
11 | Class1 class1 = mocker.CreateInstance();
12 |
13 | //Act
14 | int result = class1.Method(41);
15 |
16 | //Assert
17 | Assert.Equal(42, result);
18 | }
19 | }
--------------------------------------------------------------------------------
/templates/Library/NuGet/NuGetLib.Tests/NuGetLib.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | false
6 | false
7 | true
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/templates/Library/NuGet/NuGetLib.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.0.31903.59
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NuGetLib", "NuGetLib\NuGetLib.csproj", "{A87CB29C-0A36-423F-B9B6-43053906A3CC}"
7 | EndProject
8 | #if (!no-tests)
9 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NuGetLib.Tests", "NuGetLib.Tests\NuGetLib.Tests.csproj", "{DF8F9490-887C-489E-AFE0-99518CC49ECF}"
10 | EndProject
11 | #endif
12 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{33332FBD-7EFF-4A3D-8691-21BF50B245A7}"
13 | ProjectSection(SolutionItems) = preProject
14 | .editorconfig = .editorconfig
15 | Directory.Build.props = Directory.Build.props
16 | Directory.Build.targets = Directory.Build.targets
17 | Directory.Packages.props = Directory.Packages.props
18 | NuGet.config = NuGet.config
19 | NuGetPackageReadme.md = NuGetPackageReadme.md
20 | EndProjectSection
21 | EndProject
22 | Global
23 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
24 | Debug|Any CPU = Debug|Any CPU
25 | Release|Any CPU = Release|Any CPU
26 | EndGlobalSection
27 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
28 | {A87CB29C-0A36-423F-B9B6-43053906A3CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29 | {A87CB29C-0A36-423F-B9B6-43053906A3CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
30 | {A87CB29C-0A36-423F-B9B6-43053906A3CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
31 | {A87CB29C-0A36-423F-B9B6-43053906A3CC}.Release|Any CPU.Build.0 = Release|Any CPU
32 | #if (!no-tests)
33 | {DF8F9490-887C-489E-AFE0-99518CC49ECF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
34 | {DF8F9490-887C-489E-AFE0-99518CC49ECF}.Debug|Any CPU.Build.0 = Debug|Any CPU
35 | {DF8F9490-887C-489E-AFE0-99518CC49ECF}.Release|Any CPU.ActiveCfg = Release|Any CPU
36 | {DF8F9490-887C-489E-AFE0-99518CC49ECF}.Release|Any CPU.Build.0 = Release|Any CPU
37 | #endif
38 | EndGlobalSection
39 | GlobalSection(SolutionProperties) = preSolution
40 | HideSolutionNode = FALSE
41 | EndGlobalSection
42 | EndGlobal
43 |
--------------------------------------------------------------------------------
/templates/Library/NuGet/NuGetLib/Class1.cs:
--------------------------------------------------------------------------------
1 | namespace NuGetLib;
2 | public class Class1
3 | {
4 | public int Method(int value)
5 | {
6 | return value + 1;
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/templates/Library/NuGet/NuGetLib/NuGetIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Keboo/DotnetTemplates/13b93a4274369e67d52e1fa8527fe0f9a6d83df0/templates/Library/NuGet/NuGetLib/NuGetIcon.png
--------------------------------------------------------------------------------
/templates/Library/NuGet/NuGetLib/NuGetLib.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 |
6 |
7 |
8 |
12 |
13 |
14 |
18 |
19 |
20 |
21 |
22 |
23 | all
24 | runtime; build; native; contentfiles; analyzers; buildtransitive
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/templates/Library/NuGet/NuGetPackageReadme.md:
--------------------------------------------------------------------------------
1 | # NuGetLib
2 |
3 | CHANGEME: A library generated from Keboo's template. https://github.com/Keboo/DotnetTemplates
4 |
--------------------------------------------------------------------------------
/templates/Library/NuGet/README.md:
--------------------------------------------------------------------------------
1 | # NuGet package template
2 | This template creates a solution for producing a NuGet package, along with unit tests.
3 |
4 |
5 | ## Template
6 | Create a new app in your current directory by running.
7 |
8 | ```cli
9 | > dotnet new keboo.nuget
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 | ### NuGet package source mapping
24 | [Docs](https://learn.microsoft.com/nuget/consume-packages/package-source-mapping?WT.mc_id=DT-MVP-5003472)
--------------------------------------------------------------------------------
/templates/Library/NuGet/exclusions.dic:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Keboo/DotnetTemplates/13b93a4274369e67d52e1fa8527fe0f9a6d83df0/templates/Library/NuGet/exclusions.dic
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | # All files
4 | [*]
5 | indent_style = space
6 |
7 | # Xaml files
8 | [*.xaml]
9 | indent_size = 2
10 |
11 | # MSBuild files
12 | [*.{csproj,targets,props}]
13 | indent_size = 2
14 |
15 | # Xml files
16 | [*.xml]
17 | indent_size = 2
18 |
19 | # C# files
20 | [*.cs]
21 |
22 | #### Core EditorConfig Options ####
23 |
24 | # Indentation and spacing
25 | indent_size = 4
26 | tab_width = 4
27 |
28 | # New line preferences
29 | end_of_line = crlf
30 | insert_final_newline = false
31 |
32 | #### .NET Coding Conventions ####
33 | [*.{cs,vb}]
34 |
35 | # Organize usings
36 | dotnet_separate_import_directive_groups = true
37 | dotnet_sort_system_directives_first = true
38 | file_header_template = unset
39 |
40 | # this. and Me. preferences
41 | dotnet_style_qualification_for_event = false:silent
42 | dotnet_style_qualification_for_field = false:silent
43 | dotnet_style_qualification_for_method = false:silent
44 | dotnet_style_qualification_for_property = false:silent
45 |
46 | # Language keywords vs BCL types preferences
47 | dotnet_style_predefined_type_for_locals_parameters_members = true:silent
48 | dotnet_style_predefined_type_for_member_access = true:silent
49 |
50 | # Parentheses preferences
51 | dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
52 | dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
53 | dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
54 | dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
55 |
56 | # Modifier preferences
57 | dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
58 |
59 | # Expression-level preferences
60 | dotnet_style_coalesce_expression = true:suggestion
61 | dotnet_style_collection_initializer = true:suggestion
62 | dotnet_style_explicit_tuple_names = true:suggestion
63 | dotnet_style_null_propagation = true:suggestion
64 | dotnet_style_object_initializer = true:suggestion
65 | dotnet_style_operator_placement_when_wrapping = beginning_of_line
66 | dotnet_style_prefer_auto_properties = true:suggestion
67 | dotnet_style_prefer_compound_assignment = true:suggestion
68 | dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
69 | dotnet_style_prefer_conditional_expression_over_return = true:suggestion
70 | dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
71 | dotnet_style_prefer_inferred_tuple_names = true:suggestion
72 | dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
73 | dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
74 | dotnet_style_prefer_simplified_interpolation = true:suggestion
75 |
76 | # Field preferences
77 | dotnet_style_readonly_field = true:warning
78 |
79 | # Parameter preferences
80 | dotnet_code_quality_unused_parameters = all:suggestion
81 |
82 | # Suppression preferences
83 | dotnet_remove_unnecessary_suppression_exclusions = none
84 |
85 | #### C# Coding Conventions ####
86 | [*.cs]
87 |
88 | # var preferences
89 | csharp_style_var_elsewhere = false:silent
90 | csharp_style_var_for_built_in_types = false:silent
91 | csharp_style_var_when_type_is_apparent = false:silent
92 |
93 | # Expression-bodied members
94 | csharp_style_expression_bodied_accessors = true:silent
95 | csharp_style_expression_bodied_constructors = false:silent
96 | csharp_style_expression_bodied_indexers = true:silent
97 | csharp_style_expression_bodied_lambdas = true:suggestion
98 | csharp_style_expression_bodied_local_functions = false:silent
99 | csharp_style_expression_bodied_methods = false:silent
100 | csharp_style_expression_bodied_operators = false:silent
101 | csharp_style_expression_bodied_properties = true:silent
102 |
103 | # Pattern matching preferences
104 | csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
105 | csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
106 | csharp_style_prefer_not_pattern = true:suggestion
107 | csharp_style_prefer_pattern_matching = true:silent
108 | csharp_style_prefer_switch_expression = true:suggestion
109 |
110 | # Null-checking preferences
111 | csharp_style_conditional_delegate_call = true:suggestion
112 |
113 | # Modifier preferences
114 | csharp_prefer_static_local_function = true:warning
115 | csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent
116 |
117 | # Code-block preferences
118 | csharp_prefer_braces = true:silent
119 | csharp_prefer_simple_using_statement = true:suggestion
120 |
121 | # Expression-level preferences
122 | csharp_prefer_simple_default_expression = true:suggestion
123 | csharp_style_deconstructed_variable_declaration = true:suggestion
124 | csharp_style_inlined_variable_declaration = true:suggestion
125 | csharp_style_pattern_local_over_anonymous_function = true:suggestion
126 | csharp_style_prefer_index_operator = true:suggestion
127 | csharp_style_prefer_range_operator = true:suggestion
128 | csharp_style_throw_expression = true:suggestion
129 | csharp_style_unused_value_assignment_preference = discard_variable:suggestion
130 | csharp_style_unused_value_expression_statement_preference = discard_variable:silent
131 |
132 | # 'using' directive preferences
133 | csharp_using_directive_placement = outside_namespace:silent
134 |
135 | #### C# Formatting Rules ####
136 |
137 | # New line preferences
138 | csharp_new_line_before_catch = true
139 | csharp_new_line_before_else = true
140 | csharp_new_line_before_finally = true
141 | csharp_new_line_before_members_in_anonymous_types = true
142 | csharp_new_line_before_members_in_object_initializers = true
143 | csharp_new_line_before_open_brace = all
144 | csharp_new_line_between_query_expression_clauses = true
145 |
146 | # Indentation preferences
147 | csharp_indent_block_contents = true
148 | csharp_indent_braces = false
149 | csharp_indent_case_contents = true
150 | csharp_indent_case_contents_when_block = true
151 | csharp_indent_labels = one_less_than_current
152 | csharp_indent_switch_labels = true
153 |
154 | # Space preferences
155 | csharp_space_after_cast = false
156 | csharp_space_after_colon_in_inheritance_clause = true
157 | csharp_space_after_comma = true
158 | csharp_space_after_dot = false
159 | csharp_space_after_keywords_in_control_flow_statements = true
160 | csharp_space_after_semicolon_in_for_statement = true
161 | csharp_space_around_binary_operators = before_and_after
162 | csharp_space_around_declaration_statements = false
163 | csharp_space_before_colon_in_inheritance_clause = true
164 | csharp_space_before_comma = false
165 | csharp_space_before_dot = false
166 | csharp_space_before_open_square_brackets = false
167 | csharp_space_before_semicolon_in_for_statement = false
168 | csharp_space_between_empty_square_brackets = false
169 | csharp_space_between_method_call_empty_parameter_list_parentheses = false
170 | csharp_space_between_method_call_name_and_opening_parenthesis = false
171 | csharp_space_between_method_call_parameter_list_parentheses = false
172 | csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
173 | csharp_space_between_method_declaration_name_and_open_parenthesis = false
174 | csharp_space_between_method_declaration_parameter_list_parentheses = false
175 | csharp_space_between_parentheses = false
176 | csharp_space_between_square_brackets = false
177 |
178 | # Wrapping preferences
179 | csharp_preserve_single_line_blocks = true
180 | csharp_preserve_single_line_statements = true
181 | csharp_style_namespace_declarations = block_scoped:silent
182 | csharp_style_prefer_method_group_conversion = true:silent
183 | csharp_style_prefer_top_level_statements = true:silent
184 | csharp_style_prefer_primary_constructors = false:suggestion
185 |
186 | #### Naming styles ####
187 | [*.{cs,vb}]
188 |
189 | # Naming rules
190 |
191 | dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.severity = suggestion
192 | dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.symbols = types_and_namespaces
193 | dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.style = pascalcase
194 |
195 | dotnet_naming_rule.interfaces_should_be_ipascalcase.severity = suggestion
196 | dotnet_naming_rule.interfaces_should_be_ipascalcase.symbols = interfaces
197 | dotnet_naming_rule.interfaces_should_be_ipascalcase.style = ipascalcase
198 |
199 | dotnet_naming_rule.type_parameters_should_be_tpascalcase.severity = suggestion
200 | dotnet_naming_rule.type_parameters_should_be_tpascalcase.symbols = type_parameters
201 | dotnet_naming_rule.type_parameters_should_be_tpascalcase.style = tpascalcase
202 |
203 | dotnet_naming_rule.methods_should_be_pascalcase.severity = suggestion
204 | dotnet_naming_rule.methods_should_be_pascalcase.symbols = methods
205 | dotnet_naming_rule.methods_should_be_pascalcase.style = pascalcase
206 |
207 | dotnet_naming_rule.properties_should_be_pascalcase.severity = suggestion
208 | dotnet_naming_rule.properties_should_be_pascalcase.symbols = properties
209 | dotnet_naming_rule.properties_should_be_pascalcase.style = pascalcase
210 |
211 | dotnet_naming_rule.events_should_be_pascalcase.severity = suggestion
212 | dotnet_naming_rule.events_should_be_pascalcase.symbols = events
213 | dotnet_naming_rule.events_should_be_pascalcase.style = pascalcase
214 |
215 | dotnet_naming_rule.local_variables_should_be_camelcase.severity = suggestion
216 | dotnet_naming_rule.local_variables_should_be_camelcase.symbols = local_variables
217 | dotnet_naming_rule.local_variables_should_be_camelcase.style = camelcase
218 |
219 | dotnet_naming_rule.local_constants_should_be_camelcase.severity = suggestion
220 | dotnet_naming_rule.local_constants_should_be_camelcase.symbols = local_constants
221 | dotnet_naming_rule.local_constants_should_be_camelcase.style = camelcase
222 |
223 | dotnet_naming_rule.parameters_should_be_camelcase.severity = suggestion
224 | dotnet_naming_rule.parameters_should_be_camelcase.symbols = parameters
225 | dotnet_naming_rule.parameters_should_be_camelcase.style = camelcase
226 |
227 | dotnet_naming_rule.public_fields_should_be_pascalcase.severity = suggestion
228 | dotnet_naming_rule.public_fields_should_be_pascalcase.symbols = public_fields
229 | dotnet_naming_rule.public_fields_should_be_pascalcase.style = pascalcase
230 |
231 | dotnet_naming_rule.private_fields_should_be__camelcase.severity = suggestion
232 | dotnet_naming_rule.private_fields_should_be__camelcase.symbols = private_fields
233 | dotnet_naming_rule.private_fields_should_be__camelcase.style = _camelcase
234 |
235 | dotnet_naming_rule.private_static_fields_should_be_s_camelcase.severity = suggestion
236 | dotnet_naming_rule.private_static_fields_should_be_s_camelcase.symbols = private_static_fields
237 | dotnet_naming_rule.private_static_fields_should_be_s_camelcase.style = _camelcase
238 |
239 | dotnet_naming_rule.public_constant_fields_should_be_pascalcase.severity = suggestion
240 | dotnet_naming_rule.public_constant_fields_should_be_pascalcase.symbols = public_constant_fields
241 | dotnet_naming_rule.public_constant_fields_should_be_pascalcase.style = pascalcase
242 |
243 | dotnet_naming_rule.private_constant_fields_should_be_pascalcase.severity = suggestion
244 | dotnet_naming_rule.private_constant_fields_should_be_pascalcase.symbols = private_constant_fields
245 | dotnet_naming_rule.private_constant_fields_should_be_pascalcase.style = pascalcase
246 |
247 | dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.severity = suggestion
248 | dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.symbols = public_static_readonly_fields
249 | dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.style = pascalcase
250 |
251 | dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.severity = suggestion
252 | dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.symbols = private_static_readonly_fields
253 | dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.style = _camelcase
254 |
255 | dotnet_naming_rule.enums_should_be_pascalcase.severity = suggestion
256 | dotnet_naming_rule.enums_should_be_pascalcase.symbols = enums
257 | dotnet_naming_rule.enums_should_be_pascalcase.style = pascalcase
258 |
259 | dotnet_naming_rule.local_functions_should_be_pascalcase.severity = suggestion
260 | dotnet_naming_rule.local_functions_should_be_pascalcase.symbols = local_functions
261 | dotnet_naming_rule.local_functions_should_be_pascalcase.style = pascalcase
262 |
263 | dotnet_naming_rule.non_field_members_should_be_pascalcase.severity = suggestion
264 | dotnet_naming_rule.non_field_members_should_be_pascalcase.symbols = non_field_members
265 | dotnet_naming_rule.non_field_members_should_be_pascalcase.style = pascalcase
266 |
267 | # Symbol specifications
268 |
269 | dotnet_naming_symbols.interfaces.applicable_kinds = interface
270 | dotnet_naming_symbols.interfaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
271 | dotnet_naming_symbols.interfaces.required_modifiers =
272 |
273 | dotnet_naming_symbols.enums.applicable_kinds = enum
274 | dotnet_naming_symbols.enums.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
275 | dotnet_naming_symbols.enums.required_modifiers =
276 |
277 | dotnet_naming_symbols.events.applicable_kinds = event
278 | dotnet_naming_symbols.events.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
279 | dotnet_naming_symbols.events.required_modifiers =
280 |
281 | dotnet_naming_symbols.methods.applicable_kinds = method
282 | dotnet_naming_symbols.methods.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
283 | dotnet_naming_symbols.methods.required_modifiers =
284 |
285 | dotnet_naming_symbols.properties.applicable_kinds = property
286 | dotnet_naming_symbols.properties.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
287 | dotnet_naming_symbols.properties.required_modifiers =
288 |
289 | dotnet_naming_symbols.public_fields.applicable_kinds = field
290 | dotnet_naming_symbols.public_fields.applicable_accessibilities = public, internal
291 | dotnet_naming_symbols.public_fields.required_modifiers =
292 |
293 | dotnet_naming_symbols.private_fields.applicable_kinds = field
294 | dotnet_naming_symbols.private_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
295 | dotnet_naming_symbols.private_fields.required_modifiers =
296 |
297 | dotnet_naming_symbols.private_static_fields.applicable_kinds = field
298 | dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
299 | dotnet_naming_symbols.private_static_fields.required_modifiers = static
300 |
301 | dotnet_naming_symbols.types_and_namespaces.applicable_kinds = namespace, class, struct, interface, enum
302 | dotnet_naming_symbols.types_and_namespaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
303 | dotnet_naming_symbols.types_and_namespaces.required_modifiers =
304 |
305 | dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
306 | dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
307 | dotnet_naming_symbols.non_field_members.required_modifiers =
308 |
309 | dotnet_naming_symbols.type_parameters.applicable_kinds = namespace
310 | dotnet_naming_symbols.type_parameters.applicable_accessibilities = *
311 | dotnet_naming_symbols.type_parameters.required_modifiers =
312 |
313 | dotnet_naming_symbols.private_constant_fields.applicable_kinds = field
314 | dotnet_naming_symbols.private_constant_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
315 | dotnet_naming_symbols.private_constant_fields.required_modifiers = const
316 |
317 | dotnet_naming_symbols.local_variables.applicable_kinds = local
318 | dotnet_naming_symbols.local_variables.applicable_accessibilities = local
319 | dotnet_naming_symbols.local_variables.required_modifiers =
320 |
321 | dotnet_naming_symbols.local_constants.applicable_kinds = local
322 | dotnet_naming_symbols.local_constants.applicable_accessibilities = local
323 | dotnet_naming_symbols.local_constants.required_modifiers = const
324 |
325 | dotnet_naming_symbols.parameters.applicable_kinds = parameter
326 | dotnet_naming_symbols.parameters.applicable_accessibilities = *
327 | dotnet_naming_symbols.parameters.required_modifiers =
328 |
329 | dotnet_naming_symbols.public_constant_fields.applicable_kinds = field
330 | dotnet_naming_symbols.public_constant_fields.applicable_accessibilities = public, internal
331 | dotnet_naming_symbols.public_constant_fields.required_modifiers = const
332 |
333 | dotnet_naming_symbols.public_static_readonly_fields.applicable_kinds = field
334 | dotnet_naming_symbols.public_static_readonly_fields.applicable_accessibilities = public, internal
335 | dotnet_naming_symbols.public_static_readonly_fields.required_modifiers = readonly, static
336 |
337 | dotnet_naming_symbols.private_static_readonly_fields.applicable_kinds = field
338 | dotnet_naming_symbols.private_static_readonly_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
339 | dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = readonly, static
340 |
341 | dotnet_naming_symbols.local_functions.applicable_kinds = local_function
342 | dotnet_naming_symbols.local_functions.applicable_accessibilities = *
343 | dotnet_naming_symbols.local_functions.required_modifiers =
344 |
345 | # Naming styles
346 |
347 | dotnet_naming_style.pascalcase.required_prefix =
348 | dotnet_naming_style.pascalcase.required_suffix =
349 | dotnet_naming_style.pascalcase.word_separator =
350 | dotnet_naming_style.pascalcase.capitalization = pascal_case
351 |
352 | dotnet_naming_style.ipascalcase.required_prefix = I
353 | dotnet_naming_style.ipascalcase.required_suffix =
354 | dotnet_naming_style.ipascalcase.word_separator =
355 | dotnet_naming_style.ipascalcase.capitalization = pascal_case
356 |
357 | dotnet_naming_style.tpascalcase.required_prefix = T
358 | dotnet_naming_style.tpascalcase.required_suffix =
359 | dotnet_naming_style.tpascalcase.word_separator =
360 | dotnet_naming_style.tpascalcase.capitalization = pascal_case
361 |
362 | dotnet_naming_style._camelcase.required_prefix = _
363 | dotnet_naming_style._camelcase.required_suffix =
364 | dotnet_naming_style._camelcase.word_separator =
365 | dotnet_naming_style._camelcase.capitalization = camel_case
366 |
367 | dotnet_naming_style.camelcase.required_prefix =
368 | dotnet_naming_style.camelcase.required_suffix =
369 | dotnet_naming_style.camelcase.word_separator =
370 | dotnet_naming_style.camelcase.capitalization = camel_case
371 |
372 | dotnet_naming_style.s_camelcase.required_prefix = s_
373 | dotnet_naming_style.s_camelcase.required_suffix =
374 | dotnet_naming_style.s_camelcase.word_separator =
375 | dotnet_naming_style.s_camelcase.capitalization = camel_case
376 |
377 | ###############################
378 | # Spell Check #
379 | ###############################
380 | # https://learn.microsoft.com/visualstudio/ide/text-spell-checker
381 | spelling_exclusion_path = .\exclusions.dic
382 | spelling_checkable_types = strings,identifiers,comments
383 | # Update this to match your prefered language, you will need to ensure you have the language pack installed for the language
384 | spelling_languages = en-us
385 | # This is only the level that spelling errors occur in the Error List, it is not actually a compile-time warning/error
386 | spelling_error_severity = information
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/.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: "nuget" # See documentation for possible values
9 | directory: "/" # Location of package manifests
10 | schedule:
11 | interval: "weekly"
12 |
13 | - package-ecosystem: "github-actions" # See documentation for possible values
14 | directory: "/" # Location of package manifests
15 | schedule:
16 | interval: "weekly"
17 |
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/.github/workflows/build_app.yml:
--------------------------------------------------------------------------------
1 | name: Build WpfApp
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 | pull_request:
8 | branches:
9 | - main
10 | workflow_dispatch:
11 |
12 | defaults:
13 | run:
14 | shell: pwsh
15 |
16 | env:
17 | version: "1.0.${{ github.run_number }}"
18 |
19 | jobs:
20 | build:
21 | runs-on: windows-latest
22 |
23 | steps:
24 | - uses: actions/checkout@v4
25 |
26 | - name: Set up .NET Core
27 | uses: actions/setup-dotnet@v4
28 | with:
29 | dotnet-version: '8.x'
30 |
31 | - name: dotnet build
32 | run: dotnet build --configuration Release -p:Version="${{ env.version }}"
33 |
34 | - name: dotnet test
35 | run: dotnet test --configuration Release --no-build --collect:"XPlat Code Coverage" --results-directory ${{github.workspace}}/.build/coverage
36 |
37 | - name: ReportGenerator
38 | uses: danielpalme/ReportGenerator-GitHub-Action@5.4.7
39 | with:
40 | reports: ${{github.workspace}}/.build/coverage/**/coverage.cobertura.xml
41 | targetdir: ${{github.workspace}}/.build/coveragereport/
42 | reporttypes: Html;MarkdownSummaryGithub
43 | title: 'Code Coverage'
44 |
45 | - name: Write PR Number
46 | if: ${{ github.event_name == 'pull_request' }}
47 | run: |
48 | New-Item -Type File -Value "${{ github.event.number }}" -Force -Path "${{github.workspace}}/.build/coveragereport/PullRequestNumber"
49 |
50 | - name: Upload Code Coverage Report
51 | uses: actions/upload-artifact@v4
52 | with:
53 | name: CodeCoverage
54 | path: ${{github.workspace}}/.build/coveragereport/
55 | if-no-files-found: error
56 |
57 | - name: dotnet publish
58 | if: ${{ github.event_name != 'pull_request' }}
59 | run: |
60 | # If publishing single file, remove the --no-build below
61 | dotnet publish --configuration Release --no-build -p:Version="${{ env.version }}" -p:PublishDir=${{github.workspace}}/.build/publish
62 |
63 | - name: Upload artifact for deployment job
64 | if: ${{ github.event_name != 'pull_request' }}
65 | uses: actions/upload-artifact@v4
66 | with:
67 | name: app
68 | path: ${{github.workspace}}/.build/publish
69 |
70 | # This will automatically mark PRs from dependabot with auto merge.
71 | # This allows them to automatically complete if they pass the rest of the CI
72 | auto-merge:
73 | if: ${{ github.event_name == 'pull_request' }}
74 | runs-on: ubuntu-latest
75 |
76 | permissions:
77 | pull-requests: write
78 | contents: write
79 |
80 | steps:
81 | - uses: fastify/github-action-merge-dependabot@v3.11.1
82 | with:
83 | # For GitHub Auto Merge to work it must be enabled on the repo.
84 | # This can be done with the script here:
85 | # https://github.com/Keboo/DotnetTemplates/blob/main/SetupRepo.ps1
86 | # See documentation here:
87 | # https://docs.github.com/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/automatically-merging-a-pull-request
88 | use-github-auto-merge: true
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/.github/workflows/code_coverage_comment.yml:
--------------------------------------------------------------------------------
1 | name: Code Coverage PR Comment
2 |
3 | on:
4 | workflow_run:
5 | workflows: [Build WpfApp]
6 | types:
7 | - completed
8 |
9 | defaults:
10 | run:
11 | shell: pwsh
12 |
13 | # This is required by marocchino/sticky-pull-request-comment
14 | # You must enable read/write permissions to allow workflows to create comments on the PR.
15 | # On your repo navigate to: Settings > Actions > General > Workflow permissions, and make sure to enable read and write permissions.
16 | # https://github.com/marocchino/sticky-pull-request-comment#error-resource-not-accessible-by-integration
17 | permissions:
18 | pull-requests: write
19 |
20 | jobs:
21 | post-code-coverage:
22 | runs-on: ubuntu-latest
23 | if: >
24 | github.event.workflow_run.event == 'pull_request' &&
25 | github.event.workflow_run.conclusion == 'success'
26 | steps:
27 | - name: Download artifacts
28 | run: gh run download ${{ github.event.workflow_run.id }} -n CodeCoverage --repo ${{ github.repository }}
29 | env:
30 | GH_TOKEN: ${{ github.token }}
31 |
32 | - name: 'Get PR Number'
33 | id: get-pr-number
34 | run: |
35 | $pr_number = (cat PullRequestNumber)
36 | "pr_number=$pr_number" >> $env:GITHUB_OUTPUT
37 |
38 | - uses: marocchino/sticky-pull-request-comment@v2
39 | with:
40 | recreate: true
41 | number: ${{ steps.get-pr-number.outputs.pr_number }}
42 | path: SummaryGithub.md
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/.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/WPF/WpfApp/.template.config/template.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "http://json.schemastore.org/template",
3 | "author": "Keboo",
4 | "classifications": [
5 | "Common",
6 | "WPF"
7 | ],
8 | "identity": "Keboo.WpfTemplates.FullApp",
9 | "name": "Keboo Full WPF Application",
10 | "shortName": "keboo.wpf",
11 | "tags": {
12 | "language": "C#",
13 | "type": "solution"
14 | },
15 | "preferNameDirectory":true,
16 | "sourceName": "WpfApp",
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 | "WpfApp.sln"
44 | ]
45 | },
46 | {
47 | "condition": "(no-tests)",
48 | "exclude": [
49 | "WpfApp.Tests/*"
50 | ]
51 | }
52 | ]
53 | }
54 | ]
55 | }
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
5 |
6 |
10 |
11 |
12 | enable
13 | enable
14 | 12
15 | true
16 |
20 |
21 |
22 |
23 |
28 |
29 | 12345678-9abc-0123-4567-890abcdef123
30 |
31 |
32 |
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/Directory.Build.targets:
--------------------------------------------------------------------------------
1 |
5 |
6 |
10 |
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/Directory.Packages.props:
--------------------------------------------------------------------------------
1 |
6 |
7 |
11 |
12 |
13 |
14 | true
15 |
16 | true
17 |
18 |
19 |
23 |
24 |
25 |
26 | runtime; build; native; contentfiles; analyzers; buildtransitive
27 | all
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | runtime; build; native; contentfiles; analyzers; buildtransitive
39 | all
40 |
41 |
42 |
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/NuGet.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/README.md:
--------------------------------------------------------------------------------
1 | # WPF app template
2 | This template creates a full WPF application, along with unit tests.
3 |
4 | ## Template
5 | Create a new app in your current directory by running.
6 |
7 | ```cli
8 | > dotnet new keboo.wpf
9 | ```
10 |
11 | ### Parameters
12 | [Default template options](https://learn.microsoft.com/dotnet/core/tools/dotnet-new#options)
13 |
14 | ## Key Features
15 |
16 | ### Generic Host Dependency Injection
17 | [Docs](https://learn.microsoft.com/dotnet/core/extensions/generic-host?tabs=appbuilder&WT.mc_id=DT-MVP-5003472)
18 |
19 | ### Centralized Package Management
20 | [Docs](https://learn.microsoft.com/nuget/consume-packages/Central-Package-Management?WT.mc_id=DT-MVP-5003472)
21 |
22 | ### Build Customization
23 | [Docs](https://learn.microsoft.com/visualstudio/msbuild/customize-by-directory?view=vs-2022&WT.mc_id=DT-MVP-5003472)
24 |
25 | ### CommunityToolkit MVVM
26 | [Docs](https://learn.microsoft.com/dotnet/communitytoolkit/mvvm/?WT.mc_id=DT-MVP-5003472)
27 |
28 | ### Material Design in XAML
29 | [Repo](https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit)
30 |
31 | ### .editorconfig formatting
32 | [Docs](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/code-style-rule-options?WT.mc_id=DT-MVP-5003472)
33 |
34 | ### Testing with Moq.AutoMocker
35 | [Repo](https://github.com/moq/Moq.AutoMocker)
36 |
37 | ### NuGet package source mapping
38 | [Docs](https://learn.microsoft.com/nuget/consume-packages/package-source-mapping?WT.mc_id=DT-MVP-5003472)
39 |
40 | ### Dependabot auto updating of dependencies
41 | [Docs](https://docs.github.com/code-security/dependabot/dependabot-version-updates)
42 | Auto merging of these PRs done with [fastify/github-action-merge-dependabot](https://github.com/fastify/github-action-merge-dependabot).
43 |
44 | ### GitHub Actions workflow with code coverage reporting
45 | [Docs](https://docs.github.com/actions).
46 | Code coverage provided by [coverlet-coverage/coverlet](https://github.com/coverlet-coverage/coverlet).
47 | Code coverage report provided by [danielpalme/ReportGenerator-GitHub-Action](https://github.com/danielpalme/ReportGenerator-GitHub-Action).
48 | The coverage reports are posted as "stciky" PR comments provided by [marocchino/sticky-pull-request-comment](https://github.com/marocchino/sticky-pull-request-comment)
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/Settings.XamlStyler:
--------------------------------------------------------------------------------
1 | {
2 | "IndentSize": 2,
3 | "AttributesTolerance": 2,
4 | "KeepFirstAttributeOnSameLine": true,
5 | "MaxAttributeCharactersPerLine": 0,
6 | "MaxAttributesPerLine": 1,
7 | "NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransform, SkewTransform, RotateTransform, TranslateTransform, Trigger, MultiTrigger, DataTrigger, MultiDataTrigger, Condition, Setter, SolidColorBrush, Pen",
8 | "SeparateByGroups": false,
9 | "AttributeIndentation": 0,
10 | "AttributeIndentationStyle": "Spaces",
11 | "RemoveDesignTimeReferences": false,
12 | "EnableAttributeReordering": true,
13 | "AttributeOrderingRuleGroups": [
14 | "x:Class",
15 | "xmlns, xmlns:x",
16 | "xmlns:*",
17 | "x:Key, Key, x:Name, Name, x:Uid, Uid, Title",
18 | "Grid.Row, Grid.RowSpan, Grid.Column, Grid.ColumnSpan, Canvas.Left, Canvas.Top, Canvas.Right, Canvas.Bottom",
19 | "Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight",
20 | "Margin, Padding, HorizontalAlignment, VerticalAlignment, HorizontalContentAlignment, VerticalContentAlignment, Panel.ZIndex",
21 | "*:*, *",
22 | "PageSource, PageIndex, Offset, Color, TargetName, Property, Value, StartPoint, EndPoint",
23 | "*:Freeze, mc:Ignorable, d:IsDataSource, d:LayoutOverrides, d:IsStaticText",
24 | "Storyboard.*, From, To, Duration",
25 | "TargetType",
26 | "BasedOn"
27 | ],
28 | "FirstLineAttributes": "",
29 | "OrderAttributesByName": true,
30 | "PutEndingBracketOnNewLine": false,
31 | "RemoveEndingTagOfEmptyElement": true,
32 | "SpaceBeforeClosingSlash": true,
33 | "RootElementLineBreakRule": "Always",
34 | "ReorderVSM": "First",
35 | "ReorderGridChildren": false,
36 | "ReorderCanvasChildren": false,
37 | "ReorderSetters": "TargetNameThenProperty",
38 | "FormatMarkupExtension": true,
39 | "NoNewLineMarkupExtensions": "x:Bind, Binding, TemplateBinding, x:Static, DynamicResource, ComponentResourceKey, iconPacks:Modern, iconPacks:Material",
40 | "ThicknessSeparator": "Comma",
41 | "ThicknessAttributes": "Margin, Padding, BorderThickness, ThumbnailClipMargin",
42 | "FormatOnSave": false,
43 | "CommentPadding": 1
44 | }
45 |
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/WpfApp.Tests/MainWindowViewModelTests.cs:
--------------------------------------------------------------------------------
1 | namespace WpfApp.Tests;
2 |
3 | //This attribute generates tests for MainWindowViewModel that
4 | //asserts all constructor arguments are checked for null
5 | [ConstructorTests(typeof(MainWindowViewModel))]
6 | public partial class MainWindowViewModelTests
7 | {
8 | [Fact]
9 | public void IncrementCounterCommand_Execute_IncrementsCount()
10 | {
11 | //Arrange
12 | AutoMocker mocker = new();
13 |
14 | MainWindowViewModel viewModel = mocker.CreateInstance();
15 |
16 | int initialCount = viewModel.Count;
17 |
18 | //Act
19 | viewModel.IncrementCountCommand.Execute(null);
20 |
21 | //Assert
22 | Assert.Equal(initialCount + 1, viewModel.Count);
23 | }
24 |
25 | [Theory]
26 | [InlineData(0, true)]
27 | [InlineData(1, true)]
28 | [InlineData(2, true)]
29 | [InlineData(3, true)]
30 | [InlineData(4, true)]
31 | [InlineData(5, false)]
32 | [InlineData(6, false)]
33 | public void IncrementCounterCommand_CanExecute_IndicatesIfCountIsLessThanFive(int count, bool expected)
34 | {
35 | //Arrange
36 | AutoMocker mocker = new();
37 |
38 | MainWindowViewModel viewModel = mocker.CreateInstance();
39 |
40 | viewModel.Count = count;
41 |
42 | //Act
43 | bool canExecute = viewModel.IncrementCountCommand.CanExecute(null);
44 |
45 | //Assert
46 | Assert.Equal(expected, canExecute);
47 | }
48 |
49 | [Fact]
50 | public void ClearCounterCommand_Execute_ClearsCount()
51 | {
52 | //Arrange
53 | AutoMocker mocker = new();
54 |
55 | MainWindowViewModel viewModel = mocker.CreateInstance();
56 | viewModel.Count = 42;
57 |
58 | //Act
59 | viewModel.ClearCountCommand.Execute(null);
60 |
61 | //Assert
62 | Assert.Equal(0, viewModel.Count);
63 | }
64 | }
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/WpfApp.Tests/WpfApp.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0-windows
5 |
6 | false
7 | false
8 | true
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/WpfApp.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.5.33103.201
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfApp", "WpfApp\WpfApp.csproj", "{5DE76ED2-C96F-4D5B-85FF-5BC9850C11AF}"
7 | EndProject
8 | #if (!no-tests)
9 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfApp.Tests", "WpfApp.Tests\WpfApp.Tests.csproj", "{75C75A76-E608-41BB-AEC2-80A1C95B7B62}"
10 | EndProject
11 | #endif
12 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{50AAD861-2EF1-4EAB-80EB-20FECB15232C}"
13 | ProjectSection(SolutionItems) = preProject
14 | .editorconfig = .editorconfig
15 | Directory.Build.props = Directory.Build.props
16 | Directory.Build.targets = Directory.Build.targets
17 | Directory.Packages.props = Directory.Packages.props
18 | exclusions.dic = exclusions.dic
19 | NuGet.config = NuGet.config
20 | Settings.XamlStyler = Settings.XamlStyler
21 | EndProjectSection
22 | EndProject
23 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{EF62C430-6899-4C85-BFFC-D71632937A3B}"
24 | ProjectSection(SolutionItems) = preProject
25 | .github\dependabot.yml = .github\dependabot.yml
26 | EndProjectSection
27 | EndProject
28 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{AC2A502B-963E-4FD6-ACCA-8F96EDD4190F}"
29 | ProjectSection(SolutionItems) = preProject
30 | .github\workflows\build_app.yml = .github\workflows\build_app.yml
31 | .github\workflows\code_coverage_comment.yml = .github\workflows\code_coverage_comment.yml
32 | EndProjectSection
33 | EndProject
34 | Global
35 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
36 | Debug|Any CPU = Debug|Any CPU
37 | Release|Any CPU = Release|Any CPU
38 | EndGlobalSection
39 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
40 | {5DE76ED2-C96F-4D5B-85FF-5BC9850C11AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41 | {5DE76ED2-C96F-4D5B-85FF-5BC9850C11AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
42 | {5DE76ED2-C96F-4D5B-85FF-5BC9850C11AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
43 | {5DE76ED2-C96F-4D5B-85FF-5BC9850C11AF}.Release|Any CPU.Build.0 = Release|Any CPU
44 | #if (!no-test)
45 | {75C75A76-E608-41BB-AEC2-80A1C95B7B62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
46 | {75C75A76-E608-41BB-AEC2-80A1C95B7B62}.Debug|Any CPU.Build.0 = Debug|Any CPU
47 | {75C75A76-E608-41BB-AEC2-80A1C95B7B62}.Release|Any CPU.ActiveCfg = Release|Any CPU
48 | {75C75A76-E608-41BB-AEC2-80A1C95B7B62}.Release|Any CPU.Build.0 = Release|Any CPU
49 | #endif
50 | EndGlobalSection
51 | GlobalSection(SolutionProperties) = preSolution
52 | HideSolutionNode = FALSE
53 | EndGlobalSection
54 | GlobalSection(NestedProjects) = preSolution
55 | {EF62C430-6899-4C85-BFFC-D71632937A3B} = {50AAD861-2EF1-4EAB-80EB-20FECB15232C}
56 | {AC2A502B-963E-4FD6-ACCA-8F96EDD4190F} = {EF62C430-6899-4C85-BFFC-D71632937A3B}
57 | EndGlobalSection
58 | GlobalSection(ExtensibilityGlobals) = postSolution
59 | SolutionGuid = {490F259C-CD1B-446C-A893-CD94D4954AE9}
60 | EndGlobalSection
61 | EndGlobal
62 |
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/WpfApp/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
12 |
13 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/WpfApp/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using CommunityToolkit.Mvvm.Messaging;
2 | using MaterialDesignThemes.Wpf;
3 | using Microsoft.Extensions.Configuration;
4 | using Microsoft.Extensions.DependencyInjection;
5 | using Microsoft.Extensions.Hosting;
6 | using System.Windows;
7 | using System.Windows.Threading;
8 |
9 | namespace WpfApp;
10 |
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | [STAThread]
17 | private static void Main(string[] args)
18 | {
19 | MainAsync(args).GetAwaiter().GetResult();
20 | }
21 |
22 | private static async Task MainAsync(string[] args)
23 | {
24 | using IHost host = CreateHostBuilder(args).Build();
25 | await host.StartAsync().ConfigureAwait(true);
26 |
27 | App app = new();
28 | app.InitializeComponent();
29 | app.MainWindow = host.Services.GetRequiredService();
30 | app.MainWindow.Visibility = Visibility.Visible;
31 | app.Run();
32 |
33 | await host.StopAsync().ConfigureAwait(true);
34 | }
35 |
36 | public static IHostBuilder CreateHostBuilder(string[] args) =>
37 | Host.CreateDefaultBuilder(args)
38 | .ConfigureAppConfiguration((hostBuilderContext, configurationBuilder)
39 | => configurationBuilder.AddUserSecrets(typeof(App).Assembly))
40 | .ConfigureServices((hostContext, services) =>
41 | {
42 | services.AddSingleton();
43 | services.AddSingleton();
44 |
45 | services.AddSingleton();
46 | services.AddSingleton(provider => provider.GetRequiredService());
47 |
48 | services.AddSingleton(_ => Current.Dispatcher);
49 |
50 | services.AddTransient(provider =>
51 | {
52 | Dispatcher dispatcher = provider.GetRequiredService();
53 | return new SnackbarMessageQueue(TimeSpan.FromSeconds(3.0), dispatcher);
54 | });
55 | });
56 | }
57 |
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/WpfApp/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | [assembly: ThemeInfo(
4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5 | //(used if a resource is not found in the page,
6 | // or application resource dictionaries)
7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8 | //(used if a resource is not found in the page,
9 | // app, or any theme specific resource dictionaries)
10 | )]
11 |
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/WpfApp/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/WpfApp/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Input;
2 |
3 | namespace WpfApp;
4 |
5 | ///
6 | /// Interaction logic for MainWindow.xaml
7 | ///
8 | public partial class MainWindow
9 | {
10 | public MainWindow(MainWindowViewModel viewModel)
11 | {
12 | DataContext = viewModel;
13 | InitializeComponent();
14 |
15 | CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, OnClose));
16 | }
17 |
18 | private void OnClose(object sender, ExecutedRoutedEventArgs e)
19 | {
20 | Close();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/WpfApp/MainWindowViewModel.cs:
--------------------------------------------------------------------------------
1 | using CommunityToolkit.Mvvm.ComponentModel;
2 | using CommunityToolkit.Mvvm.Input;
3 |
4 | namespace WpfApp;
5 |
6 | public partial class MainWindowViewModel : ObservableObject
7 | {
8 | //This is using the source generators from CommunityToolkit.Mvvm to generate an ObservableProperty
9 | //See: https://learn.microsoft.com/dotnet/communitytoolkit/mvvm/generators/observableproperty
10 | //and: https://learn.microsoft.com/windows/communitytoolkit/mvvm/observableobject
11 | [ObservableProperty]
12 | [NotifyCanExecuteChangedFor(nameof(IncrementCountCommand))]
13 | private int _count;
14 |
15 | public MainWindowViewModel()
16 | {
17 |
18 | }
19 |
20 | //This is using the source generators from CommunityToolkit.Mvvm to generate a RelayCommand
21 | //See: https://learn.microsoft.com/dotnet/communitytoolkit/mvvm/generators/relaycommand
22 | //and: https://learn.microsoft.com/windows/communitytoolkit/mvvm/relaycommand
23 | [RelayCommand(CanExecute = nameof(CanIncrementCount))]
24 | private void IncrementCount()
25 | {
26 | Count++;
27 | }
28 |
29 | private bool CanIncrementCount() => Count < 5;
30 |
31 | [RelayCommand]
32 | private void ClearCount()
33 | {
34 | Count = 0;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/WpfApp/Resources/AppIcon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Keboo/DotnetTemplates/13b93a4274369e67d52e1fa8527fe0f9a6d83df0/templates/WPF/WpfApp/WpfApp/Resources/AppIcon.ico
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/WpfApp/WpfApp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net8.0-windows
6 |
7 | true
8 | WpfApp.App
9 | Resources\AppIcon.ico
10 |
11 |
12 |
22 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/templates/WPF/WpfApp/exclusions.dic:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Keboo/DotnetTemplates/13b93a4274369e67d52e1fa8527fe0f9a6d83df0/templates/WPF/WpfApp/exclusions.dic
--------------------------------------------------------------------------------