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:
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:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With