Visual Studio 2015 Update 3 e .NET Core 1.0

Visual Studio 2015 Update 3 e .NET Core 1.0 sono finalmente disponibili. Trovate tutti i dettagli al seguente post sul blog di Visual Studio:


Microsoft + Xamarin

Xamarin, framework di sviluppo per applicazioni mobile usando il .Net Framework, è stato appena acquistato da Microsoft. Trovate tutti i dettagli dell’acquisizione qui:


Visual Studio “15” Preview è qui!

Finalmente! Visual Studio “15” Preview è finalmente disponibili. Tutti i dettagli e come scaricarlo sono qui:


DevOps: dalla teoria alla pratica

Qualche giorno fa, noi di DotNetCampania, abbiamo tenuto una conferenza su DevOps. Di seguito trovate le slides delle mie due sessioni.


Continuous integration per le applicazioni mobili

Qualche giorno fa ho tenuto questa sessione ad Ancona per DevMarche. Qui potete trovare le slide:


MacInCloud + VSTS

MacInCloud, azienda che consente il noleggio di macchine Mac, consente anche l’acquisto di un build agent compatibile con Visual Studio Team Services. Se siete interessati, trovate prezzi e configurazione qui: 



Il mio TecHeroes a FutureDecoded 2015

Di seguito trovate la mia intervista TecHeroes a Future Decoded 2015–Git


Logging in multiple files with Powershell

In this blog post is explained how to write in multiple files using Powershell. To achieve this purpose, we are going to use message streams, which we have already seen in the previous post: do no use write-host cmdlet.

Streams are a fundamental feature in a scripting language that supports piping such as Powershell, especially to avoid that cmdlet receive messages instead of what they really expect. An interesting reading about this topic is:

In the following sample, we are going to write in different files based on the output type:

  1. Log.txt: Write-Host and the Output stream (Write-Output);
  2. Warning.txt: Warning stream (Write-Warning);
  3. Error.txt: Error stream (Write-Error).

In lines 16 and 18, Write-Warning and Write-Error messages are sent to the Output stream using redirection operators (2>&1, 3>&1). Each stream and all data related to Write-Host, is written in Log.txt file by “*>” operator when is run (line 24).

The trick to write in multiple files is to use the Tee-Object, which saves data in lines 16 and 18 and send it to the specified file.


More about redirection:

More about Tee-Object:


do not use write-host cmdlet

Again: do not use write-host cmdlet! This isn’t something reckless, but there’s a good explanation about this statement. First, if you use Powershell, you need to understand a basic concept:

Powershell is about automation

This means that Powershell scripts need to be write thinking about automation. And for this reason, Write-Host does not have nothing in common with automation. To understand why, we need to investigate on how Write-Host works. To get started, Powershell has many message streams:

  1. Output/Success
  2. Error
  3. Warning
  4. Verbose
  5. Debug

To write inside these streams, we can use the following cmdlets (based on the previous list):

  1. Write-Output
  2. Write-Error
  3. Write-Warning
  4. Write-Verbose
  5. Write-Debug

So, Write-Host is not related to any stream! This means that Write-Host log directly onto the console. And this is the only reason you should use it. If you need to create a script that is interactive or is ran into the console manually, then we could use it. Jeffrey Snover, Powershell’s father, in the article linked at the bottom, suggests to use it only in throw away scripts. Otherwise, is suggested to use Write-Output. Instead, if we would like to let the user choose what information he wants to see, you could use Write-Verbose.

Following, an example to understand how Write-Host works:

Inside log.txt file we can find just the output of Write-Output. Of course, we can cheat and use Write-Messages *> C:\Temp\log.txt. This way, we use redirection operator to force all outputs to be in the file (note: I’ve tested this only in PS 5). But if you want my 2 cents: don’t do it!  Besides, also Write-Output can write in the console!  The main difference is that information will be send through stream (as object) and could be used through piping. If Write-Output is the last cmdlet, then information will be sent to the console. One missing feature could be the output formatting, but using a bit of creativity we can use the following cmdlet (the idea came from Stack-Overflow:

Suggested reading

Write-Host considered harmful:


Best Practices for Hyper-V Backups

A lot of very interesting best pratices for Hyper-V backups.