C# 在Azure功能中使用Microsoft.WindowsAzure.Management.WebSites时出错

C# 在Azure功能中使用Microsoft.WindowsAzure.Management.WebSites时出错,c#,azure,azure-functions,azure-management-api,C#,Azure,Azure Functions,Azure Management Api,在我的Azure函数中,我引用了Microsoft.WindowsAzure.Management.WebSitesassembly { "frameworks": { "net46":{ "dependencies": { "Microsoft.WindowsAzure.Management.WebSites": "4.0.0" } } } } 并尝试使用WebItemManagementClient: var client

在我的Azure函数中,我引用了
Microsoft.WindowsAzure.Management.WebSites
assembly

{
  "frameworks": {
    "net46":{
      "dependencies": {
        "Microsoft.WindowsAzure.Management.WebSites": "4.0.0"
      }
    }
   }
}
并尝试使用
WebItemManagementClient

var client = new WebSiteManagementClient(
    new Microsoft.WindowsAzure.CertificateCloudCredentials("my sub ID", cert));
但它失败了,出现了一个错误:

Microsoft.WindowsAzure.Common: 
The type initializer for 'Microsoft.WindowsAzure.Common.ServiceClient`1'
threw an exception. Microsoft.WindowsAzure.Common: Operation is not 
supported on this platform.
在日志中我可以看到

Unable to find assembly 'Microsoft.WindowsAzure.Common.NetFramework'. Are you missing a private assembly file?
Unable to find assembly 'Microsoft.WindowsAzure.Common.WindowsStore'. Are you missing a private assembly file?
Unable to find assembly 'Microsoft.WindowsAzure.Common.WindowsPhone'. Are you missing a private assembly file?
Unable to find assembly 'Microsoft.WindowsAzure.Common.WindowsPhone81'. Are you missing a private assembly file?
Unable to find assembly 'Microsoft.WindowsAzure.Common.Silverlight'. Are you missing a private assembly file?
Unable to find assembly 'Microsoft.WindowsAzure.Common.Test'. Are you missing a private assembly file?
我也尝试引用所有依赖的NuGet包,但没有幸修复错误


我遗漏了什么?

添加以下项目修复了问题

 //Add in run.csx
 using Microsoft.WindowsAzure.Management.WebSites; 
在project.JSON中添加以下JSON配置

    {
      "frameworks": {
        "net46":{
         "dependencies": {
         "Microsoft.WindowsAzure.Management.WebSites": "4.0.0",
         "Microsoft.WindowsAzure.Common": "1.4.1"
         }
        }
       }
      }
有关更多信息: 我也尝试过最新的预发布版本

    "Microsoft.WindowsAzure.Management.WebSites": "5.0.0-prerelease"

Azure功能在预发行版中也运行良好。

添加以下项目修复了该问题

 //Add in run.csx
 using Microsoft.WindowsAzure.Management.WebSites; 
在project.JSON中添加以下JSON配置

    {
      "frameworks": {
        "net46":{
         "dependencies": {
         "Microsoft.WindowsAzure.Management.WebSites": "4.0.0",
         "Microsoft.WindowsAzure.Common": "1.4.1"
         }
        }
       }
      }
有关更多信息: 我也尝试过最新的预发布版本

    "Microsoft.WindowsAzure.Management.WebSites": "5.0.0-prerelease"

Azure功能在预发行版中也运行良好。

我不这么认为。。。以前尝试过,现在通过复制粘贴json再次尝试。仍然是相同的错误。类似于Lools的问题不是由于var client=new WebItemManagementClient(新的Microsoft.WindowsAzure.CertificateCloudCredentials(“我的子ID”,cert));请检查Azure函数中“查看文件”下的项目锁定json,并检查是否已包含所有必需的包。不适用于我。。。以前尝试过,现在通过复制粘贴json再次尝试。仍然是相同的错误。类似于Lools的问题不是由于var client=new WebItemManagementClient(新的Microsoft.WindowsAzure.CertificateCloudCredentials(“我的子ID”,cert));请检查Azure函数中“查看文件”下的项目锁定json,并检查是否已包含所有必需的包。