引用多文件程序集 [英] Referencing a multifile assembly

查看:50
本文介绍了引用多文件程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做一些看似简单的事情时遇到了麻烦。我仍然不是很熟悉Visual Studio 2003,所以如果我错过了一些东西,请道歉

很明显。


基本上我的问题如下。我有2个文件,每个包含

一个非常简单的类。我将它们编译为.netmodules。两个类

都在相同的命名空间下。


然后我将这些.netmodules文件捆绑到一个dll中。这给了我一个由文件确认的3个文件的组件。


现在我创建一个新项目并添加对dll的引用我只是

创建。这具有将3个文件复制到我的

调试目录中的目录中的效果。到现在为止还挺好。然后我在

命名空间中使用using指令,其中两个类都是。


问题是我不能从我的新项目中访问这些类。双击

点击解决方案资源管理器中的参考文件,将我发送到

对象浏览器,在那里我可以看到

有问题引用,因为我看不到那里的命名空间。它实际上是空的。所以我

可能错过了某个地方,但是在哪里?


感谢您的帮助。

I''m having trouble doing someting apparently simple. I''m still not very
familiar with Visual Studio 2003, so apologies if I''ve missed something
obvious.

Basically my problem is the following. I have 2 files that contain each
one a very simple class. I compiled them as .netmodules. Both classes
are under the same namespace.

I then bundled these .netmodules files into a dll. This gives me an
assembly of 3 files which was confirmed by the manifest.

Now I create a new project and add a reference to the dll I just
created. This has the effect of copying the 3 files in a directory in my
debug directory. So far so good. I then use a using directive for the
namespace in which both classes are.

Problem is I stil can''t access these classes from my new project. Double
clicking on the reference from the Solution Explorer sends me to the
object browser where I can see that there is something wrong with the
reference as I can''t see the namespace there. It''s in fact empty. So I
probably missed a step somewhere, but where?

Thanks for your help.

推荐答案

你好Pollux,


我会根据你的写作假设。如果我错了请纠正我。


只需说:


您使用了一个名为ParentProject的大型命名空间

你在ParentProject中有2个子命名空间 - ParentProject.AppA和ParentProject.AppB


所以层次结构


ParentProject //一个空白的解决方案

- > ParentProject.AppA // C#类库项目

----> Car.cs

- > ParentProject.AppB // C#类库项目

----> Motor.cs

- >测试者// C#Windows App测试程序


在测试人员中,


您将添加对ParentProject.AppA和ParentProject.AppB的引用


然后在你的C#Test Form1.cs里面


你添加这个:


使用ParentProject.AppA ;

使用ParentProject.AppB;

//永远不要指望这个好,如下所示:

//使用ParentProject.AppA.Car; //永远不会在这里工作。


....


当你想给汽车打电话


Car carValue = new Car(); //它在这里工作..不在指令。


与其他人相同。


希望它对你有所帮助。希望你得到正确的概念。祝你好运。

-

问候,

Chua Wen Ching :)

" Pollux"写道:
Hi Pollux,

I will assume from what you write. Please correct me if i am wrong.

Just say:

You had using 1 large namespace called ParentProject

You had 2 sub namespaces within ParentProject - ParentProject.AppA and ParentProject.AppB

So the hierarchy

ParentProject // a blank solution
--> ParentProject.AppA // C# class library project
----> Car.cs
--> ParentProject.AppB // C# class library project
----> Motor.cs
--> Tester // C# Windows App Test Program

Inside your Tester,

you will add references to ParentProject.AppA and ParentProject.AppB

then inside your C# Test Form1.cs

you add this:

using ParentProject.AppA;
using ParentProject.AppB;
// never expect this okay, as below:
// using ParentProject.AppA.Car; // never will work here.

....

when you want to call the Car

Car carValue = new Car(); // It works here.. not at the directives.

Same to the others.

Hope it helps you a bit. Hope you get the right concept. Good Luck.
--
Regards,
Chua Wen Ching :)
"Pollux" wrote:
我在做一些看似简单的事情时遇到了麻烦。我对Visual Studio 2003还不是很熟悉,所以如果我错过了很明显的东西,请道歉。

基本上我的问题如下。我有2个文件,每个文件都包含一个非常简单的类。我将它们编译为.netmodules。这两个类都在相同的命名空间下。

然后我将这些.netmodules文件捆绑到一个dll中。这给了我一个由清单确认的3个文件的汇编。

现在我创建一个新项目并添加对我刚刚创建的dll的引用。这具有将3个文件复制到我的
调试目录中的目录中的效果。到现在为止还挺好。然后我在
命名空间中使用using指令,其中两个类都是。

问题是我不能从我的新项目中访问这些类。双击解决方案资源管理器中的引用将我发送到
对象浏览器,在那里我可以看到
引用有问题,因为我看不到那里的命名空间。它实际上是空的。所以我可能错过了某个地方的步骤,但在哪里?

感谢您的帮助。
I''m having trouble doing someting apparently simple. I''m still not very
familiar with Visual Studio 2003, so apologies if I''ve missed something
obvious.

Basically my problem is the following. I have 2 files that contain each
one a very simple class. I compiled them as .netmodules. Both classes
are under the same namespace.

I then bundled these .netmodules files into a dll. This gives me an
assembly of 3 files which was confirmed by the manifest.

