My first journey at programming with the vCloud .net SDK and I failed at the first hurdle. I tried to create a simple form at the only object I want to pull back is Org objects. But when I run I get a fail while trying to connect to my vCloud:
Could not load file or assembly 'System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
My code looks like this:
using System;
using System.Text;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Net;
using com.vmware.vcloud.sdk;
using com.vmware.vcloud.sdk.admin;
using com.vmware.vcloud.sdk.utility;
using com.vmware.vcloud.api.rest.schema;
using System.Security.Cryptography.X509Certificates;
namespace First_vCloud_App
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
public Dictionary<string, ReferenceType> organizationsMap;
private void button1_Click(object sender, EventArgs e)
{
// Setting up for SSL access. Do not use it production environment
FakeCertificatePolicy();
// here we can set the level
Logger.SourceLevel(Levels.Off);
vCloudClient client = new vCloudClient("https://192.168.1.51", com.vmware.vcloud.sdk.constants.Version.V5_1);
client.Login("administrator", "Qwert123");
organizationsMap = client.GetOrgRefsByName();
}
private static bool ValidateServerCertificate(object sender, X509Certificate
certificate, X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors)
{
return true;
}
public static void FakeCertificatePolicy()
{
ServicePointManager.ServerCertificateValidationCallback += new System.Net.
Security.RemoteCertificateValidationCallback(ValidateServerCertificate);
}
}
}
What am I missing.