为什么我不能添加一些文件类型VS2010项目? [英] Why can't I add certain file types to VS2010 projects?

查看:506
本文介绍了为什么我不能添加一些文件类型VS2010项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想一个WPF ResourceDictionary中添加对创建前一阵子C#项目。该项目最初并不是一个WPF的项目,但现在我需要在它的一些WPF资源。

I'm trying to add a WPF ResourceDictionary to a C# project that was created a while ago. The project was not originally a WPF project, but now I need to include some WPF resources in it.

当我用鼠标右键单击该项目并选择添加,ResourceDictionary中是不是一种选择。即使我打开模态对话框并导航到ResourceDictionary的类型应该是(沿着一侧的另一个WPF类型),它不存在。

When I right click the project and select "Add", ResourceDictionary is not an option. Even if I open the Modal dialog box and navigate to where the ResourceDictionary type should be (along side the other WPF types), it is not present.

此外,当我手动添加具有ResourceDictionary的语法项目中的XAML文件,我不能以编程方式使用WPF Application.Load(URI)的语法加载它,所以我觉得VS2010是阻止我加入该文件的一个原因。

Also, when I manually add a XAML file that has ResourceDictionary syntax to the project, I can't programmatically load it using WPF Application.Load(uri) syntax, so I feel VS2010 is preventing me from adding the file for a reason.

我怎样才能让我的项目能够有一个ResourceDictionary中添加不用从头重新创建整个项目作为一个WPF项目,并从头开始重新添加的所有文件?

How can I make my project "able" to have a ResourceDictionary added without recreating the entire project from scratch as a WPF project and re-adding every file from scratch?

此外,什么定义了可以添加到项目中,所以我可以在将来避免类似问题的文件类型?希望这是一些简单的像一条线,我需要添加到我的AssemblyInfo.cs文件。

Additionally, what defines the file types that can be added to projects so I can avoid similar problems in the future? Hopefully it's something simple like a line I need to add to my AssemblyInfo.cs file.

推荐答案

关闭项目。创建一个新的项目,就是你会使用WPF项目的类型。然后用记事本打开新的.csproj文件。找到 ProjectTypeGuids 元素。这些的GUID复制到剪贴板。在记事本中打开现有的.csproj文件。这些附加的GUID到这个文件的 ProjectTypeGuids 元素。 (检查愚弄。)在Visual Studio中刷新项目。你现在应该可以添加所有的WPF文件类型

Close the project. Create a new project that is of the type of WPF project you would have used. Then open the new .csproj file in notepad. Find the ProjectTypeGuids element. Copy those GUIDs to clipboard. Open your existing .csproj file in notepad. Append those GUIDs into this file's ProjectTypeGuids element. (Check for dupes.) Reload your project in Visual Studio. You should be able to add all the WPF file types now.

PS:我还没有与WPF这样做专,但我有与其他项目类型,它有。工作没有问题。

PS: I haven't done this with WPF specifically, but I have with other project types and it has worked without issue.

我相信GUID是每个人都一样,所以你需要应该是值: {60dc8134-eba5-43b8-bcc9 -bb4bc16c2548}。{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} ...这应该救你创建新项目的步骤

I believe the GUIDS are the same for everyone so the values you need should be: {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} ... this should save you the step of creating a new project.

这篇关于为什么我不能添加一些文件类型VS2010项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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