Now I create a new project and add a reference to the dll I just
created. This has the effect of copying the 3 files in a directory in my
debug directory. So far so good. I then use a using directive for the
namespace in which both classes are.

Problem is I stil can''t access these classes from my new project. Double
clicking on the reference from the Solution Explorer sends me to the
object browser where I can see that there is something wrong with the
reference as I can''t see the namespace there. It''s in fact empty. So I
probably missed a step somewhere, but where?

Thanks for your help.



再次pollux ,


什么是* .netmodules?介意分享。我之前从未见过。


谢谢。

-

问候,

Chua Wen Ching :)

" Chua Wen Ching"写道:
Hi pollux again,

What is *.netmodules? Mind to share it. I never seen it before.

Thanks.
--
Regards,
Chua Wen Ching :)
"Chua Wen Ching" wrote:
嗨Pollux,

我会假设你写的。如果我错了请纠正我。

请说:

您使用了一个名为ParentProject的大型命名空间

您在ParentProject中有2个子命名空间 - ParentProject.AppA和ParentProject.AppB

所以层次结构

ParentProject //一个空白的解决方案
- > ParentProject.AppA // C#类库项目
----> Car.cs
- > ParentProject.AppB // C#类库项目
----> Motor.cs
- >测试人员// C#Windows App测试程序

在测试人员内部,

您将添加对ParentProject.AppA和ParentProject.AppB的引用

然后在里面你的C#Test Form1.cs
你添加这个:

使用ParentProject.AppA;
使用ParentProject.AppB;
//永远不要指望这个好吗,如下所示:
//使用ParentProject.AppA.Car; //永远不会在这里工作。



什么时候打电话给汽车

Car carValue = new Car(); //它在这里工作..不在指令。

与其他人相同。

希望它对你有所帮助。希望你得到正确的概念。祝你好运。
-
问候,Chua Wen Ching :)

" Pollux"写道:
Hi Pollux,

I will assume from what you write. Please correct me if i am wrong.

Just say:

You had using 1 large namespace called ParentProject

You had 2 sub namespaces within ParentProject - ParentProject.AppA and ParentProject.AppB

So the hierarchy

ParentProject // a blank solution
--> ParentProject.AppA // C# class library project
----> Car.cs
--> ParentProject.AppB // C# class library project
----> Motor.cs
--> Tester // C# Windows App Test Program

Inside your Tester,

you will add references to ParentProject.AppA and ParentProject.AppB

then inside your C# Test Form1.cs

you add this:

using ParentProject.AppA;
using ParentProject.AppB;
// never expect this okay, as below:
// using ParentProject.AppA.Car; // never will work here.

...

when you want to call the Car

Car carValue = new Car(); // It works here.. not at the directives.

Same to the others.

Hope it helps you a bit. Hope you get the right concept. Good Luck.
--
Regards,
Chua Wen Ching :)
"Pollux" wrote:
我在做一些看似简单的事情时遇到了麻烦。我对Visual Studio 2003还不是很熟悉,所以如果我错过了很明显的东西,请道歉。

基本上我的问题如下。我有2个文件,每个文件都包含一个非常简单的类。我将它们编译为.netmodules。这两个类都在相同的命名空间下。

然后我将这些.netmodules文件捆绑到一个dll中。这给了我一个由清单确认的3个文件的汇编。

现在我创建一个新项目并添加对我刚刚创建的dll的引用。这具有将3个文件复制到我的
调试目录中的目录中的效果。到现在为止还挺好。然后我在
命名空间中使用using指令,其中两个类都是。

问题是我不能从我的新项目中访问这些类。双击解决方案资源管理器中的引用将我发送到
对象浏览器,在那里我可以看到
引用有问题,因为我看不到那里的命名空间。它实际上是空的。所以我可能错过了某个地方,但在哪里?

感谢您的帮助。
I''m having trouble doing someting apparently simple. I''m still not very
familiar with Visual Studio 2003, so apologies if I''ve missed something
obvious.

Basically my problem is the following. I have 2 files that contain each
one a very simple class. I compiled them as .netmodules. Both classes
are under the same namespace.

I then bundled these .netmodules files into a dll. This gives me an
assembly of 3 files which was confirmed by the manifest.

Now I create a new project and add a reference to the dll I just
created. This has the effect of copying the 3 files in a directory in my
debug directory. So far so good. I then use a using directive for the
namespace in which both classes are.

Problem is I stil can''t access these classes from my new project. Double
clicking on the reference from the Solution Explorer sends me to the
object browser where I can see that there is something wrong with the
reference as I can''t see the namespace there. It''s in fact empty. So I
probably missed a step somewhere, but where?

Thanks for your help.



在文章< C5 ********************************** @ microsoft.co m> ;,
ch ************ @ nospam.hotmail.com 说...
In article <C5**********************************@microsoft.co m>,
ch************@nospam.hotmail.com says...
嗨pollux再次,

什么是* .netmodules?介意分享。我以前从未见过它。

谢谢。
Hi pollux again,

What is *.netmodules? Mind to share it. I never seen it before.

Thanks.




我是.Net的新手,但是如果你熟悉Win32的话编程,最让人想到的是一个.lib文件或静态链接的

库。我认为正确的名称是类库。



I''m new to .Net, but if you''re familiar with Win32 programming, the
closest thing that comes to mind is a .lib file or a statically linked
library. I think the proper name is Class library.


这篇关于引用多文件程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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