Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 549225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:09:43+00:00 2026-05-13T11:09:43+00:00

I have a problem with using Phantom do delete and copy recursively. I have

  • 0

I have a problem with using Phantom do delete and copy recursively. I have already solved the actual problem which was quite easy checking the below exception anyone could easily do so but can you tell me how to reproduce the problem from visual studio?

System.IO.DirectoryNotFoundException:
Could not find a part of the path
‘build/webui\Views/Web.config’. at
System.IO.__Error.WinIOError(Int32
errorCode, String maybeFullPath) at
System.IO.File.InternalCopy(String
sourceFileName, String destFileName,
Boolean overwrite) at
Phantom.Core.WrappedFileInfo.CopyToDirectory(String
path) in
d:\OpenSource\Build\Phantom2\Phantom\src\Phantom.Core\WrappedFileInfo.cs:line
75 at
build.$$Execute$closure$23$closure$25.Invoke(WrappedFileSystemInfo
file) at
Phantom.Core.Builtins.UtilityFunctions.ForEach[T](IEnumerable1
source, Action
1 action) in
d:\OpenSource\Build\Phantom2\Phantom\src\Phantom.Core\Builtins\UtilityFunctions.cs:line
34 at
build.$Execute$closure$23.Invoke()
at Phantom.Core.Target.Execute() in
d:\OpenSource\Build\Phantom2\Phantom\src\Phantom.Core\Target.cs:line
81 at
Phantom.Core.ScriptModel.ExecuteTargets(String[]
targetNames) in
d:\OpenSource\Build\Phantom2\Phantom\src\Phantom.Core\ScriptModel.cs:line
73 at
Phantom.Program.Execute(String[] args)
in
d:\OpenSource\Build\Phantom2\Phantom\src\Phantom\Program.cs:line
57

The problem is that phantom is started from .bat/.cmd file and the build file is sent as an argument and this fails somehow on my Windows 7 x64 machine but doing the exact same thing from within Visual Studio 2008 works perfectly so even if I copy the Views folder I can do so recursively. The original code (that fails from the command line):

public override void CopyToDirectory(string path) {
    if (!Directory.Exists(path)) {
        Directory.CreateDirectory(path);
    }

    if (Flatten) {
        var combinedPath = Path.Combine(path, Name);
        File.Copy(FullName, combinedPath, true);
    }
    else {
        var combinedPath = Path.Combine(path, PathWithoutBaseDirectory);
        File.Copy(FullName, combinedPath, true);
    }
}

Changing the above to:

public override void CopyToDirectory(string path) {
    if (!Directory.Exists(path)) {
        Directory.CreateDirectory(path);
    }

    if (Flatten) {
        var combinedPath = Path.Combine(path, Name);
        File.Copy(FullName, combinedPath, true);
    }
    else {
        var combinedPath = Path.Combine(path, PathWithoutBaseDirectory);
        var newPath = Path.GetDirectoryName(combinedPath);
        if (!Directory.Exists(newPath)) {
            Directory.CreateDirectory(newPath);
        }
        File.Copy(FullName, combinedPath, true);
    }
}

makes that specific problem go away which is fine I mean figuring it out only took a couple of minutes but trying to reproduce the problem or create a failing test has taken quite a few hours now and I’d like to know why it can’t be done or learn how 🙂

Edit: The reason for this is extremely silly but here goes. The base directory in this case would be “Views” the PathWithourBaseDirectory would be equal to something like “Home/About.aspx” the darn thing would not work in cmd but it did work in Visual Studio. Next thing I know I can’t make it run in Visual Studio either so I applied my fix and all tests turn green. I still don’t know why…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:09:43+00:00Added an answer on May 13, 2026 at 11:09 am

    I’d like to know why

    Well – there are several problems:

    Let’s say path is “C:\Foo\Bar.txt” (where Bar.txt is a text-file).
    Now you are calling Directory.CreateDirectory(path).

    You try to create the directory “C:\Foo\Bar.txt”. However, that “is” already a file.

    Then, when creating the file, you combine this path with the file name – a result might be “C:\Foo\Bar.txt\Bar.txt”. This however, can not succeed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 295k
  • Answers 295k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer they are floated right in the order they are encountered,… May 13, 2026 at 6:47 pm
  • Editorial Team
    Editorial Team added an answer I would suggest modifying your themes portlet.vm template. It's pretty… May 13, 2026 at 6:47 pm
  • Editorial Team
    Editorial Team added an answer Have you tried to use AR Extensions for bulk import?… May 13, 2026 at 6:47 pm

Related Questions

I have a problem with using a script that adds a NiceEdit toolbar to
I have a problem with using Bitwise operators in Postgres I get the following
I have a problem with using the prefix, seems like whenever I use the
I have a problem with using jQuery Dialog and Ajax submit in JSF. I
My experience is only with Flash and I'm afraid I have not kept up

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.