I do not know what caused the problem, but at a given moment, I got the error:

 

The Dnx Runtime package needs to be installed. See output window for more details

 

To fix this problem I entered the following commands in the package manager console:

 

dnvm upgrade

dnvm upgrade –r CoreClr

dnu restore

 

Closed all visual studio 2015 instances and opened the project,  now I could build the project wihout errors.

 

Found my solution at: http://stackoverflow.com/questions/31957824/the-dnx-runtime-package-needs-to-be-installed-see-output-window-for-more-detail

Tags: ,

When I wanted to install a bower package inside Microsoft Visual Studio 2015 update 1 (inside a corporate netwerok), I got the error:

ECMDERR Failed to execute "git ls-remote –tags –heads git://github.com/systemjs/systemjs.git", exit code of #128

 

This solution: http://stackoverflow.com/questions/21789683/how-to-fix-bower-ecmderr

Enter the following command on the commandline:

git config –global url."https://".insteadOf git://

Tags: , ,

In the previous post I described how you can get started with ASP.NET 5.

 

The code used in this blog post can be found at: https://github.com/roelvanlisdonk/Research/tree/master/Blog/ASP.NET5/TypeScriptES6Modules

 

In this post I will describe how you can get start using TypeScript 1.7 and the ES6 module syntax to order your code in an ASP.NET 5 application.

 

I will explain how you can use a “library” module inside your app code, by using TypeScript and the ES6 module syntax.

The compiled code will be in ES5, so we need a library called “system.js” to load the “ES6 modules” at runtime.

 

  • After you followed the steps in the previous post
  • Add a TypeScript JSON Configuration File to the wwwroot folder

 

image

 

Add "module": "system", under compileroptions:

 

image

 

Add two typescript files:

  • wwwroot/core/app.ts
  • wwwroot/libraries/list/findIndexByItem.ts

image

 

 

 

  • Add the system.js bower package.

This is needed, because the typescript will be compiled into javascript modules.

These modules are in the “system.require” format.

We could use other module formats (see tsconfig.json), but in this example I wanted to use system.js

 

Before we can add the system.js bower package, add a “Bower Configuration File” to the root of the project.

 

image

 

In this example I use the folder “wwwroot/libraries” to store all my runtime JavaScript dependencies, so we have to edit the .bowerrc file, change:{ “directory”: “wwwroot/lib” } to { “directory”: “wwwroot/libraries” } .

 

image

 

Now we can install the system.js bower package:

 

image

 

 

findIndexByItem.ts

 

image

 

 

app.ts

 

image

 

 

index.html

 

The only javascript file we directly load in the index.html is “/libraries/system.js/dist/system.js”. All other logic will be dynamically loaded by the system.js loader.

 

