xml - MSBuild error code 9009 when trying to post a http request using curl -


im trying post http request "new relic" using "publish" button in visual studio.

in publishing profile choose "web deploy" , finnish setup. after i'll go in ".pubxml"-file , add target @ bottom:

 <target name="afterbuild">  <exec command="curl -h &quot;x-api-key:mykey&quot;   -d &quot;deployment[application_id]=appid&quot;   -d &quot;deployment[description]=msbuild deploy using curl&quot;   -d &quot;deployment[revision]=0&quot;   -d &quot;deployment[changelog]=deployed using msbuild&quot;   -d &quot;deployment[user]=user&quot;   -d http://api.newrelic.com/deployments.xml"/>      </target> </project> 

in error list in visual studio this:

severity code description project file line suppression state error command  "curl  -h "x-api-key:appkey"  -d "deployment[application_id]=appid"  -d "deployment[description]=msbuild deploy using curl"  -d "deployment[revision]=1"  -d "deployment[changelog]=deployed using msbuild"  -d "deployment[user]=user"  http://api.newrelic.com/deployments.xml"  exited code 9009 

if run curl command in curl.exe works (the post succeeds) not during msbuild.

as can see above there quotes around accept url, (have tried also)

i have tried specifying path curl

&quot;c:\windows\system32\curl.exe&quot;  

but doesent work eather.

i have removed "itemgroup" since dont want web config included (have set buildaction "none" on web config)

what can try?

updated

<target name="afterbuild"> , <message text="test"/>.. 

this runns cant see text "test" in build output.

 <target name="afterbuild">  <exec workingdirectory="c:\windows\system32\" command="curl http://www.google.com"/> 

this returns error 9009.

proof in correct directory:

enter image description here

when trying reproduce problem tried couple of things (running curl, running 64bit curl, running when it's in path, running specifying full path, running executable system32 diretory), 1 thing didn't try out of principle copying curl system32 directory: doing never correct solution problem, variety of reasons can found on internet. , yes, today found yet reason why it's bad :]

msbuild's exec task works creating temporary file including command run, , launching cmd.exe /q /c <path/to/tempfile>. task not start cmd.exe though, specifies the full path prepending environment.getfolderpath(environment.specialfolder.system). returns c:\windows\syswow64 or similar when called 32bit process (i.e. msbuild) on 64bit system.

as result msbuild starts 32bit cmd c:\windows\syswow64\cmd.exe. being 32bit process, file system redirection gets invoked: if tell 32bit process in c:\windows\system32 won't that, in c:\windows\syswow64. , curl.exe not there since put in system32. , code 9009.

long story short: windows citizen , don't put curl.exe in ssystem32 or syswow64, , either specify full path when using exec or add directory located path.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -