File Download Script for Visual Studio


If you have some binary files you need for your Visual Studio project but you don’t want to add them to your version control system, here’s a PowerShell script that does the downloading for you:


Basically this mimics a very simple dependency management.

Source Repository:


At the very top of the script, you define which files to download where.

For example, this downloads the x86 and the x64 version of a SQLite .dll file:

$base_url = ''
$files = @{
  '..\sqlite.dll' = "$base_url/x86/sqlite.dll"
  '..\sqlite_x64.dll' = "$base_url/x64/sqlite_x64.dll"

Entries must be separated by line breaks or semicolon (;).

Paths are relative to the location of the script file.


To include the script in your project, call it from your project’s Pre-build event.

For example, if you’ve placed download.ps1 in a folder called libs in your project, use this line to execute it:

powershell -ExecutionPolicy ByPass -File "$(ProjectDir)\libs\download.ps1"

That’s it.

When Does It Download

The script will download the files if:

  • they don’t exist
  • the script file is newer as the files (idea behind this: you’ve changed the file version to download)
  • a file named force-download.txt exists in the scripts folder and this file contains anything else but “false”

These rules are defined in the Needs-Downloading function.

PowerShell functions for the uninitiated (C# programmer)

Being a C# programmer, I recently found some use for Microsoft’s PowerShell (the cmd replacement). What’s nice about PowerShell is that it has full access to the .NET framework.

However, there are also some very pit falls when coming from C# (or any related programming language).

There’s one very mean pit fall when it comes to functions and their return values that – if you don’t exactly know how PowerShell works – makes you pull out your hair.

Read more →