愚蠢的是,我错误地删除了我的App.xml和App.xml.cs文件。
我能够重新创建这些文件,因为我使用源代码控制(有点过时,令人遗憾),但是当我重新创建这些文件并将它们添加回我的项目时,VS无法构建项目,因为我告知了我没有入口点。
我的解决方法是创建一个带有'Main'关键字的加载类,用于应用程序条目,关联是项目,但是重新创建和重新关联我的App.xml和App.xml.cs文件的正确步骤是什么在我的项目中的VS.
非常感谢。
答案 0 :(得分:3)
您的问题引起了我的兴趣,因此我创建了一个新项目,并删除了App.xaml
和App.xaml.cs
文件。然后我向项目添加了一个窗口,并将文件属性编辑器中的构建操作从ApplicationDefinition
更改为Page
,然后我将xaml
和xaml.cs
文件更改为应用类。之后它正常工作。
即
<强>的App.xaml 强>
<Application x:Class="WpfApplication1.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>
<强> App.xaml.cs 强>
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
namespace WpfApplication1
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}