1.去掉App.xaml
StartupUri=“MainWindow.xaml”
只會讓App.g.cs 不生成這行代碼,但是還是會生成的App.g.cs文件中生成Main方法
this.StartupUri = new System.Uri("MainWindow.xaml", System.UriKind.Relative);
默認的App.xaml的生成操作是 應用程序定義,將其修改為頁
在VS中的屬性界面修改存在問題,編輯項目文件,添加下面代碼
在vs中屬性界面修改成頁會在項目文件中增加,但是存在問題
圖標變成
<ItemGroup><ApplicationDefinition Remove="App.xaml" />
</ItemGroup>
修改項目文件。圖標正常
<ItemGroup><ApplicationDefinition Remove="App.xaml" /><Page Include="App.xaml" /></ItemGroup>
修改成頁后生成的文件就不生成main方法了
StartupUri=“MainWindow.xaml”
去掉StartupUri=“MainWindow.xaml”