需要帮助。创建新的C#WPF项目时出错。 [英] Help Needed. Error when create a new C# WPF project.

查看:231
本文介绍了需要帮助。创建新的C#WPF项目时出错。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Friend,



我在Microsoft Visual Studio 2010中创建新的c#WPF项目时遇到问题。

以下是我的编码是xaml,

Hello Friend,

I'm facing a problem when creating a new c# WPF project in Microsoft Visual Studio 2010.
The following is my coding is xaml,

<Window x:Class="OfflineCartHMI.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        
    </Grid>
</Window>



以下是MainWindow.xaml.cs中的C#代码


The following is the C# code in MainWindow.xaml.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace OfflineCartHMI
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
    }
}





一切看起来都不错,但它显示以下错误:



Everything looks fine but it show the following error:

The type 'Window' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

The type 'Grid' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.	



任何人有什么想法来解决这个问题?


Anyone has any ideas to solve this problem?

推荐答案

请看我对这个问题的评论。



如果只是确保将以下程序集添加到引用中,则可以随时修复报告的错误:系统 System.Code 也推荐), PresentationCore PresentationFramework WindowBase 。引用是从GAC(添加引用窗口的.NET选项卡)添加的。而已。是不是很简单?



如果您的VS安装或某些模板坏了,请尝试重新安装所有内容。如果您不小心丢失了一些引用或继承了一些不一致的项目,请修复它或从头开始构建并添加源文件。等等...



-SA
Please see my comment to the question.

You can always fix the errors you reported if you simply make sure you added the following assemblies to references: System (System.Code also recommended), PresentationCore, PresentationFramework and WindowBase. The referenced are added from GAC (the tab ".NET" of the "Add Reference" window). That's it. Isn't that simple?

If your VS installation or some of the templates are broken, try to reinstall everything. If you accidentally lost some references or inherited some inconsistent project, fix it or build from scratch and add you source files. And so on…

—SA


这篇关于需要帮助。创建新的C#WPF项目时出错。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