Sharepoint 2010 - 尝试从自定义页面布局访问程序集中的方法时出错

发布于 2024-11-15 23:54:26 字数 675 浏览 5 评论 0原文

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

    <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 Namespace 标签,但没有成功。

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

I have a publishing custom page layout page and have code something like this -

    <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>

It errors out saying -

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

I have the assembly added to my project and am able to access it from a different user control in this same project. I've tried adding the @Assembly and @Import Namespace tags at the top of the page with no luck.

Does anyone know what I'm doing wrong here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

Hello爱情风 2024-11-22 23:54:26

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

祝你好运!

Assembly, which define "RTG" namespace, need to be placed in GAC.
It possible by gacutil.exe, by manually drag to "c:\windows\assembly",
But most better case is add it to sharepoint package, for automatic deploying.
To do this, open package in solution, click advanced, and add assembly from project output.

Good luck!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文