【问题标题】:How to add assembly reference in aspx page inline coding如何在 aspx 页面内联编码中添加程序集引用
【发布时间】:2017-08-17 13:38:29
【问题描述】:

当我厌倦了在没有页面隐藏代码的 SharePoint 布局 aspx 页面中引用“Microsoft.ApplicationInsights”时,我收到了以下错误。

在编译请求的文件或其依赖项之一期间发生错误。找不到类型或命名空间名称“TelemetryClient”(您是否缺少 using 指令或程序集引用?)

尝试了以下方法

<%@ Assembly Name="Microsoft.ApplicationInsights, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"%>

还有

<%@ Import Namespace="Microsoft.ApplicationInsights" %>

在我试图创建 TelemetryClient 对象以将数据记录到 Azure 的 aspx 页面中的一段内联 C# 代码下方

.....
TelemetryClient telemetryClient = new TelemetryClient();
telemetryClient.InstrumentationKey = instKey;
telemetryClient.TrackException(ex, sp_coid);
.....

【问题讨论】:

    标签: c# azure sharepoint reference telemetry


    【解决方案1】:

    &lt;%@ Import Namespace="Microsoft.ApplicationInsights" %&gt; 是包含命名空间的正确方法,但如果您遇到错误,那么 您是否在项目中获取/添加了该 dll Microsoft.ApplicationInsights 的引用?(或)可能从NuGet

    【讨论】:

    • 它会引用服务器上的 GAC 对吗?我正在本地打包 SharePoint wsp 并将其部署在服务器上。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多