简体   繁体   English

尝试将针对.NET 3.5的项目添加到针对.NET 4.0的现有项目

[英]Trying to add a project targeting .NET 3.5 to an existing project targeting .NET 4.0

I'm trying to integrate SharpVoice, which is targeting .NET 3.5 into an existing project targeting 4.0 Client Profile and I'm getting an error where it cannot find the namespace of SharpVoice. 我正在尝试将Sharp.Voice(将.NET 3.5定位到现有的针对4.0 Client Profile的项目中),但是却遇到了无法找到SharpVoice命名空间的错误。

The type or namespace name 'SharpVoice' could not be found

I read online that it could be because they are targeting different .NET versions, but when I try to change the SharpVoice target to .NET 4.0 Client Profile, I get a bunch of errors. 我在网上阅读这可能是因为它们针对的是不同的.NET版本,但是当我尝试将SharpVoice目标更改为.NET 4.0客户端配置文件时,出现了很多错误。

I also read that it is possible to integrate older versions of .NET in the newer ones, but it's not working. 我还读到可以将较旧版本的.NET集成到较新版本中,但是它不起作用。

Has anyone come across this problem and how did you fix it? 有谁遇到过这个问题,您如何解决?

Found it. 找到了。

SharpVoice references System.Web ( here , line 7) which is only available in the full framework. SharpVoice引用System.Web在此处 ,第7行),仅在完整框架中可用。 Client Profile doesn't allow that. 客户资料不允许这样做。

So, you have two choices. 因此,您有两种选择。 Either rework SharpVoice to no longer have a dependency on System.Web OR retarget your main application from Client Profile to instead use the full framework. 重做SharpVoice,使其不再依赖System.Web,或者从Client Profile重新定位主应用程序,以使用完整的框架。

I think the second option is going to be far easier to do as removing System.Web appears to require a complete rewrite of that code. 我认为第二种选择将更容易实现,因为删除System.Web似乎需要完全重写该代码。 Note that changing your main app to use the full framework means you can leave the original google code in .net 3.5. 请注意,将主应用程序更改为使用完整框架意味着您可以将原始Google代码保留在.net 3.5中。

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

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