Skip to content

Commit b73273d

Browse files
authored
Merge pull request #16 from solrevdev/post/seedfolder-dotnet-10-upgrade
post: upgrading seedfolder to .NET 10 LTS
2 parents 97bb464 + 921abe5 commit b73273d

File tree

2 files changed

+380
-0
lines changed

2 files changed

+380
-0
lines changed
Lines changed: 312 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,312 @@
1+
---
2+
layout: post
3+
title: How to Upgrade to .NET 10 LTS - Complete Guide for .NET Global Tools with Multi-Targeting
4+
description: Step-by-step guide to upgrade .NET applications to .NET 10 LTS while maintaining backward compatibility with .NET 8 and 9. Learn multi-targeting, dependency management, CI/CD updates, and migration best practices.
5+
summary: Complete tutorial for upgrading .NET global tools to .NET 10 LTS. Learn how to add .NET 10 support while maintaining compatibility with .NET 8 (LTS) and .NET 9 (STS) using multi-targeting. Includes project configuration, dependency management, CI/CD pipeline updates, testing strategies, and real-world migration examples.
6+
cover_image: /images/seedfolder-dotnet10-upgrade.svg
7+
tags:
8+
- dotnet-10
9+
- dotnet10
10+
- upgrade-dotnet
11+
- dotnet-migration
12+
- dotnet-upgrade-guide
13+
- dotnet-global-tools
14+
- dotnet
15+
- csharp
16+
- multi-targeting
17+
- nuget
18+
- ci-cd
19+
- net10
20+
- dotnet-lts
21+
- migration-guide
22+
23+
---
24+
**Overview**
25+
26+
With .NET 10 now released as the latest Long-Term Support (LTS) version, it was time to upgrade [SeedFolder](https://github.com/solrevdev/seedfolder) to support the newest framework.
27+
28+
This comprehensive .NET 10 upgrade guide walks you through migrating a .NET global tool from .NET 8 and 9 to .NET 10 while maintaining full backward compatibility.
29+
30+
Whether you're upgrading a .NET global tool, console application, or library, this migration tutorial covers everything you need: multi-target framework configuration, dependency management, CI/CD pipeline updates, and thorough testing strategies for a smooth .NET 10 migration.
31+
32+
**Why Upgrade to .NET 10?** 🎯
33+
34+
Migrating to .NET 10 LTS provides significant benefits for .NET developers. As the latest Long-Term Support release (supported until November 2028), upgrading to .NET 10 ensures your applications stay current with the latest framework improvements.
35+
36+
Benefits of upgrading to .NET 10:
37+
38+
- **Latest LTS**: Long-term support until November 2028
39+
- **Performance improvements**: Built-in performance enhancements from .NET 10
40+
- **Forward compatibility**: Automatic use of the highest installed SDK
41+
- **Backward compatibility**: Continued support for .NET 8 (LTS) and .NET 9 (STS)
42+
43+
The beauty of multi-targeting during your .NET 10 migration is that users with any of these SDK versions can install and run the tool.
44+
45+
When multiple SDKs are installed, the .NET CLI automatically selects the highest compatible version, making your upgrade path seamless.
46+
47+
**The Upgrade Process** 🚀
48+
49+
The upgrade was surprisingly straightforward, thanks to .NET's excellent multi-targeting support. Here's the step-by-step process I followed:
50+
51+
**1. Research and Planning** 📚
52+
53+
Before making any changes, I researched the .NET 10 requirements:
54+
55+
- **Target Framework Moniker (TFM)**: `net10.0`
56+
- **SDK Version**: `10.0.100` or later
57+
- **Breaking Changes**: Reviewed Microsoft docs for any breaking changes (none affecting SeedFolder)
58+
59+
I also reviewed the git history to understand how previous SDK upgrades were handled:
60+
61+
```bash
62+
git log --all --grep=".NET" --oneline | head -20
63+
```
64+
65+
This showed that the last major upgrade ([PR #259c452](https://github.com/solrevdev/seedfolder/commit/259c45284d67cb8ab6b1ff2f65d9fe2c5bfa8223)) added .NET 8 and 9 support, following a similar pattern I could replicate.
66+
67+
**2. Update Project File** 🔧
68+
69+
The key change was adding `net10.0` to the `TargetFrameworks` property in the `.csproj` file:
70+
71+
```diff
72+
<Project Sdk="Microsoft.NET.Sdk">
73+
<PropertyGroup>
74+
<OutputType>Exe</OutputType>
75+
- <TargetFrameworks>net8.0;net9.0</TargetFrameworks>
76+
+ <TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
77+
<LangVersion>latest</LangVersion>
78+
<ImplicitUsings>enable</ImplicitUsings>
79+
<PackAsTool>true</PackAsTool>
80+
<ToolCommandName>seedfolder</ToolCommandName>
81+
<PackageOutputPath>./nupkg</PackageOutputPath>
82+
<NoDefaultExcludes>true</NoDefaultExcludes>
83+
- <Version>1.3.3</Version>
84+
+ <Version>1.4.0</Version>
85+
<!-- ... other properties ... -->
86+
</PropertyGroup>
87+
</Project>
88+
```
89+
90+
**Important considerations:**
91+
- Use semicolon-separated list for multiple targets
92+
- Bump the version number for NuGet release (1.3.3 → 1.4.0)
93+
- Maintain existing targets for backward compatibility
94+
95+
**3. Update CI/CD Pipeline** ⚙️
96+
97+
The GitHub Actions workflow needed to install the .NET 10 SDK alongside existing versions:
98+
99+
```diff
100+
- name: setup .net core sdk
101+
uses: actions/setup-dotnet@v4
102+
with:
103+
dotnet-version: |
104+
8.0.x
105+
9.0.x
106+
+ 10.0.x
107+
```
108+
109+
This ensures the CI pipeline can build all three target frameworks.
110+
111+
**4. Dependency Management** 📦
112+
113+
I ran `dotnet outdated` to check for package updates:
114+
115+
```bash
116+
dotnet tool install -g dotnet-outdated-tool
117+
dotnet outdated
118+
```
119+
120+
This revealed that Figgle (the ASCII art library) had a newer version (0.6.5). However, upon investigation, version 0.6.x introduced breaking changes by splitting fonts into a separate package. Since the upgrade goal was .NET 10 support, not dependency updates, I kept Figgle at 0.5.1 to avoid unnecessary complexity.
121+
122+
**5. Build and Test**
123+
124+
Building for multiple frameworks is straightforward with multi-targeting:
125+
126+
```bash
127+
dotnet build solrevdev.seedfolder.sln --configuration Release
128+
```
129+
130+
Output showed successful builds for all three targets:
131+
132+
```
133+
solrevdev.seedfolder -> src/bin/Release/net8.0/solrevdev.seedfolder.dll
134+
solrevdev.seedfolder -> src/bin/Release/net9.0/solrevdev.seedfolder.dll
135+
solrevdev.seedfolder -> src/bin/Release/net10.0/solrevdev.seedfolder.dll
136+
```
137+
138+
**Testing the Tool Locally** 🧪
139+
140+
Before publishing, I packaged and tested the tool locally:
141+
142+
```bash
143+
# Package the tool
144+
dotnet pack -c Release -o /tmp/seedfolder-test
145+
146+
# Install from local package
147+
dotnet tool uninstall -g solrevdev.seedfolder
148+
dotnet tool install -g --add-source /tmp/seedfolder-test solrevdev.seedfolder
149+
150+
# Verify installation
151+
seedfolder --version
152+
# Output: seedfolder version 1.4.0
153+
```
154+
155+
Then I tested various commands in `/tmp` to ensure functionality:
156+
157+
```bash
158+
# Test dry-run mode
159+
seedfolder --dry-run -t node test-node-app
160+
161+
# Create Python project
162+
seedfolder -t python test-python-app
163+
164+
# Create .NET project
165+
seedfolder --template dotnet test-dotnet-app
166+
167+
# Verify help and template listing
168+
seedfolder --help
169+
seedfolder --list-templates
170+
```
171+
172+
All tests passed successfully! 🎉
173+
174+
**6. Update Documentation** 📝
175+
176+
Documentation updates included:
177+
178+
**README.md** - Updated requirements section:
179+
```diff
180+
## Requirements
181+
182+
- This tool requires **.NET 8.0 or .NET 9.0 SDK** to be installed
183+
+ This tool requires **.NET 8.0, .NET 9.0, or .NET 10.0 SDK** to be installed
184+
185+
- **Runtime**: .NET 8.0 or later
186+
```
187+
188+
**CLAUDE.md** - Updated framework information:
189+
```diff
190+
## Multi-Target Framework Support
191+
- The project targets .NET 8.0 (LTS) and 9.0 (STS)
192+
+ The project targets .NET 8.0 (LTS), 9.0 (STS), and 10.0 (LTS)
193+
+ .NET 10 is the latest LTS release providing long-term support until November 2028.
194+
```
195+
196+
**Multi-Targeting Best Practices** 💡
197+
198+
From this experience, here are some best practices for multi-targeting .NET global tools:
199+
200+
**1. Use Multi-Targeting, Not Multiple Projects**
201+
```xml
202+
<!-- Good: Single project, multiple targets -->
203+
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
204+
205+
<!-- Bad: Multiple projects for different versions -->
206+
```
207+
208+
**2. Maintain LTS Versions**
209+
210+
Keep the previous LTS version (net8.0) alongside the new one. This gives users flexibility and ensures broad compatibility.
211+
212+
**3. Test All Targets**
213+
214+
The NuGet package includes all target frameworks:
215+
216+
```
217+
tools/net8.0/any/solrevdev.seedfolder.dll
218+
tools/net9.0/any/solrevdev.seedfolder.dll
219+
tools/net10.0/any/solrevdev.seedfolder.dll
220+
```
221+
222+
Verify each target builds correctly and the tool runs on all supported SDKs.
223+
224+
**4. Handle Dependencies Carefully**
225+
226+
When upgrading, check if dependencies support all your target frameworks. If a dependency doesn't support your newest target, you have options:
227+
228+
- Keep the dependency at a compatible version
229+
- Use conditional package references for different targets
230+
- Find an alternative package
231+
232+
**5. Update CI/CD First**
233+
234+
Install all SDK versions in your CI pipeline before merging. This catches incompatibilities early:
235+
236+
```yaml
237+
- name: setup .net core sdk
238+
uses: actions/setup-dotnet@v4
239+
with:
240+
dotnet-version: |
241+
8.0.x
242+
9.0.x
243+
10.0.x
244+
```
245+
246+
**The Results** 📊
247+
248+
After merging [PR #17](https://github.com/solrevdev/seedfolder/pull/17), the CI/CD pipeline automatically:
249+
250+
1. Built all three target frameworks
251+
2. Ran integration tests
252+
3. Packaged the NuGet package
253+
4. Published version 1.4.0 to NuGet
254+
255+
Users can now install the updated version:
256+
257+
```bash
258+
dotnet tool update --global solrevdev.seedfolder
259+
seedfolder --version
260+
# Output: seedfolder version 1.4.0
261+
```
262+
263+
The tool automatically uses the highest installed SDK when run, so users with .NET 10 get the latest performance improvements while users on .NET 8 or 9 continue to work seamlessly.
264+
265+
**Framework Support Timeline** 📅
266+
267+
Current support timeline for SeedFolder:
268+
269+
| Framework | Type | Support Until | Status |
270+
|-----------|------|---------------|--------|
271+
| .NET 8.0 | LTS | November 2026 | ✅ Supported |
272+
| .NET 9.0 | STS | 18 months | ✅ Supported |
273+
| .NET 10.0 | LTS | November 2028 | ✅ Supported |
274+
275+
**Lessons Learned** 🎓
276+
277+
1. **Multi-targeting is powerful**: Adding .NET 10 support while maintaining .NET 8 and 9 compatibility was trivial thanks to proper multi-targeting setup.
278+
279+
2. **Dependency management matters**: Always check dependencies when upgrading. Sometimes staying on older (but stable) dependency versions is the right choice.
280+
281+
3. **Testing is essential**: Local testing before publishing caught issues that automated tests might miss.
282+
283+
4. **Documentation updates are important**: Users need to know what versions are supported and what's changed.
284+
285+
5. **CI/CD automation pays off**: Once configured properly, the entire build-test-publish pipeline runs automatically on merge.
286+
287+
**What's Next?** 🔮
288+
289+
With .NET 10 support in place, SeedFolder is well-positioned for the future. The next areas of focus include:
290+
291+
- Template marketplace functionality ([Issue #15](https://github.com/solrevdev/seedfolder/issues/15))
292+
- Additional project templates based on community feedback
293+
- Enhanced template customization options
294+
295+
The full source code and history of this upgrade are available on [GitHub](https://github.com/solrevdev/seedfolder/pull/17).
296+
297+
**Installation** 📦
298+
299+
Try the latest version with .NET 10 support:
300+
301+
```bash
302+
# Install or update to the latest version
303+
dotnet tool update --global solrevdev.seedfolder
304+
305+
# Create a new project with your favorite template
306+
seedfolder --template python my-new-project
307+
308+
# Or use interactive mode
309+
seedfolder
310+
```
311+
312+
Success! 🎉
Lines changed: 68 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)