我们正在使用CodeF册的模板引擎来生成自定义SharePoint 2013应用程序中的自定义电子邮件。SharePoint 2013应用程序通常与SharePoint 2016兼容,但当我们试图使用针对SharePoint 2016中的SharePoint 2013编译的程序集时,我们遇到了与代码流相关的障碍。
当Template.Run(..)时,我们得到以下错误在SharePoint 2016中调用( SharePoint 2013中的16.0.0.0程序集对15.0.0.0程序集):
使用语言“CSharp”的异常:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe“/R:"C:\Windows\assembly\GAC_MSIL\CodeFluent.Model.Common\1.0.0.0__1bb6d7cccf1045ec\CodeFluent.Model.Common.dll”/R:"C:\Windows\assembly\GAC_MSIL\CodeFluent.Runtime\1.0.0.0__1bb6d7cccf1045ec CF7010: CodeFluent模板“/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll”/R:"C:\Windows\assembly\GAC_MSIL\CodeFluent.Runtime\1.0.0.0__1bb6d7cccf1045ec\CodeFluent.Runtime.dll“/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0 \CodeFluent.Runtime.dll”/R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\RLSoft.XtraShare.BusinessLayer\v4.0_3.0.0.0__ee2f606d34db8cb1\RLSoft.XtraShare.BusinessLayer.dll“/R:"C:\Windows\Microsoft.Net\assembly\GAC_64\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll”/R:C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.SharePoint\v4.0_16.0.0.0__71e9bce111e9429c\Microsoft.SharePoint.dll“/out:"C:\Users\SvcSpAppPool\AppData\Local\Temp\CFTemplating.Temp4.0.30319.42000\70804\CF_00000000001456124944.null.dll”/D:DEBUG /debug+ /优化- /warnaserror "C:\Users\SvcSpAppPool\AppData\Local\Temp\CFTemplating.Temp4.0.30319.42000\70804\CF_00000000001456124944.null.cs“微软(注册商标)VisualC#编译器版本4.6.0081.0适用于微软(注册商标) .NET框架4.5版权(C)微软公司。版权所有。c:\Windows\Microsoft.NET\assembly\GAC_MSIL\RLSoft.XtraShare.BusinessLayer\v4.0_3.0.0.0__ee2f606d34db8cb1\RLSoft.XtraShare.BusinessLayer.dll: error CS1701:警告为错误:假设程序集引用'Microsoft.SharePoint,Version=15.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c‘匹配'Microsoft.SharePoint,Version=16.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c',您可能需要提供运行时策略c:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SharePoint\v4.0_16.0.0.0__71e9bce111e9429c\Microsoft.SharePoint.dll.。
问题似乎源于这样一个事实,即CodeFluent显然使用/warnaserror标志调用csc.exe编译器。是否有方法自定义此行为,使警告不被视为错误?
我们尝试在csc.exe.config中和SharePoint web应用程序的web.config文件中使用一个SharePoint条目,但都没有效果。
如果是的话,你是如何解决这个问题的呢?
发布于 2016-08-22 21:47:12
可以向模板文件中添加模板指令并使用treatWarningsAsErrors属性,如下所示:
[%@ template treatWarningsAsErrors="false" %]
.... your template code...https://stackoverflow.com/questions/39088292
复制相似问题