Flags you want to create msbuild:
/target:publish
and
/p:PublishDir=C:\Foo\
Note that you must have trailing \ in the publish directory or just follow the dependent steps for publishing (i.e. build) and never create a script.
You may be interested in the msbuild npm package:
var msbuild = require('msbuild'); var path = require('path'); // Config var source = 'source/Bar/Bar.App/Bar.App.csproj'; var deploy = path.join(__dirname, 'deploy'); // Build the project var builder = new msbuild(); builder.sourcePath = source; builder.overrideParams.push('/p:PublishDir=' + deploy + "\\"); // <-- Installer builder.overrideParams.push('/Target:rebuild;publish'); builder.overrideParams.push('/P:Configuration=Release'); builder.overrideParams.push('/P:verbosity=diag'); builder.overrideParams.push('/P:Platform=x86'); builder.overrideParams.push('/fl'); builder.overrideParams.push('/flp:logfile=build.log;verbosity=diagnostic'); builder.publish();
... which you would run something like:
npm install msbuild node builder.js
No powershell is required.
source share