mikefourie-zz / MSBuildExtensionPack

MIT License
366 stars 104 forks source link

CommandLine exception #5

Closed apobekiaris closed 9 years ago

apobekiaris commented 10 years ago

Exec has no issues but when i switch to CommandLine i get

"C:\eXpandFrameWork\eXpand\Xpand.build" (nuget target) (1) -> (NuGetPackage target) -> C:\eXpandFrameWork\eXpand\Xpand.build(394,2): error MSB4018: The "MSBuild.Ext ensionPack.Framework.CommandLine" task failed unexpectedly.\r C:\eXpandFrameWork\eXpand\Xpand.build(394,2): error MSB4018: System.ComponentMo del.Win32Exception (0x80004005): The system cannot find the file specified\r C:\eXpandFrameWork\eXpand\Xpand.build(394,2): error MSB4018: at System.Diagn ostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)\r C:\eXpandFrameWork\eXpand\Xpand.build(394,2): error MSB4018: at System.Diagn ostics.Process.Start()\r C:\eXpandFrameWork\eXpand\Xpand.build(394,2): error MSB4018: at System.Diagn ostics.Process.Start(ProcessStartInfo startInfo)\r C:\eXpandFrameWork\eXpand\Xpand.build(394,2): error MSB4018: at MSBuild.Exte nsionPack.Framework.CommandLine.Execute() in C:\Projects\CodePlex\MSBuildExtens ionPack\Solutions\Main\Framework\Framework\CommandLine.cs:line 292\r C:\eXpandFrameWork\eXpand\Xpand.build(394,2): error MSB4018: at Microsoft.Bu ild.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execut e()\r C:\eXpandFrameWork\eXpand\Xpand.build(394,2): error MSB4018: at Microsoft.Bu ild.BackEnd.TaskBuilder.d__20.MoveNext()

mikefourie-zz commented 10 years ago

Hi, could you paste a sample of how you are using the task

apobekiaris commented 10 years ago

sure but it happens anywhere

<MSBuild.ExtensionPack.Framework.CommandLine ContinueOnError="false" Command="$(NuGetTool) pack %(NuspecFile.Identity) -BasePath $(MSBuildProjectDirectory) -OutputDirectory $(BuildPath)\NuGet -Version $(Version) -Symbols"/>

apobekiaris commented 10 years ago

MSBuild.ExtensionPack.Framework.CommandLine ContinueOnError="false" Command="$(NuGetTool) pack %(NuspecFile.Identity) -BasePath $(MSBuildProjectDirectory) -OutputDirectory $(BuildPath)\NuGet -Version $(Version) -Symbols"/>

apobekiaris commented 10 years ago

HI Mike

any ideas on my issue?

mikefourie-zz commented 10 years ago

Can you give me the output of /v:diag, I'm after something like

Using "MSBuild.ExtensionPack.Framework.CommandLine" task from assembly "C:\Prog ram Files (x86)\MSBuild\ExtensionPack\4.0\MSBuild.ExtensionPack.dll". Task "MSBuild.ExtensionPack.Framework.CommandLine" (TaskId:2) Task Parameter:Command=calc.exe (TaskId:2) Warning RegEx: (?i:\bwarning\b) (TaskId:2) Error RegEx: (?i:\berror\b) (TaskId:2) Command: calc.exe (TaskId:2) Execute: calc.exe (TaskId:2)

It could be that the tool isn't in the Path and you need to specify the WorkingDirectory

Mike

mikefourie-zz commented 9 years ago

Hi, any luck with /v:diag? is this still an issue?

Mike

apobekiaris commented 9 years ago

Yes it is an issue and the v/diag does not give any valueable info

Using "MSBuild.ExtensionPack.Framework.CommandLine" task from assembly "C:\eXpandFrameWork\eXpand\Resource\Build\ExtensionPack\MSBuild.ExtensionPack.dll". Task "MSBuild.ExtensionPack.Framework.CommandLine" Task Parameter:Command=githublink.exe C:\eXpandFrameWork\eXpand -u https://github.com/eXpand/eXpand -b master -l link.log -g true Task Parameter:WorkingDirectory=C:\eXpandFrameWork\eXpand_third_party_assemblies Warning RegEx: (?i:\bwarning\b) Error RegEx: (?i:\berror\b) Command: githublink.exe C:\eXpandFrameWork\eXpand -u https://github.com/eXpand/eXpand -b master -l link.log -g true Execute: githublink.exe C:\eXpandFrameWork\eXpand -u https://github.com/eXpand/eXpand -b master -l link.log -g true C:\eXpandFrameWork\eXpand\Xpand.build(391,5): warning MSB4018: The "MSBuild.ExtensionPack.Framework.CommandLine" task failed unexpectedly.\r C:\eXpandFrameWork\eXpand\Xpand.build(391,5): warning MSB4018: System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified\r C:\eXpandFrameWork\eXpand\Xpand.build(391,5): warning MSB4018: at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)\r C:\eXpandFrameWork\eXpand\Xpand.build(391,5): warning MSB4018: at System.Diagnostics.Process.Start()\r C:\eXpandFrameWork\eXpand\Xpand.build(391,5): warning MSB4018: at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)\r C:\eXpandFrameWork\eXpand\Xpand.build(391,5): warning MSB4018: at MSBuild.ExtensionPack.Framework.CommandLine.Execute()\r C:\eXpandFrameWork\eXpand\Xpand.build(391,5): warning MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()\r C:\eXpandFrameWork\eXpand\Xpand.build(391,5): warning MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext() The previous error was converted to a warning because the task was called with ContinueOnError=true. Build continuing because "ContinueOnError" on the task "MSBuild.ExtensionPack.Framework.CommandLine" is set to "true". Done executing task "MSBuild.ExtensionPack.Framework.CommandLine" -- FAILED.

apobekiaris commented 9 years ago

Can you try the following?

  1. Execute the GitHubLink target https://github.com/expand/eXpand/blob/edc728eeaaaaab5e39451f70d45f184bfd3002ea/Xpand.build#L390-L396
  2. Replace the Exec in the target withe the commandline so u get something like MSBuild.ExtensionPack.Framework.CommandLine Command="githublink.exe $(MSBuildProjectDirectory) -u https://github.com/eXpand/eXpand -b master -l link.log -g true" WorkingDirectory="$(_third_party_assemblies)" ContinueOnError="true"></MSBuild.ExtensionPack.Framework.CommandLine>

The above throws and I think that I followed were very logical. Can you comment?

mikefourie-zz commented 9 years ago

Ok I just took a look at the code. The task runs with UseShellExecute set as false do the workingdirectory property only specifies where the command will run from, not where to find it. To resolve this you can add the exe to your Path or fully qualify the path to it in your call.