简体   繁体   English

Visual Studio和名称空间

[英]Visual Studio and namespaces

I am attempting to move some code from one VS2008 project to another. 我试图将一些代码从一个VS2008项目移到另一个。

The project I am taking the code from works perfectly and I am not changing the code in any way when copying it to the new project. 我从中获取代码的项目可以正常工作,并且在将代码复制到新项目中时不会以任何方式更改代码。

The code is along the lines of : 代码大致如下:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Diagnostics;

using System.ComponentModel;
using System.ComponentModel.Design;
using System.ComponentModel.Design.Serialization;
using System.Reflection;
using System.Windows.Forms;
using System.Windows.Forms.Design;

namespace CommonTools
{

public class ColumnCollectionEditor : CollectionEditor
{
     .....
}
}

The problem I have is that in the "new" project VS does not find "CollectionEditor" within the supplied namespaces and as such the project will not build. 我遇到的问题是,在“新”项目中,VS在提供的名称空间中找不到“ CollectionEditor”,因此该项目无法构建。

Both the "new" and "old" projects are targeting .NET 3.5 “新”和“旧”项目都针对.NET 3.5

Any ideas where I am going wrong here. 任何我在这里出错的想法。

Do you have the 你有吗

 System.Design.dll

assembly added to your refenerances? 装配增加您的兴趣?

you can see in which namespace and assembly it is at CollectionEditor Class 您可以在CollectionEditor类中看到它在哪个名称空间和程序集中

Make sure your new project references the same assemblies that your old project did. 确保新项目引用的程序集与旧项目引用的程序集相同。

MSDN Says that System.ComponentModel.Design.ColectionEditor is in System.Design.dll . MSDNSystem.ComponentModel.Design.ColectionEditorSystem.Design.dll

您是否尝试过在原始解决方案中的CollectionEditor上使用“转到定义”以查看应包含的内容?

您是否包含此“ System.Design.dll”?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM