I've spent about 3 days to setup TeamCity to build and publish asp.net-5 project. Finally I did it by using dnu publish
command to publish the site. I'm using the batch file to do it with following commands
// stops the apppool for 'samplesite' overvise it returns exception
// The process cannot access the file '...' because it is being used by another process
call "%windir%\system32\inetsrv\appcmd" stop apppool "samplesite"
// publish the site to the --out dir
call "C:\Users\Administrator\.dnx\runtimes\dnx-coreclr-win-x86.1.0.0-beta6\bin\dnu" publish --out "F:\Sites\samplesite" --runtime dnx-clr-win-x86.1.0.0-beta6
// copies the 'prod' config.json
copy "..\..\build\configuration\samplesite\config.json" "F:\Sites\samplesite\approot\src\samplesite\config.json" /Y
// copies the 'prod' web.config
copy "..\..\build\configuration\samplesite\web.config" "F:\Sites\samplesite\wwwroot\web.config" /Y
// starts the apppool for 'samplesite'
call "%windir%\system32\inetsrv\appcmd" start apppool "samplesite"
The questions are
- Is it possible to return errors/exceptions from
dnu publish
command to show that publishing is failed? For example, I can get an exception while doing publishing- The process cannot access the file..... or
- The path length cannot be longer than 260 characters ...
BUT the TeamCity Build Result will be shown as Success
, so I always need to check that it really finished without any exceptions.
- Is there another better way/script to publish asp.net-5 site? Maybe I'm just doing something wrong.
dnu publish
which I'm trying to achieve but without success. – Amboise