将VS2010升级到2013引入了SendGrid的编译错误

时间:2014-07-24 12:59:30

标签: visual-studio sendgrid

我昨天安装了Visual Studio 2013的终极试用版,看它是否对我们目前的2010年项目产生了负面影响。当试图编译一个以前没有问题但仍然在我的同事计算机上编译的项目时,我遇到了这个错误:

The type or namespace name 'SendGridMail' could not be found (are you missing a using directive or an assembly reference?)

从Visual Studio 2010或2013

运行时,错误相同

在此处查看类似问题表明,使用.net 4 Client Profile而不是标准.net 4时会发生这种情况,但此项目始终使用标准.net 4。

另一个问题是使用最新版本的sendgrid(4.x)和.net 4,我知道它不起作用,但我们使用的是旧版本(1.2.1)。

就我个人而言:

  • 删除和读取引用(最初是在项目中引用的,我也尝试在外部引用它)
  • 运行没有插件的Visual Studio
  • 在另一个解决方案中重新创建项目

到目前为止我唯一的运气就是使用nuget来安装sendgrid软件包,但这似乎增加了很多额外的文件,而且我现在对以前工作的构建有什么感兴趣除了安装另一个版本的Visual Studio之外,没有对项目进行任何更改就停止了工作。

编辑:

这是尝试使用SendGridMail dll构建时的输出(成功,因为它未在代码中使用):

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference "SendGridMail, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "SendGridMail, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference "SendGridMail, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Threading.Tasks, Version=2.5.19.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "SendGridMail, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Threading.Tasks, Version=2.5.19.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference "SendGridMail, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=2.5.19.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0". To resolve this problem, either remove the reference "SendGridMail, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Runtime, Version=2.5.19.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".

1 个答案:

答案 0 :(得分:0)

我能够通过删除.NET 4.5 SDK(但不是框架本身)来解决这个问题。我假设它正在查看dll的最新框架,尽管项目设置为.NET 4