由于SafeControls的原因,我需要在this的列表中添加ContentEditorWebPart。除非有更好的办法。
问题是,我不想手动添加它,我想在耗尽我的解决方案时自动添加。
因此,我尝试将我的安全控件添加到模块的.spdata中,如下所示:
<SafeControls>
<SafeControl Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.WebPartPages" TypeName="ContentEditorWebPart" Safe="True" />
</SafeControls>但当我检查我的web.config时,它会将程序集更改为我的项目程序集。
如果我将它添加到我的包中,我必须使用它来部署Sarepoint dll。
那么,将其添加到SafeControls的最佳方法是什么?
发布于 2011-04-08 01:59:07
根据记录,我已经决定添加一个功能接收器,它将使用SPWebConfigModification为web.config添加安全控件
有关详细信息,请参阅How to: Add and Remove Web.config Settings Programmatically
发布于 2012-10-11 21:56:28
在这种情况下,SPWebConfigModification的使用是正确的。可以通过编辑文件Package.Template.Xml来归档此功能:
<?xml version="1.0" encoding="utf-8"?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/">
<Assemblies>
<Assembly Location="Telerik.Web.UI.dll" DeploymentTarget="GlobalAssemblyCache">
<SafeControls>
<SafeControl Assembly="Telerik.Web.UI, Version=2012.2.912.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" Namespace="Telerik.Web.UI" TypeName="*" Safe="True" SafeAgainstScript="False" />
</SafeControls>
</Assembly>
</Assemblies>
</Solution>在本例中,我在web.config的安全控件中添加了程序集Telerik.Web.UI.dll
https://stackoverflow.com/questions/5583504
复制相似问题