1

I'm developing a project using Monodevelop 4 in Windows XP and I need to copy some of the .dll library files into some folder after they are built. These libraries are plugins to a main project and so the main project is not depended on them and they need to be copied manually.

But as we are using computers nothing needs to actually be done manually, and so I turned to Monodevelop's Custom Commands in project settings. There I can type in any command I like (supposedly).

So here's what I did; First I added a command to make sure the destination folder exists:

mkdir "${SolutionDir}\MainProj\bin\${ProjectConfigName}\Plugins"

And then copied the library:

xcopy "${TargetFile}" "${SolutionDir}\MainProj\bin\${ProjectConfigName}\Plugins" /Y

But the thing is that the first command fails and so the second one never executes. To see the results of the first command I checked both of checkboxes named Run on external console and Pause console ouput and here's its output:

'"mkdir"' is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . .

In IDE's output panel I can read mkdir "C:\Some\Path\MainProj\bin\Debug\Plugins" which is correct and when I paste it into a console creates the folder successfully so I have no idea why Monodevelop is unable to execute it!

Does anyone have any comment on this problem?

4

2 回答 2

0

I found a solution myself. I created a batch file with mkdir command in it and called it in the project's Custom Commands.

于 2013-08-27T04:38:18.870 回答
0

I was able to resolve this in Xamarin Studio (ver 4.2.5) by using xcopy instead of copy and providing the full path to xcopy.exe:

"%systemroot%\system32\xcopy.EXE" /y "${ProjectDir}\myAppSettings.config" "${TargetDir}"

After some experimentation, it appears that Xamarin Studio/MonoDevelop:

  1. Wraps the entire custom command in double-quotes, and
  2. Includes logic to try to deal with you "improperly" including additional double-quotes. (I tried an injection technique to undo the quotation.)

This has the side effect of rendering internal shell commands unexecutable - because copy becomes "copy", which isn't a valid command. And it explains why moving everything to a batch file also resolves the issue - there is now a physical file (which a physical path) to execute.

于 2014-05-11T07:53:08.267 回答