From 12a4c8ad5c083465c60d8bf03f85b89af780c0b1 Mon Sep 17 00:00:00 2001 From: Daniel Lo Nigro Date: Sun, 19 Mar 2017 15:48:23 -0700 Subject: [PATCH] Update publishing so it works with VS2017. Includes workaround for https://github.com/aspnet/MvcPrecompilation/issues/102 --- Daniel15.Web/gulpfile.js | 20 ++++---------------- publishToTemp.bat | 11 +++++++++++ 2 files changed, 15 insertions(+), 16 deletions(-) create mode 100644 publishToTemp.bat diff --git a/Daniel15.Web/gulpfile.js b/Daniel15.Web/gulpfile.js index b13a31c..eefbb3c 100644 --- a/Daniel15.Web/gulpfile.js +++ b/Daniel15.Web/gulpfile.js @@ -12,8 +12,7 @@ var concat = require('gulp-concat'), rename = require('gulp-rename'), shell = require('gulp-shell'), uglify = require('gulp-uglify'), - urlAdjuster = require('gulp-css-url-adjuster'), - project = require('./project.json'); + urlAdjuster = require('gulp-css-url-adjuster'); var webroot = './wwwroot/'; var paths = { @@ -119,22 +118,11 @@ gulp.task('build:config', function(cb) { }); }); -function publish(subDir) { - return shell( - 'dotnet publish "<%= file.path %>" -o "' + paths.tempPublish + subDir + '" -c Release -r debian-x64' - ); -} - -gulp.task('package:site', ['build'], function() { - return gulp.src('.').pipe(publish('site')); +// TODO: Move this into an MSBuild script, there's no need for it to be in Gulp +gulp.task('package', function () { + return gulp.src('.').pipe(shell('publishToTemp.bat', {cwd: '..'})); }); -gulp.task('package:cron', function () { - return gulp.src('../Daniel15.Cron').pipe(publish('cron')); -}); - -gulp.task('package', ['package:site', 'package:cron']); - function deploy(remoteDir) { return gulp.src(paths.tempPublish) .pipe(shell( diff --git a/publishToTemp.bat b/publishToTemp.bat new file mode 100644 index 0000000..573d539 --- /dev/null +++ b/publishToTemp.bat @@ -0,0 +1,11 @@ +::: ASP.NET Core view precompilation doesn't work when cross-compiling for Linux +::: (https://github.com/aspnet/MvcPrecompilation/issues/102). This works around it by building first +::: for Windows, then building again for Debian, then copying across the view assembly. +dotnet restore +dotnet publish Daniel15.Web -o "C:\TempPublish\site_win" -c Release +dotnet restore -r debian-x64 +dotnet publish Daniel15.Web -o "C:\TempPublish\site" -c Release -r debian-x64 /p:MvcRazorCompileOnPublish=false +dotnet publish Daniel15.Cron -o "C:\TempPublish\cron" -c Release -r debian-x64 + +copy c:\TempPublish\site_win\Daniel15.Web.PrecompiledViews.dll c:\TempPublish\site\ +rd /s /q c:\TempPublish\site\Views \ No newline at end of file