Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Publish fails in Visual Studio 2015 with message: "The 'prepare' script failed with status code -1073741819."

When publishing my asp.net 5 project, the output directory stays empty and I get the error: "The 'prepare' script failed with status code -1073741819."

Here are my publish settings:

  • Publish target: "File System"
  • Target location: "D:\Users\cseedj\Documents\Visual Studio 2015\Publish"
  • Configuration: Debug
  • DNX Version: Default (cnx-clr-win-x86.1.0.0-beta4)

And here is the full output:

Connecting to D:\Users\cseedj\Documents\Visual Studio 2015\Publish...
Environment variables:
Path=D:\Users\cseedj\Documents\Visual Studio 2015\Projects\MvcDebug-Tweaking\src\MvcDebug\.\node_modules\.bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\\Extensions\Microsoft\Web Tools\External;%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\\Extensions\Microsoft\Web Tools\External\git
C:\Users\cseedj\.dnx\runtimes\dnx-clr-win-x86.1.0.0-beta4\bin\dnu.cmd publish "D:\Users\cseedj\Documents\Visual Studio 2015\Projects\MvcDebug-Tweaking\src\MvcDebug" --out "C:\Users\cseedj\AppData\Local\Temp\PublishTemp" --configuration Debug --runtime dnx-clr-win-x86.1.0.0-beta4 --wwwroot-out "wwwroot" --quiet
[09:07:41] Using gulpfile D:\Users\cseedj\Documents\Visual Studio 2015\Projects\MvcDebug-Tweaking\src\MvcDebug\gulpfile.js
[09:07:41] Starting 'clean'...
[09:07:41] Finished 'clean' after 650 μs
[09:07:41] Starting 'copy'...
[09:07:41] Finished 'copy' after 17 ms
The 'prepare' script failed with status code -1073741819.

Now when I copy the dnu command and execute it in a command line, it works fine: I get the files in the publish folder (well actually I still get an error 500 with the published code, but that's another question).

I also tried to run Visual Studio as Administrator too be sure it was not a filesystem rights related issue, but that doesn't help...

So why does the "publish" fail in VS and how can I make it work ? And also a subsidiary question, why does it publish in a Temp directory and not in the Target location ?


Versions info:

  • Visual Studio Enterprise 2015 RC, Version 14.0.22823.1 D14REL
  • My project uses beta4 versions of asp.net frameworks
like image 506
Daniel Avatar asked Jul 15 '15 07:07

Daniel


1 Answers

This information is current as of beta-8.

The project.json file allows for you to specify scripts which should run in response to certain packaging (DNX Utility/dnu) events. In the default Visual Studio templates for Asp.Net 5 projects, the project.json file specifies any scripts which should run when you attempt to publish your app:

"scripts": {
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
  }

In this example, four commands will run when you attempt to publish: npm install, bower-install, gulp clean and gulp min.

In most cases, when the prepublish task fails it is due to an error in your client-side build process (i.e. in your gulpfile.js). In my case, it was because I renamed a gulp task created by the Visual Studio template, without updating the project.json file. When I attempted to publish gulp min command was executed, but no min task was found in my gulpfile.js, resulting in the error. See this Github issue for more information.

Unfortunately, the available events that can be hooked into are poorly documented at this time. I believe the prepare script has since been renamed to prepublish as of beta-6 (see this Github issue). The error I received as of beta-8 is:

The 'prepublish' script failed with status code 1.

like image 170
Blake Mumford Avatar answered Nov 30 '22 03:11

Blake Mumford