【问题标题】:Sharepoint 2010 - error while trying to access a method in a assembly from custom page layoutSharepoint 2010 - 尝试从自定义页面布局访问程序集中的方法时出错
【发布时间】:2011-06-19 01:27:50
【问题描述】:

我有一个发布自定义页面布局页面,并且有类似这样的代码 -

    <ContentPlaceHolder...>
     <script runat="server">
        void Page_Load(object sender, System.EventArgs e)
        {
          lblTest.Text = RTG.Business.Helper.IsUrlFavorite(Request.Url).ToString();
        }
     </script>
     <asp:Label ID="lblTest" runat="Server" />
    </ContentPlaceHolder>

说错了-

The type or namespace name 'Business' does not exist in the namespace 'RTG' (are you missing an assembly reference?)

我已将程序集添加到我的项目中,并且能够从同一项目中的不同用户控件访问它。我尝试在页面顶部添加 @Assembly 和 @Import 命名空间标签,但没有成功。

有谁知道我在这里做错了什么?

【问题讨论】:

    标签: sharepoint-2010 page-layout


    【解决方案1】:

    定义“RTG”命名空间的程序集需要放在 GAC 中。 可以通过 gacutil.exe,手动拖动到“c:\windows\assembly”, 但最好的情况是将其添加到 sharepoint 包中,以便自动部署。 为此,请在解决方案中打开包,单击高级,然后从项目输出中添加程序集。

    祝你好运!

    【讨论】:

    • 程序集已经在 GAC 中。我可以在用户控件中使用此程序集,但它在发布自定义页面布局中不起作用。
    猜你喜欢
    • 2011-09-21
    • 1970-01-01
    • 2018-08-31
    • 1970-01-01
    • 2011-05-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-17
    相关资源
    最近更新 更多