Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

192 views
Skip to first unread message

Vincent Jong

unread,
Oct 31, 2019, 2:17:03 PM10/31/19
to TestStack.White
I've just started looking into white to try and do some win32 automation on Windows 7. I'm just right now just doing a simple open calc.exe and I can't figure out what I need to do. I keep getting a System.IO.FileNotFoundException on launch. System.Diagnostics.Process.Start("CMD.exe", "/C " + ExeSourceFile); works fine. 

The code I'm using below seems to follow the newb howto's. What am I doing wrong? Thanks for your help and patience.

using System;
using TestStack.White;
using TestStack.White.Factory;
using TestStack.White.UIItems.Finders;
using TestStack.White.InputDevices;

namespace ConsoleApp1
{
    class Program
    {
        private const string ExeSourceFile = @"C:\Windows\System32\calc.exe";
        //Global Variable to for Application launch
        private static TestStack.White.Application _application;
        //Global variable to get the Main window of calculator from application.
        private static TestStack.White.UIItems.WindowItems.Window _mainWindow;

        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!\n" + ExeSourceFile);
            var psi = new System.Diagnostics.ProcessStartInfo(ExeSourceFile);
            TestStack.White.Application _application = TestStack.White.Application.AttachOrLaunch(psi);
        }
    }
}


Mike Hetzer

unread,
Nov 1, 2019, 4:47:32 PM11/1/19
to TestStack.White
I would recommend using a unit test project in order to trigger your code instead of a Console App.
With this, you are technically using the cmd prompt to try and launch a secondary app and then send commands to it which could get wonky.

Use something like MSTest or NUnit (recommended).

Other than that it seems like it's maybe missing a reference or dependency?

Vincent Jong

unread,
Nov 4, 2019, 12:40:05 PM11/4/19
to TestStack.White
@Mike

Hi I tried NUnit and the result is the same. I'm not sure what the issue would be as this is just a simple open a calculator and these are the steps that all the tutorials use...

using NUnit.Framework;
using TestStack.White;
using TestStack.White.Factory;
using TestStack.White.UIItems.Finders;
using TestStack.White.InputDevices;

namespace NUnitTestProject1
{
    public class Tests
    {
        private const string ExeSourceFile = @"C:\Windows\System32\calc.exe";
        //Global Variable to for Application launch
        private static TestStack.White.Application _application;
        //Global variable to get the Main window of calculator from application.
        private static TestStack.White.UIItems.WindowItems.Window _mainWindow;
        

        [SetUp]
        public void Setup()
        {
            System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(ExeSourceFile);
            _application = TestStack.White.Application.AttachOrLaunch(psi);
        }

        [Test]
        public void Test1()
        {
            Assert.Pass();
        }
    }
}

Test Name: Test1
Test FullName: NUnitTestProject1.NUnitTestProject1.Tests.Test1
Test Source: C:\Users\tester\Documents\amax\poc2\NUnitTestProject1\UnitTest1.cs : line 27
Test Outcome: Failed
Test Duration: 0:00:00

Test Name: Test1
Test Outcome: Failed
Result StackTrace:
at TestStack.White.Application.Launch(ProcessStartInfo processStartInfo)
   at TestStack.White.Application.AttachOrLaunch(ProcessStartInfo processStartInfo)
   at NUnitTestProject1.Tests.Setup() in C:\Users\tester\Documents\amax\poc2\NUnitTestProject1\UnitTest1.cs:line 23
Result Message: System.IO.FileNotFoundException : Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.


Reply all
Reply to author
Forward
0 new messages