0

In the following code how to fix problem that the batch file won't get created. When I run in debug mode exception I get is "could not find part of path"

Thanks

StreamWriter sw = null;

            try
            {
                if (AgilentNVisaDriver.Checked == false && RequiredDlls.Checked == false)
                {
                    MessageBox.Show("Please select the application you would like to install");
                }
                else
                {
                    Assembly objAssembly = Assembly.GetAssembly(this.GetType());
                    string strAppPath = objAssembly.CodeBase;
                    strAppPath = strAppPath.Replace("SplashScreen.dll", "");
                    Uri objUri = new Uri(strAppPath);
                    strAppPath = @objUri.AbsolutePath;

                    string strBatchFilePath = strAppPath + @"Setup.bat";

                    sw = File.CreateText(strBatchFilePath);
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Lusiphur
0

You might be having a similar issue as described in this link.

Reply # 2 on that link outlines how to resolve that issue if that's the case.

It seems in the case of the link above the absolute path was so long (due to subdirectories and such) that it exceeded the maximum number of chars for the file path.

Hope this helps :) Please remember to mark as solved if your issue is resolved.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.