错误为:
error CS0246: The type or namespace name 'Google' could not be found (are you missing a using directive or an assembly reference?)
它发生在以开头的模板文件的呈现上
@using Google.Apis.Requests
@using Google.Apis.Calendar.v3.Data;
@model Google.Apis.Calendar.v3.Data.Events
它出现在我使用Nuget包将Google.Client.Api程序集从1.9.3更改为1.10之后。项目中引用了所有必要的Google程序集。
奇怪的是,VS intellisense完全可以看到名称空间,并且可以打开Events类。所有的c代码都能正常编译。
我终于找到了一个解决方案——这是一个web.config问题,我不得不插入谷歌API作为这个
<system.web>
<compilation targetFramework="4.5.1">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Web.Mvc, Version=5.2.3, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="Google.Apis, Version=1.10.0.25332, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab" />
<add assembly="Google.Apis.Core, Version=1.10.0.25331, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab" />
<add assembly="Google.Apis.Calendar.v3, Version=1.10.0.157, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab" />
<add assembly="Orchard.Framework"/>
<add assembly="Orchard.Core"/>
</assemblies>
</compilation>