简体   繁体   中英

Suggestions to resolve integration tests failure in VSTS for Service Fabric, while acessing Fabric Client

I have a Simple test

public void TestCertificateThumbprint()
        {
            var xc = GetCredentials(this.clientCertThumb, this.serverCertThumb, this.commonName);
            var fc = new FabricClient(xc, this.connection);

        try
        {
            var ret = fc.ClusterManager.GetClusterManifestAsync().Result;
            Assert.IsNotNull(ret);
        }
        catch (Exception e)
        {
            Console.WriteLine("Connect failed: {0}", e.Message);
            Assert.IsNull(e);
        }

        Assert.IsTrue(true);
    }

I encountered no issues running this test against azure cluster in cloud from my local but through VSTS, running into Issues

Test method TestCertificateThumbprint threw exception:

System.BadImageFormatException: Could not load file or assembly 'System.Fabric, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. An attempt was made to load a program with an incorrect format.

I have checked the versions, They are valid and they are fetched in the nuget restore build task of VSTS ( based on log file console output)

Environment: VS 2017, Azure Service Fabric, Unit tests, Package : Microsoft.ServiceFabric.6.0.232

Make sure that your project is targeting x64 as all Service Fabric assemblies are compiled to x64 and Azure Service Fabric only supports x64 platform.

Refer the below SO link for more information.

Service Fabric System.BadImageFormatException

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM