在.NET 3.5中使用NATUPNPLib时出现问题 [英] Problem while using NATUPNPLib in .NET 3.5
问题描述
大家好1,
我在使用NATUPnPLib时遇到问题.当项目在.Net 4上运行时,我有一段代码可以很好地工作.但是,不幸的是,当我在.Net3.5中尝试同一段代码时,在构建时会遇到一些程序集引用错误.
Hello Every1,
I am having trouble using the NATUPnPLib. I have a piece of code that works perfectly fine while the project is running on .Net 4. But, unfortunately when I try the same piece of code in .Net3.5, I get some assembly reference errors while building.
UPnPNATClass upnpnat = new UPnPNATClass();
IStaticPortMappingCollection mappings = upnpnat.StaticPortMappingCollection;
而且我收到以下构建错误:
And i get the following build errors:
The type or namespace name 'UPnPNATClass' could not be found (are you missing a using directive or an assembly reference?
尽管我已从添加参考->将参考添加到NatUPnP库. COM
我搜寻了互联网以找到解决方案,但找不到任何帮助.我希望这里有人可以提供帮助.
PS:我遵循了此链接
谢谢问候,
Umer
Although i have added the reference to the NatUPnP Library from Add Reference --> COM
I have scoured the internet to find a solution but i was unable to find any help. I hope someone here might be able to help out.
P.S: I followed this link
Thanx & Regards,
Umer
推荐答案
我刚刚使用.net 3.5创建了一个小项目,并添加了对NATUPNPLib的引用.我打开了对象浏览器,但NATUPNPLib不包含一个名为UPnPNATClass的类.这就是错误消息的意思.
当我将项目更改为.net 4.0时,对象浏览器中存在类UPnPNATClass.
您发布的链接似乎只描述了.Net 4.0的解决方案.
抱歉,即使它不是真正的解决方案,我还是将其发布为解决方案.但是IMO可以回答您的问题.[/编辑]
I just created a little project with .net 3.5 an added a reference to the NATUPNPLib. I opened the object browser but NATUPNPLib doesn''t contain a class called UPnPNATClass. And thats''s what the error message is saying.
When I change the project to .net 4.0 the class UPnPNATClass exists in the object browser.
It looks like the link you posted only describes a solution for .Net 4.0.
Sorry, I posted it as a solution, even if it is not a real solution. But IMO it answers your question.[/Edit]
我尽了一切可能,但得出的结论是您不能使用.NET3.5中指定的方法
I tried everything possible, and i got to the conclusion that you can''t use the method specified above in .NET3.5
这篇关于在.NET 3.5中使用NATUPNPLib时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!