Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editing WinUI projects created with older versions of the extension requires manual changes #4582

Closed
1 of 3 tasks
mikebattista opened this issue Jul 27, 2022 · 0 comments
Closed
1 of 3 tasks
Assignees
Labels
bug The issue relates to the wizard not working or a problem with the generated code.
Milestone

Comments

@mikebattista
Copy link
Collaborator

mikebattista commented Jul 27, 2022

Describe the bug

Due to significant changes in the project templates, we recommend creating a new project with the 5.2 extension and migrating your old project to the new template in order to edit projects.

Editing existing projects is possible but will require manual changes to resolve merge conflicts and other build issues.

  • For Navigation View projects, rename SplitView to NavView in Package.appxmanifest and/or TemplateStudio.xml.
    • Without this change, the Edit Project wizard will be broken
  • Add <ImplicitUsings>enable</ImplicitUsings> to the App and Core project files
    • Fully qualify UnhandledExceptionEventArgs in App.xaml.cs with the Microsoft.UI.Xaml namespace
  • Add <Nullable>enable</Nullable> to the App and Core project files (optional)
    • Without this change, you will receive compiler messages about nullable reference types
    • With this change, you will likely need to update existing code to avoid further messages
  • Add a NuGet package reference to WinUIEx and a Usings.cs file with global using WinUIEx;
  • Add MainWindow.xaml to your project from a project created with the 5.2 extension
    • Update the namespace references in the xaml and cs files to match your existing project namespace
    • Set MainWindow.xaml Build Action to Page in the Properties window
  • Update App.xaml.cs to match the structure of the version from a project created with the 5.2 extension
    • Refactor Host, GetService, and MainWindow
    • Add .UseContentRoot(AppContext.BaseDirectory) after CreateDefaultBuilder()

If you encounter other issues with editing projects created with older versions of the extension, add a comment below and we'll update the guidance here with the manual changes required.

To Reproduce

  1. Create a project with Template Studio version <= 5.1
  2. Edit the project with Template Studio version >= 5.2

Additional context

No response

Applies to the following platforms:

  • WinUI
  • WPF
  • UWP

About your setup

  • Visual Studio Version:
  • Template Studio Wizard Version:
  • Windows Build:
@mikebattista mikebattista added the bug The issue relates to the wizard not working or a problem with the generated code. label Jul 27, 2022
@mikebattista mikebattista added this to the 5.2 milestone Jul 27, 2022
@mikebattista mikebattista self-assigned this Jul 27, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Aug 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug The issue relates to the wizard not working or a problem with the generated code.
Projects
None yet
Development

No branches or pull requests

1 participant