Click here to Skip to main content
15,846,038 members
Articles / Web Development / HTML

Simple Side By Side Migration Project Template for WPF .NET Core 3.1

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
4 Jul 2020CPOL3 min read 5K   43   3  
An aid to Port WPF Framework Applications to .NET Core 3.1
A template .csproj file to aid in porting your WPF applications to .NET Core


.NET Core 3.1 WPF is ready. It works fabulously. The new SDK Style .cs project has brevity and does not generate GUIDS secretly, it intuitively 'knows' what to compile. As we migrate, and we should, many of us will want a Side-by-Side Migration Strategy.

Side-by-Side Strategy Means

  1. Your legacy framework project is still available and runs and deploys.
  2. The ported csproj will be located in the same folder as the legacy framework project.
  3. The XAML designer will work.
  4. Build all / Clean all for solution will work as expected.
  5. There is no Project Template that actually works to build such a project.

Templates in Visual Studio 2019

There is, by now, a terrifyingly large number of Templates these days in Visual Studio. Unfortunately, there are also missing templates; the missing Template is one that allows your app to be compiled in a Side By Side Strategy. That missing template is provided here: (gist) albeit in a somewhat manual form.

As opposed to going on Deep-dive about the new .NET Core project, let's compare two csprojects and get an app I wrote working in side-by-side mode. The project we will test out has an article written about it here.

Trying Out the Template (A 12 Step Program)

  1. Open un-ported sample WPF project here:
  2. Verify Compile.
  3. Verify XAML Designer is displaying app at design time open mainwindow.xaml.
  4. Verify Run (Take time to learn how the app behaves).
  5. In solution EXP, Right click and unload the project [Sweeper].
  6. In Solution EXP, open the Solution Items node and view: [Sweeper.csproj] notice 306 lines.
  7. In Solution EXP, open the Solution Items and now and view [SweeperCore.csproj] notice 45 lines.
  8. In Solution EXP, Reload [Sweeper.csproj].
  9. In Solution EXP, Right Click on solution -> Add Existing project [SweeperCore.csproj].
  10. Build All.
  11. Verify the Designer is working.
  12. Run and verify the Core Project SweeperCore.

I have provided a gist of the proposed migration template. I will be updating it as I learn more from other projects. I hope to hear from those of you trying side-by-side migations with this gist as your starting point. 

Keep in mind that there are only three things that need to be modified in the gist template in the <!-- Commented part -->

  1. <AssemblyName>XXXX</AssmeblyName>
  2. <RootNamespace>YYYY</RootNamespace>
  3. <!-- Customize Resource Statements For your Project Start-->

You may modify by hand in csproj or in IDE. If IDE, the first 2 are on project Properties->Application tag. The Resource Statements can be modified by changing the Build Action to "Resource" for each individual file. Alternatively, you can include a recursive file pattern that includes subfolders:

        <Resource Include="Resources\**\*.png" />
        <Resource Include="Resources\**\*.ico" />

What I Learned

  • The csproject can be greatly simplified in .NET Core.
  • .NET Core Rocks. .NET Core will not be another WinRT bridge to nowhere.
  • The new project format has a learning curve, but it is worth the effort. It knew what folders had stuff to compile in them and did so without being spelled out.
  • The new project and old project format seem to struggle at co-existing.
  • Most of the length of the core project was aimed at making it co-exist with the old.
  • It is beneficial to make them co-exist, the benefits include access to the designer and orderly migration from legacy to .NET Core.
  • You can spend a lot of time reading documents, trying tools, getting confused and still not be ported.
  • The new SDK Style project is awesome.
  • Microsoft should address rapid porting and provide a migration template in Visual Studio.

Next Steps

  1. Try the .NET Core Template on your Framework projects there are use this gist.
  2. Give me feedback and problems from others using this template. Put in comments below.
  3. With feedback, build a Visual Studio plugin that performs the preceding manual steps.

I hope this helps you get ported ASAP! If it did, let me know. If it did not, let me know that as well. Please place your github url in the comments. Ready! Set! Port!


  • 4th July, 2020: Initial publication


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

-- There are no messages in this forum --