To  make system.js recognize file paths like System.register(["../libraries/list/findIndexByItem"] , so without the “*.js” extension, we need to add a little configuration by using System.config, then we load the “core/app.js” file and start the application.

The “core/app.js” uses the library module “findIndexByItem.js”. This JavaScript file will be dynamically loaded, when “core/app.js” is requested.

 

 

image

 

Result

 

image

 

 

Note: for browsers that do not support promises you need a promise polyfill, that can be found, here: https://github.com/jakearchibald/es6-promise/

Tags: , ,

Roel van Lisdonk on January 15th, 2016

 

If you are starting with ASP .NET 5 (1.0.0-rc1-final) and you just want to serve an “index.html”, you can follow these steps:

  • Start Visual Studio 2015
  • File > New > Project…
  • Installed > Templates > Visual C# > Web > ASP.NET Web Application
  • Choose .NET Framework 4.6.1

image

 

  • ASP.NET 5 Templates > Empty

image

 

  • Open project.json and add package dependency “Microsoft.AspNet.StaticFiles”: “1.0.0-rc1-final”:

 

image

 

  • Open Startup.cs and remove the app.Run lines:

image

 

  • In Startup.cs add the follwoing lines in the Configure methode beneath app.UseIISPlatformHandler();:
    • app.UseDefaultFiles();
    • app.UseStaticFiles();
  • Like so:

image

 

 

  • Add an index.html file to the wwwroot folder and add the text “Hello world from html” to the body:

 

image

 

 

 

Press F5 and the a browser should appear showing you the “Hello world from html”

 

image

Tags: ,

I upgraded Visual Studio 2015 TypeScript extension to 1.7.6, then compile on save stopped working.

First I checked if “Compile on save” was enabled on my 4.5.2 web project properties (TypeScript Build tab):

 

image

 

Then I checked if “Automatically compile TypeScript file which are not part of a project” was enabled (Tools / Options).

 

image

 

Then the TypeScript files still would not compile on save (they were compiled, when the project was build, but not when a TypeScript file was saved.

 

The solution

I removed the following part in my Web.csproj file:

 

<PropertyGroup Condition="’$(Configuration)|$(Platform)’ == ‘Debug|AnyCPU’">
    <TypeScriptTarget>ES5</TypeScriptTarget>
    <TypeScriptJSXEmit>None</TypeScriptJSXEmit>
    <TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled>
    <TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny>
    <TypeScriptModuleKind>None</TypeScriptModuleKind>
    <TypeScriptRemoveComments>False</TypeScriptRemoveComments>
    <TypeScriptOutFile />
    <TypeScriptOutDir />
    <TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations>
    <TypeScriptNoEmitOnError>False</TypeScriptNoEmitOnError>
    <TypeScriptSourceMap>True</TypeScriptSourceMap>
    <TypeScriptMapRoot />
    <TypeScriptSourceRoot />
  </PropertyGroup>

 

Then I added a tsconfig.json file to the root of my project:

image

 

tsconfig.json

{
  "compilerOptions": {
    "noImplicitAny": true,
    "sourceMap": true,
    "target": "es5"
  }
}

 

 

 

Don’t now if both steps are needed, but after that, my compile on save started working again.

Tags: ,

Roel van Lisdonk on December 30th, 2015

Just some reminders, when working with ES6 modules:

  • ES6 modules are automatically strict-mode code, even if you don’t write "use strict"; in them.
  • When you run a module containing an import declaration, the modules it imports are loaded first, then each module body is executed in a depth-first traversal of the dependency graph, avoiding cycles by skipping anything already executed.

More information on ES6 modules:

Tags:

Roel van Lisdonk on December 30th, 2015

 

Git is a decentralized version control system as opposed to a centralized version control system, like TFS, SourceGear Vault, Subversion, Visual Source Safe etc.

A centralized version control system, has a single server that contains all the versioned files, including their history, and a number of clients that check out files form that central place.

A decentralized version control system (such as Git, Mercurial, Bazaar, Darcs etc.), mirrors the respository (including all history) to all clients.

 

Storing data

Every time you commit, or save the state of your project in Git, it basically takes a “picture” (also revered to as a snapshot) of what all your files look like at that moment and stores that snapshot. You can think of this snapshot as a copy of all files in your working folder (that are tracked).

 

Storing data efficiently

Git has several mechanisms to store data  efficiently:

  • Each file is zlib compressed before it is stored as a blob in the .git folder and refered to by a SHA-1 of its content.
  • If a file in a snapshot is not changed, the snapshot will not contain a copy of the file, just a pointer (SHA-1) to the file already in git.
  • Once in a while, git will comporess multiple blobs into a single packfile, to increase compression ratio.

By using these mechanisms Git does not have to store deltas at the file level, to be efficient on storage and fast will be extremely fast, when previous snapshots should be restored.

 

SHA-1

The snapshot will get an identifier associated with it (a SHA-1 of the snapshot content). A SHA-1 is a 40-character checksum string composed of hexadecimal characters (0–9 and a–f) that uniquely indentifies the contents of the snapshot.

 

Now there are serveral ways you can work with Git. This blog post describes the way, we use Git.

 

Clone remote respository and commit your first change

The following diagram describes the proces of cloning a remote Git repository and making you first change to it on a locale repository.

 

image

 

 

Fetch and merge changes from remote to local and push changes from local to remote

The following diagram describes the process of fetching and merging remote changes to a local repository and then pushing local changes back to the remote repository:

 

image

 

Branches

 

We use 3 long lived branches and short lived feature branches on the remote git repository:

  • master
    • all changes that should go in the product will eventualy be merged into master
    • all branches will be created from this branch
  • acceptance
    • when it is time to deploy the software to the acceptance servers, the code from master is pulled to the acceptance branch and a build of this acceptance branch will be deployed to the accepatance servers.
  • production
    • when it is time to deploy the software to the production servers, the code from the acceptance branch is pulled to the production branch and a build of this production branch will be deployed to the production servers.
    • when a bug is found in production, it is fixed on the production branch, then fetched and merged into the acceptance branch and then fetched and merged from the acceptance branch in to the master branch.
  • Feature branches
    • All development is done in feature branches.

 

 

image

 

Now this is not perfect, but you can add branches for QA, test or pre-prod, at will, but  maybe you don’t want a branch for each “software life cylce” step and just want to use branches foreach release, thats all up to you.

Tags:

Roel van Lisdonk on December 18th, 2015

Today I changed my blog to work with HTTPS. With the emerging HTTP/2 standard and google promoting HTTPS sites, I decided to convert my site from HTTP to HTTPS.

After installing the certificates I used the WordPress plugin: Really Simple SSL

to convert all my insecure http content. After activating this plugin, this site is finally running on HTTPS:

 

image

 

Even publishing with Open Live Writer still works!

Tags:

Roel van Lisdonk on December 17th, 2015

To convert files from a SoureGear Vault Standard v3.1.9 to Git including all history I went on a journey and in this blog post I will describe the journey steps.

Note: this blog post will probably contain unnecessary steps, but non the less it describes the steps how I successfully converted all files found in a SourceGear Vault Standard v3.1.9 server to Git, including all history.

 

Steps

 

Notes

  • The SourceGear Vault Standard v3.1.9 was installed on a Microsoft Windows 2003 32bit Server.
  • On the server was a Microsoft SQL Server 2005 32 bit installation.
  • During the upgrade I switched to a Windows 10 (64 bit) Hyper-V machine.
  • To prevent “multi user” sql connection problems, make sure you stop the vault service with a iisreset /stop, before installation.
  • All developers should checkin their files on the SourceGear Vault Standard v3.1.9 server.
  • Verify that no files are checked out with the Vault Standard v3.1.9 admin tool.
  • If you are using SQL Server 2005 make sure that the database sgvault is in SQL Server 2005 compatibility modus

 

 

Steps on the Microsoft Windows 2003 32bit Server

 

  • For the conversion, I added the SourceGear Vault Service IIS application pool user, to the local administrator group.
  • Our Vault Service connects to SQL Server by using windows authentication. I added the sgvaultuser, Network Service and the locale user that was executing the setups to the SQL Server sysadmin group for the conversion.

image

 

Steps on the Microsoft Windows 10 64bit Hyper-V virutal machine

The following steps were executed on an empty Microsoft Windows 10 (64 bit) Hyper-V virtual machine.

  • Turn the Windows IIS feature on (including all sub features)
  • Install SQL Server 2014 (64 bit)
  • Create databases on SQL Server 2014: sgmaster, sgnotify, sgvault, sgvaultindex
  • Restore the databases on SQL Server 2014 from the SQL Server 2005 backups: sgmaster, sgnotify, sgvault, sgvaultindex
  • Set compatibility modus to SQL Server 2014 for the SQL Server 2014 databases: sgmaster, sgnotify, sgvault, sgvaultindex
  • Execute SQL “login / user” correction script, found at: http://support.sourcegear.com/viewtopic.php?t=924
  • Install the Vault Client
  • Verify we have a working Vault Standard v9.0.0 installation.

 

Git

  • Install Git https://git-scm.com/downloads in my case it was v2.6.4 Git for Windows.
  • During installation make sure, you choose: “Run Git and included Unix tools from the Windows Command Prompt”.
  • Intialize Git, set username and email
  • Create a respository on C:\Projects\Git\MyRepo
  • Commit one file (e.g. an .ignore file) to the MyRepo master with a initial commit.
  • IMPORTANT, do a GET of all Vault files to this MyRepo folder, making all files writable

image

 

 

Vaut2Git

image

  • Build the solution in release modus.

 

Now the really import part is adjusting the App.config file

 

Vault.Server

The servername, because I am running the vault2git tool on the vault server this is localhost.

Vault.User

The vault user name used to login to the SourceGear Vault.

Vault.Password

The vault user password used to login to the SourceGear Vault.

Vault.Repo

The Vault repository name, to get the files from

Git.DomainName

This is the part that will be added to each Vault username to create a Git user email from a Vault username.

Convertor.WorkingFolder

This folder must be the Git repository root folder.

This folder should contain a “.git” folder, before the vault2git is run.

Convertor.GitCmd

The path to the git.exe to use.

Convertor.Paths

At first this is a “;” seperated list of conversions.

Each conversion is a “~” seperated key value pair.

The first part of the conversion is the path in the Vault (in this case the root of the vault “$”).

The second part of the conversion is the Git branch (in this case “master”)

In this case only one conversion is done, namely converting all the files from a Vault respository to a Git repository branch called master.

 

image

 

 

NOW RUN THE vault2git.exe

It should convert all files from vault to git

note that this takes a long time.

In my case 7MB of Vault Source files took 23 minutes to convert!!

 

Bitbucket

Now that we have a locale Git repository containing all Vault Sources and history, we can push this Git respository to a remote Git respository (in our case a Bitbucket service).

  • Create a Git repository in bitbucket.
  • Add users to the Git repository
  • Adjust the client_max_body_size (we set it to 0) in the files:
    • /etc/nginx/nginx.conf (Use sudo vim, else the file will be read-only)
    • /etc/nginx/sites-available/bitbucket-cache
    • This is to allow large commits
  • Adjust postBuffer: git config –global http.postBuffer 1048576000
    • This is to allow large commits (<= 1GB)

 

 

Some additional information and Notes

 

Moving vault databases

http://support.sourcegear.com/viewtopic.php?t=924

Vault upgrade guide

http://kb.sourcegear.com/VaultHelp/viewtopic.php?f=13&t=11648

Vault compatibility chart

http://www.sourcegear.com/vault/documentation/compatibility_chart.html

SQL “login / user” correction script

USE [master]
IF ( NOT EXISTS (SELECT sid FROM syslogins WHERE name = ‘sgvaultuser’) )
CREATE LOGIN sgvaultuser WITH PASSWORD = N’VAULTS_ADMIN_PWD’, DEFAULT_DATABASE = sgvault, CHECK_POLICY = OFF;
GO
— next access should be granted in the vault database
USE [sgvault]
EXEC sp_grantdbaccess N’sgvaultuser’
EXEC sp_addrolemember N’db_owner’, N’sgvaultuser’
GO
— The following is ONLY for Fortress and VaultPro:
USE [sgdragnet]
EXEC sp_grantdbaccess N’sgvaultuser’
EXEC sp_addrolemember N’db_owner’, N’sgvaultuser’
GO
— The following is for Vault 4.x and above or Fortress and VaultPro:
USE [sgmaster]
EXEC sp_grantdbaccess N’sgvaultuser’
EXEC sp_addrolemember N’db_owner’, N’sgvaultuser’
GO

 

Rollback

In my case, something went wrong and I had to rollback from 4.0.6 to 3.1.9.

If you have to restore a old database, make sure you first remove all sofware.

Remove alle databases.

Create a new sgvault database.

Restore the backup to this new sgvault database.

Tags:

After importing a Hyper-V virtual machine from a Windows 10 machine to an other Windows 10 machine, the Hyper-V virtual machine reported a network cable unplugged. This was fixed by running the netcfg –d command in a cmd on the destination Windows 10 machine and re-creating the virtual switch afterwards.

Tags: