Skip to content

Commit 3d9d504

Browse files
committed
Readme WIP
1 parent e7b5b0e commit 3d9d504

File tree

3 files changed

+144
-75
lines changed

3 files changed

+144
-75
lines changed

.markdownlint.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"MD033": {
3+
"allowed_elements": ["br"]
4+
}
5+
}

.prettierrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

README.md

Lines changed: 138 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -4,63 +4,93 @@
44

55
## Background
66

7-
There are many great resources for learning how to build a new solution using CMS 12 and Commerce 14. The official [developer documentation](https://world.optimizely.com) has been updated, the official [user guide](https://webhelp.optimizely.com) has been updated, and an excellent [masterclass](https://www.optimizely.com/support/education/product/migrating-to-optimizely-cms-12-and-commerce-14) is hosted by Mark Price and Scott Reed (to name a few). But there aren’t many resources sharing information on how to take an existing CMS 11 / Commerce 13 solution and upgrade it to .NET 5+.
7+
There are many great resources for learning how to build a new solution using
8+
CMS 12 and Commerce 14. The official [developer documentation](https://world.optimizely.com)
9+
has been updated, the official [user guide](https://webhelp.optimizely.com) has
10+
been updated, and an excellent [masterclass](https://www.optimizely.com/support/education/product/migrating-to-optimizely-cms-12-and-commerce-14)
11+
is hosted by Mark Price and Scott Reed (to name a few). But there isn't much
12+
information on how to take an existing CMS 11 / Commerce 13 solution and upgrade
13+
it to .NET 5+.
14+
15+
This blog post is not intended to be the definitive guide for ugprading an
16+
existing solution to .NET 5+, but rather a collection of learnings from
17+
misadventures in upgrading two Commerce 13 solutions to date. One the eve of
18+
.NET 5 falling out of LTS...
819

920
## Prerequisites
1021

22+
Make sure that your solution is ready to upgrade.
23+
1124
### 1. Read the official documentation
1225

13-
1. [Upgrading to Content Cloud (CMS 12)](https://docs.developers.optimizely.com/content-cloud/v11.0.0-content-cloud/docs/upgrading-to-content-cloud-cms-12)
14-
2. [Breaking changes in Content Cloud (CMS 12)](https://docs.developers.optimizely.com/content-cloud/v11.0.0-content-cloud/docs/breaking-changes-in-content-cloud-cms-12)
15-
3. [System requirements for Optimizely (CMS 12)](https://docs.developers.optimizely.com/content-cloud/v12.0.0-content-cloud/docs/system-requirements-for-optimizely)
26+
1. [Upgrading to Content Cloud (CMS 12)](https://docs.developers.optimizely.com/content-cloud/v11.0.0-content-cloud/docs/upgrading-to-content-cloud-cms-12)
27+
2. [Breaking changes in Content Cloud (CMS 12)](https://docs.developers.optimizely.com/content-cloud/v11.0.0-content-cloud/docs/breaking-changes-in-content-cloud-cms-12)
28+
3. [System requirements for Optimizely (CMS 12)](https://docs.developers.optimizely.com/content-cloud/v12.0.0-content-cloud/docs/system-requirements-for-optimizely)
1629

1730
### 2. Be on .NET Framework 4.7.2 or higher
1831

19-
CMS 11 only [requires](https://docs.developers.optimizely.com/content-cloud/v11.0.0-content-cloud/docs/system-requirements-for-optimizely) .NET Framework 4.6.1, but Microsoft [recommends](https://docs.microsoft.com/en-us/dotnet/core/porting/premigration-needed-changes) being on 4.7.2 or higher when using Upgrade-Assistant
32+
CMS 11 only [requires](https://docs.developers.optimizely.com/content-cloud/v11.0.0-content-cloud/docs/system-requirements-for-optimizely)
33+
.NET Framework 4.6.1, but Microsoft [recommends](https://docs.microsoft.com/en-us/dotnet/core/porting/premigration-needed-changes)
34+
being on 4.7.2 or higher when using Upgrade-Assistant
2035

2136
### 3. Update to the latest version of CMS11 (Commerce13) before upgrading
2237

23-
The official documentation doesn't explicitly say to do this, but is there any reason _not_ to?
38+
The official documentation doesn't explicitly say to do this, but is there any
39+
reason _not_ to?
2440

2541
### 4. Check the status of add-on packages
2642

27-
Optimizely maintains a list of the .NET 5 migration status of the official platform and addon NuGet packages:
43+
Optimizely maintains a list of the .NET 5 migration status of the official
44+
platform and addon NuGet packages:
2845

2946
- [Add-ons platform compatibility (Optimizely Developer Docs)](https://docs.developers.optimizely.com/integrations/v1.1.0-apps-and-integrations/docs/add-ons-platform-compatibility)
3047
- [Add-Ons Status (Optimizely.com)](https://world.optimizely.com/resources/net5/add-ons)
3148

32-
No such list exists for unofficial add-ons (as of this writing). So, when planning the upgrade, give yourself time to check the status of your favorite third party add-ons. Having no workaround for unsupported add-ons could derail your whole upgrade project. Know what you’re getting into.
49+
No such list exists for unofficial add-ons (as of this writing). So, when
50+
planning the upgrade, give yourself time to check the status of your favorite
51+
third party add-ons. Having no workaround for unsupported add-ons could derail
52+
your whole upgrade project. Know what you’re getting into.
3353

34-
Note that some old, .NET Framework add-ons will still work, just with a warning. For example: Authorize.Net. There is no .NET Core+ package, but it still compiles and runs.
54+
Note that some old, .NET Framework add-ons will still work, just with a warning.
55+
For example: Authorize.Net. There is no .NET Core+ package, but it still compiles
56+
and runs when you install it to your .NET 5+ solution via NuGet.
3557

3658
## Upgrade-Assistant
3759

38-
Phase 1: How to use Microsoft's CLI tool for upgrading to .NET 5+
60+
Once you have reviewed the prerequisites and your solution is ready, it's time
61+
to start making changes. The [.NET Upgrade-Assistant](https://dotnet.microsoft.com/en-us/platform/upgrade-assistant)
62+
is Microsoft's CLI tool for upgrading .NET Framework solutions to .NET 5+.
63+
64+
Read and bookmark the official Optimizely documentation: [Upgrade Assistant](https://docs.developers.optimizely.com/content-cloud/v12.0.0-content-cloud/docs/upgrade-assistant)
3965

40-
### Delete Commerce Manager
66+
### 5. Delete Commerce Manager
4167

42-
- As of Commerce 14, Commerce Manager is no more.
43-
- 👏
44-
- Remove the Commerce Manager project before getting started with Upgrade-Assistant.
45-
- Note that some of Commerce Manager’s functionality hasn’t been ported over to the CMS yet and can only be done with APIs:
46-
- Importing and exporting catalogs
47-
- Adding countries and regions
48-
- Adding currencies
49-
- Working with business objects
50-
- Working with catalog and order meta classes and fields
68+
As of Commerce 14, Commerce Manager is no more. 👏
5169

52-
### Delete `node_modules`
70+
Remove the Commerce Manager project before getting started with Upgrade-Assistant.
71+
Take note that some of Commerce Manager’s functionality hasn’t been ported over
72+
to the CMS yet and can only be done with APIs:
5373

54-
As a first step, Upgrade-Assistant copies all files in your solution/project folder into a Backup directory.
74+
- Importing and exporting catalogs
75+
- Adding countries and regions
76+
- Adding currencies
77+
- Working with business objects
78+
- Working with catalog and order meta classes and fields
5579

56-
This can be disabled, but to play it safe:
57-
If you have `node_modules` in the project folder you are upgrading, then delete it before running UA.
80+
### 6. Delete `node_modules`
5881

59-
(don’t forget to stop any local watch)
82+
As a first step, Upgrade-Assistant copies all files in your solution/project
83+
folder into a Backup directory. If you have NPM's `node_modules` directory in
84+
the solution you are upgrading, you _probably_ want to delete it first so you
85+
don't have to sit around waiting for it to be backed up. Upgrade-Assistant's
86+
backup step can be disabled, but to play it safe, delete your `node_modules`
87+
folder before moving forward.
6088

61-
### Use Opti’s Upgrade-Assistant-Extensions
89+
### 7. Use Opti’s Upgrade-Assistant-Extensions
6290

63-
Optimizely provides Upgrade-Assistant extensions with some Opti-specific capabilities:
91+
Upgrade-Assistant can be extended to automatically execute additional commands.
92+
Optimizely has a public GitHub repo for their own Upgrade-Assistant extensions
93+
which provides some Opti-specific capabilities:
6494

6595
- String Replacement
6696
- Remove Default Argument for the TemplateDescriptor Attribute
@@ -70,44 +100,51 @@ Optimizely provides Upgrade-Assistant extensions with some Opti-specific capabil
70100
- Remove obsolete using statements like Mediachase.BusinessFoundation
71101
- Type Mapping like EPiServer.Web.Routing to EPiServer.Core.Routing
72102

73-
Additionally, NuGet packages can be specified and templates for Program.cs and Startup.cs as they are required by .NET 5.0 can be added as well.
74-
75-
Read how it works (there are a couple gotchas):<br/>
76-
https://github.com/episerver/upgrade-assistant-extensions
77-
78-
Learn how to configure UAE:<br/>
79-
https://github.com/episerver/upgrade-assistant-extensions/releases
103+
Additionally, NuGet packages can be specified, and templates for `Program.cs` and
104+
`Startup.cs` (required by .NET 5+) can be added as well.
80105

81-
Ugrade-Assistant-Extensions will do some nice things for you out of the box (i.e., replace `BlockController` with `BlockComponent`\*), but do consider spending some time customizing the config for string/type/class replacements.
106+
Read how it works on GitHub (there are a couple gotchas): [Upgrade Assistant Extensions](https://github.com/episerver/upgrade-assistant-extensions).
107+
Check the [Releases](https://github.com/episerver/upgrade-assistant-extensions/releases)
108+
page to learn what the configuration options are and how to use them.
82109

83-
\*It does not, e.g., change `PageController` `Index` methods into `IndexAsync` methods, though.
110+
Note that, although Ugrade-Assistant-Extensions will do some nice things for you
111+
out of the box (e.g., replace `BlockController`s with `BlockComponent`s), do
112+
expect to spend time customizing the config for string/type/class replacements.
84113

85114
How to get it ready:
86115

87-
1. Download the latest release (Epi.Source.Updater.X.Y.Z.zip):
88-
https://github.com/episerver/upgrade-assistant-extensions/releases
89-
2. Unzip it to your local file system. E.g.,
90-
` C:\Temp\Epi.Source.Updater\`
91-
3. Make your preferred configuration changes
116+
1. Download the latest release (Epi.Source.Updater.X.Y.Z.zip): [Releases](https://github.com/episerver/upgrade-assistant-extensions/releases)
117+
2. Unzip it to your local file system, such as `C:\Temp\Epi.Source.Updater\`.
118+
3. Make your preferred configuration changes.
92119

93-
### Make a plan-of-attack before running Upgrade-Assistant
120+
### 8. Make a plan-of-attack before running Upgrade-Assistant
94121

95122
Upgrade-Assistant can run against a Solution file (`.sln`) or Project file (`.csproj`).
123+
If you run it against the Solution, it is smart enough to analyze your project
124+
dependency tree and execute against one project at a time, in order, starting with
125+
those that has no project dependencies.
96126

97-
If you run it against the Solution, it will execute against the child Projects in sequence according to the project dependency tree.
98-
99-
Example (RE: onion architecture):
127+
For example, consider a fictitious onion architecture inspired `MySolution.sln`.
128+
If you run Upgrade-Assistant against the `.sln`, it will execute against each
129+
project in this order:
100130

101131
1. `MySolution.Domain.csproj`
132+
- Depends on nothing
102133
2. `MySolution.Application.csproj`
134+
- Depends on Domain
103135
3. `MySolution.Web.csproj`
104-
4. (done)
136+
- Depends on Application, which depends on Domain
105137

106-
### Consider doing one CSPROJ at a time
138+
### 9. Consider doing one CSPROJ at a time
107139

108-
Upgrade-Assistant will track progress and start where it left off if you cancel it at any time. But...
140+
Upgrade-Assistant will track progress and start where it left off if you cancel
141+
it at any time. But&mdash;do figure out the dependency sequence first and
142+
consider running UA manually against each Project. This will allow you to
143+
resolve code issues in isolation on a per-Project basis without getting confused
144+
about where you are with UA. Especially if you find yourself mindlessly jamming
145+
that Enter key while it runs.
109146

110-
Do figure out the dependency sequence first and then run UA manually against each Project. This will allow you to resolve code issues in isolation on a per-Project basis without getting confused about where you are with UA.
147+
For example,
111148

112149
1. `MySolution.Domain.csproj`
113150
1. Run Upgrade-Assistant
@@ -122,48 +159,59 @@ Do figure out the dependency sequence first and then run UA manually against eac
122159
2. Fix code issues
123160
3. Commit to source control
124161

125-
### Think about what flags to use
162+
### 10. Think about which flags to use
126163

127-
Basic syntax if your terminal is at the solution root:
164+
Upgrade-Assistant has a number of flags that can modify execution behavior.
128165

129-
```
166+
The UA basic syntax, if your terminal is at the solution root, is the following:
167+
168+
```cli
130169
upgrade-assistant upgrade MySolution.Web/MySolution.Web.csproj --flags-go-here
131170
```
132171

133-
Flags:
172+
Consider using the following flags:
134173

135174
`--extension "c:\temp\epi.source.updater"`<br/>`--target-tfm-support LTS`
136-
<br/>Enables Opti’s Upgrade-Assistant-Extensions
175+
<br/>These two flags enable Opti’s Upgrade-Assistant-Extensions.
137176

138177
`--ignore-unsupported-features`
139178
<br/>This is required for upgrading the web application CSPROJ.
140179

141180
`--skip-backup`
142-
<br/>Without this, UA will copy all solution files into /Backup/ first (RE: delete node_modules). But don’t you have source control?
181+
<br/>Without this, UA will copy all solution files into `/Backup/` first (RE:
182+
deleing `node_modules`). But... don’t you have source control?
143183

144184
`--non-interactive`
145-
<br/>Officially: Microsoft’s documentation says that Upgrade-Assistant is meant to be interactive and to think twice about using this flag.
146-
<br/>Unofficially: If you don’t use this flag, you will be sitting at your keyboard, pressing Enter repeatedly, for hours.
185+
<br/>Officially: Microsoft’s documentation says that Upgrade-Assistant is meant
186+
to be interactive, and that you should think twice about using this flag.
187+
<br/>Unofficially: If you don’t use this flag, you will be sitting at your
188+
keyboard, pressing Enter repeatedly, for hours.
147189

148-
### Install and update Upgrade-Assistant
190+
### 11. Install and update Upgrade-Assistant
149191

150-
Open a terminal from anywhere:
192+
To install Upgrade-Assistant globally on your local machine, open a terminal
193+
from anywhere and enter the following:
151194

152-
```
195+
```cli
153196
dotnet tool install -g upgrade-assistant
154197
dotnet tool update -g upgrade-assistant
155198
```
156199

157-
https://docs.developers.optimizely.com/content-cloud/v12.0.0-content-cloud/docs/upgrade-assistant
200+
### 12. Run Upgrade-Assistant
158201

159-
### Run Upgrade-Assistant
202+
If you've made it this far, you're finally ready to run Upgrade-Assistant.
160203

161204
From a terminal in your solution root (recommended):
162205

163-
`set DefaultTargetFrameworks__LTS=net5.0`
164-
<br/>(this is required by Upgrade-Assistant-Extensions)
165-
206+
```cli
207+
set DefaultTargetFrameworks__LTS=net5.0
166208
```
209+
210+
This ☝ is required by Upgrade-Assistant-Extensions.
211+
212+
Then, with the framework set, enter:
213+
214+
```cli
167215
upgrade-assistant upgrade MySolution.Web/MySolution.Web.csproj
168216
--ignore-unsupported-features
169217
--skip-backup
@@ -172,34 +220,49 @@ upgrade-assistant upgrade MySolution.Web/MySolution.Web.csproj
172220
--target-tfm-support LTS
173221
```
174222

175-
### Wait
223+
This ☝ is written on multiple lines for readability, not for copy-paste.
224+
225+
At this point, Upgrade-Assistant starts doing its thing.
226+
227+
### 13. Wait
228+
229+
Upgrade-Assistant can take from several minutes to, depending on the size of
230+
your solution, hours.
176231

177-
(this can take several minutes up to hours)
232+
### 14. Review the code changes
178233

179-
### Review the code changes
234+
Here are some of the changes you should expect to see when upgrading your web
235+
application solution project.
180236

181237
`+ Properties/launchSettings.json`
182238
<br/>Local server/IIS Express settings. Note that .NET5+ runs on HTTPS by default!
183239

184240
`+ appsettings.Development.json`
185241
<br/>`+ appsettings.json`
186-
<br/>Where your Web.config appSettings and connectionStrings went. TBD on guidance from the DXP team…
242+
<br/>Where your Web.config appSettings and connectionStrings went. TBD on
243+
guidance from the DXP team...
187244

188245
`- packages.config`
189246
<br/>Packages are now referenced in the CSPROJ files.
190247

191248
`+ Program.cs`
192249
<br/>`+ Startup.old.cs`
193-
<br/>Program.cs and Startup.cs will need to be ported over. Look at Foundation for inspiration:
194-
<br/>https://github.com/episerver/Foundation/tree/main/src/Foundation
250+
<br/>Program.cs and Startup.cs will need to be ported over. Look at Foundation
251+
for inspiration: [GitHub](https://github.com/episerver/Foundation/tree/main/src/Foundation).
195252

196-
### Commit the broken code
253+
### 15. Commit the broken code
197254

198-
Do this so that if the code fixes go sideways, you can easily go back to the state immediately after running the Upgrade-Assistant
255+
Be sure to commit the code at this stage, even though it is broken. This way, if
256+
your code fixes go sideways, you can easily go back to the state immediately
257+
after running the Upgrade-Assistant.
199258

200-
Consider checking in `.upgrade-assistant`. This is where UA tracks what steps it has already done.
259+
Do check in `.upgrade-assistant`. This is where UA internally tracks its own
260+
progress, allowing it to pick up where it left off if you need to shut down along
261+
the way. Jot down a reminder to delete this file once the upgrade is complete.
262+
It is not needed by the solution in any way.
201263

202-
Commit frequently from this point on.
264+
Make a mental note to commit frequently from this point on. Comitting progress on
265+
code fixes along the way can be a lifesaver.
203266

204267
### Delete leftover assembly dependencies
205268

0 commit comments

Comments
 (0)