C# Visual Studio 2012部分发布
使用Visual Studio 2012发布我的ASP.NET(webforms)网站时,始终上载所有文件。甚至是图像C# Visual Studio 2012部分发布,c#,asp.net,ftp,visual-studio-2012,publish,C#,Asp.net,Ftp,Visual Studio 2012,Publish,使用Visual Studio 2012发布我的ASP.NET(webforms)网站时,始终上载所有文件。甚至是图像 是否有方法仅发布更改的文件?否,Visual Studio中的发布向导不提供此功能 建议在本地发布并仅手动更新更改的文件。对于该记录,VS2012发布配置文件中的“仅发布更改的文件”复选框已从VS2012发布配置文件中删除。前进一步,后退两步。仅供参考:微软在VS 2012更新中添加了该功能#2: 使用节点->npm->吞咽观察跟踪它们。这样,它只在文件更改时上载,而您根本不需
是否有方法仅发布更改的文件?否,Visual Studio中的发布向导不提供此功能
建议在本地发布并仅手动更新更改的文件。对于该记录,VS2012发布配置文件中的“仅发布更改的文件”复选框已从VS2012发布配置文件中删除。前进一步,后退两步。仅供参考:微软在VS 2012更新中添加了该功能#2:
使用节点->npm->吞咽观察跟踪它们。这样,它只在文件更改时上载,而您根本不需要跟踪更改集。这几天我们都应该大口喝 必须单独手动管理所有资产,或者被迫上传整个发布包,这简直是疯了。 就我个人而言,我不敢相信visual studio,即使是最新的2015版,也没有更好的东西。真的很伤心 这是我的吞咽脚本,它来源于(我刚刚把它清理干净):
进一步记录:VS2012 Web部署选项(与FTP选项相反)实际上只会部署您所做的更改。甚至还有一个奇特的“向我展示更改”GUI,它通过https而不是http(或ftp)发布,这非常好。你的托管公司必须支持这一点,幸运的是我的公司也支持(谢谢你打折)。除了我的一个客户端站点不能使用WebDeploy之外,其他都很好。Zoidbergi,也许Web Deploy会在你的情况下起作用。我现在移动到Azure,似乎Azure只上传更改过的文件。也许MS已经用IIS8更新了部署系统?我非常想否决这个。他们为什么要删除这样的功能@ScottBeeson他们在VS 2012 Update 2中添加了这一功能-这是唯一的好方法,即使使用VS 2012 Update#2仍然觉得不方便。Microsoft应该为此添加一个功能强大的FTP GUI应用程序。我已经做到了这一点,但我使用FileZilla只覆盖较新的文件,所以我不必手动执行。它也适用于2013年!请注意,我已经切换到gulp watch,因为gulp 4.0仍然是alpha。它速度更快,处理事件也更好(还支持添加和取消链接)。建议您修改以上,如果您打算使用它,为一个简单的咕噜手表。
var gulp = require('gulp'),
gutil = require('gulp-util'),
vftp = require('vinyl-ftp');
var fconfig {
host: "127.0.0.1",
port: "21",
user: "root",
password: "top-secret-tacos",
simultaneous_connections: 5,
file_lock_delay: 450, // ms to wait for lock release. "meh".
local_path: ".",
remote_path: "/my_path/as_seen/in_ftp/",
globs: {
"/assets/src/**/*.*css",
"/assets/src/**/*.js",
"/assets/dist/**/*",
"/**/*.ascx", // track .net changes and upload instantly when saved.
// don't track visual studio stuff.
"!./obj/**/*",
"!./bin/**/*",
"!./packages/",
"!./App_LocalResources/**/*",
"!./vs/**/*",
"!./properties/**/*",
"!./node_modules/**/*"
}
};
// Add debounce to gulp watch for FTP
(function ftp_debounce_fix(){
var watch = gulp.watch;
// Overwrite the local gulp.watch function
gulp.watch = function(glob, opt, fn){
var _this = this, _fn, timeout;
// This is taken from the gulpjs file, but needed to
// qualify the "fn" variable
if ( typeof opt === 'function' || Array.isArray(opt) ) {
fn = opt;
opt = null;
}
// Make a copy of the callback function for reference
_fn = fn;
// Create a new delayed callback function
fn = function(){
if( timeout ){
clearTimeout( timeout );
}
console.log("Delayed Task setup[450].");
timeout = setTimeout( Array.isArray(_fn) ? function(){
_this.start.call(_this, _fn);
} : _fn, fconfig.file_lock_delay);
};
return watch.call( this, glob, opt, fn );
};
})();
function getFtpConnection() {
return vftp.create({
host: fconfig.host,
port: fconfig.port,
user: fconfig.user,
password: fconfig.pass,
parallel: fconfig.simultaneous_connections,
log: gutil.log
});
}
gulp.task('deploy', function() {
var conn = getFtpConnection();
return gulp.src(fconfig.globs, { base: fconfig.local_path, buffer: false })
.pipe( conn.newer( fconfig.remote_root ) ) // only upload newer files
.pipe( conn.dest( fconfig.remote_root ) )
;
});
gulp.task('deploy-watch', function() {
var conn = getFtpConnection();
gulp.watch(fconfig.globs)
.on('change', function(event) {
console.log('Changes detected! Uploading file "' + event.path + '", ' + event.type);
return gulp.src( [event.path], { base: fconfig.local_path, buffer: false } )
.pipe( conn.newer( fconfig.remote_root ) ) // only upload newer files
.pipe( conn.dest( fconfig.remote_root ) )
;
});
});`