使用codefluent . model . common . template . template类时自定义csc编

本文关键字:template 自定义 csc model common 使用 codefluent | 更新日期: 2023-09-27 18:03:41

我们正在使用CodeFluent的模板引擎在自定义SharePoint 2013应用程序中生成自定义电子邮件。SharePoint 2013应用程序通常与SharePoint 2016向前兼容,但是当我们试图在SharePoint 2016中使用针对SharePoint 2013编译的程序集时,我们遇到了一个与codefluent相关的障碍。

当在SharePoint 2016中调用Template.Run(..)时(SharePoint 2013中16.0.0.0 assemblies vs. 15.0.0.0 assemblies),我们得到以下错误:

CF7010: CodeFluent模板"使用语言'CSharp'异常:c:'windows'system32'inetsrv> " c:'windows' Microsoft.NET'Framework64'v4.0.30319'csc.exe"/t:library/utf8output/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'CodeFluent.Runtime.dll"/R:" c:'windows' Microsoft.NET' assembly'GAC_MSIL'System.Xml'v4.0 4.0. 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' v4.0 .0.0.0__b77a5c561934e089'System.dll"/R:"C:'Windows'Microsoft.Net'assembly'GAC_MSIL'RLSoft.XtraShare.BusinessLayer'v4.0 .0.0.0__ee2f606d34db8cb1'RLSoft.XtraShare.BusinessLayer "/R:"C:'Windows'Microsoft.Net'assembly'GAC_64'System. web 'v4.0 .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 +/optimize- /warnaserror "C:'Users'SvcSpAppPool'AppData'Local'Temp'CFTemplating.Temp4.0.30319.42000'70804'CF_00000000001456124944.null.cs" Microsoft (R) Visual c# Compiler version 4.6.0081.0 for Microsoft (R) .NET版权所有(C) Microsoft Corporation。版权所有。c:'Windows'Microsoft.NET'assembly'GAC_MSIL'RLSoft.XtraShare.BusinessLayer'v4.0_3.0.0.0__ee2f606d34db8cb1'RLSoft.XtraShare.BusinessLayer.dll: error CS1701: Warning as error :假设程序集引用'Microsoft. net '。SharePoint,版本=15.0.0.0,文化=中性,PublicKeyToken=71e9bce111e9429c'匹配'微软。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显然调用csc.exe编译器与/warnaserror标志。是否有一种方法来定制这种行为,使警告不被视为错误?

我们已经尝试在csc.exe.config和web中使用bindingRedirect条目。在SharePoint web应用程序的配置文件中,

如果有人遇到过这个问题,如果遇到过,你是如何解决的?

使用codefluent . model . common . template . template类时自定义csc编

您可以在模板文件中添加一个模板指令,并使用treatWarningsAsErrors属性,如下所示:

[%@ template treatWarningsAsErrors="false" %]
.... your template code...