Skip to content

Commit

Permalink
Update publishing so it works with VS2017.
Browse files Browse the repository at this point in the history
Includes workaround for aspnet/MvcPrecompilation#102
  • Loading branch information
Daniel15 committed Mar 19, 2017
1 parent 5368bff commit 12a4c8a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
20 changes: 4 additions & 16 deletions Daniel15.Web/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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(
Expand Down
11 changes: 11 additions & 0 deletions publishToTemp.bat
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 12a4c8a

Please sign in to comment.