0

I need to compile via csc.exe this code:

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Scripting;

namespace ConsoleApplication13
{
    class Program
    {
        static void Main(string[] args)
        {
            Scripting.FileSystemObject fso = new Scripting.FileSystemObject();
            Scripting.Folder folder = fso.GetFolder(@"E:\backup_SQL_Planet\");
            Int64 dirSize = (Int64)folder.Size;
            string abc = Convert.ToString(dirSize);
            Console.WriteLine(abc);
        }
    }
}

when i execute csc.exe there was a problem with reference of (using Scripting;)

How do I reference using Scripting?

  • Use the methods in `System.IO`, the `FileSystemObject` is a (COM) script component, no reason whatsoever to use it in .Net - There is a get directory size example here: https://msdn.microsoft.com/en-us/library/system.io.directory%28v=vs.90%29.aspx – Alex K. Jan 30 '15 at 14:16
  • someone tell that method is much faster ... http://stackoverflow.com/a/12665904 – Antonio Runcio Jan 30 '15 at 15:06
  • Resolved with csc.exe nameFile.cs /reference:interop.scripting.dll. File interop.scripting.dll copied by visualstudio 2010. – Antonio Runcio Jan 30 '15 at 15:49

0 Answers0