How to have app.xaml & *.xaml files listed in .csproj when using upgrade assistant to migrate from 4.5 to 6.0

devarakonda ramakrishna 0 Reputation points

I am using Microsoft's upgrade assistant to migrate projects from 4.5 to 6.0. I am able to have ".cs" files included in the .csproj file by default by modifying the values of "EnableDefaultItems", "EnableDefaultCompileItems" to false in Microsoft.NET.Sdk.DefaultItems.targets. But for app.xaml & *.xaml files I am not able to find a similar setting that works. I tried modifying "EnableDefaultPageItems" & "EnableDefaultApplicationDefinition" to false in Microsoft.NET.Sdk.WindowsDesktop.targets but no luck.

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,559 questions
{count} votes

1 answer

Sort by: Most helpful
  1. devarakonda ramakrishna 0 Reputation points


    This is what I had in the new .csproj even after adding the suggested file.

    <Project Sdk="Microsoft.NET.Sdk">
        <Compile Include="Class1.cs" />
        <Compile Include="Class2.cs" />
        <PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
        <PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
        <PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.421302">
        <PackageReference Include="Microsoft.Windows.Compatibility" Version="7.0.1" />

    The below are still missing from .csproj file

    <Compile Include="UserControl1.xaml.cs">
        <Page Include="MainWindow.xaml">
        <Compile Include="App.xaml.cs">