Exception in .exe project while using Google Adwords Api

0

I am using Google Adwords Api for LXRPlugin[Excel AddIn] in visual studio 2017 c# project. The visual studio solution contains GoogleAPIIntraction as the main project. The solution runs successfully before .exe file is packaged. After creating .exe file and installing the setup file I am getting the error. I am not able to debug the .exe project step by step, but In log file following messages are shown in the build,when i am selecting Google Analytics.

DownloadDllFiles() An exception occurred during a WebClient request.
DownloadXMLFiles() An exception occurred during a WebClient request.

Ribbon button1_Click Could not load file or assembly 'Google.Apis.Core, Version=1.33.1.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I am sharing the code for DownloadDllFiles and DownloadXMLFiles.

private void DownloadDllFiles()
        {
            List<string> dllFiles = new List<string> { "Google.Ads.Common.dll", "Google.AdWords.dll" }; //"Google.Apis.Analytics.v3.dll", "Google.Apis.Auth.dll", "Google.Apis.Auth.PlatformServices.dll", "Google.Apis.Core.dll", "Google.Apis.dll", "Google.Apis.PlatformServices.dll" };
            string strAppDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
            strAppDir = strAppDir.Remove(0, 6);
            System.Net.WebClient wc = new System.Net.WebClient();
            foreach (var dll in dllFiles)
            {
                string filePath = strAppDir + dll;
                try
                {
                    wc.DownloadFile(Globals.ThisAddIn.LXRXMLFilePath + dll, filePath);
                }
                catch (Exception ex) { LogWriter.Instance.CreateEntry("DownloadDllFiles() " + ex.Message); }
        }
    }
 private void DownloadXMLFiles()
        {
            List<string> xmlFiles = new List<string> { "ACCOUNT_PERFORMANCE_REPORT.xml", "ADGROUP_PERFORMANCE_REPORT.xml",
                "AD_EXTENSIONS_PERFORMANCE_REPORT.xml", "AD_PERFORMANCE_REPORT.xml", "AGE_RANGE_PERFORMANCE_REPORT.xml",
                "AUDIENCE_PERFORMANCE_REPORT.xml", "AUTOMATIC_PLACEMENTS_PERFORMANCE_REPORT.xml", "CALL_METRICS_CALL_DETAILS_REPORT.xml",
                "CAMPAIGN_NEGATIVE_KEYWORDS_PERFORMANCE_REPORT.xml", "CAMPAIGN_NEGATIVE_PLACEMENTS_PERFORMANCE_REPORT.xml",
                "CAMPAIGN_PERFORMANCE_REPORT.xml", "DISPLAY_KEYWORD_PERFORMANCE_REPORT.xml", "FINAL_URL_REPORT.xml",
                "GENDER_PERFORMANCE_REPORT.xml", "GEO_PERFORMANCE_REPORT.xml", "KEYWORDLESS_QUERY_REPORT.xml","ANALYTICS_QUERY_COLUMNS.xml",
                "KEYWORDS_PERFORMANCE_REPORT.xml", "SEARCH_QUERY_PERFORMANCE_REPORT.xml","PAID_ORGANIC_QUERY_REPORT.xml" };
            string strAppDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
            strAppDir = strAppDir.Remove(0, 6);
            strAppDir = Path.Combine(strAppDir + "\\Xmls\\");
            System.Net.WebClient wc = new System.Net.WebClient();
            foreach (var xml in xmlFiles)
            {
                string filePath = strAppDir + xml;
                try
                {
                    wc.DownloadFile(Globals.ThisAddIn.LXRXMLFilePath + xml, filePath);
                }
                catch (Exception ex) { LogWriter.Instance.CreateEntry("DownloadXMLFiles() " + ex.Message); }
            }
        }
c#
visual-studio-2017
exe
google-adwords
asked on Stack Overflow Oct 31, 2018 by Pallavi K

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0