Invoking MsBuild from Powershell

Unfortunately the command ‘msbuild’ is not in the default command line path. This means, that you cannot invoke ‘msbuild’ by just calling ‘msbuild’. You need to find the directory of the .Net-Tools via the registry and use an absolute path.

You could also call your script from the Developer Command Line, but my feeling is that this command line never works as intended.

Another solution is to use a script which does all the look for you:

https://invokemsbuild.codeplex.com

Invoke-MsBuild does all the dirty work for you.

One example about its usage can be found in my Nuget-Package-Packer packaging NuGet-Package for the NuGet-Package-Repository.

https://github.com/mbrenn/datenmeister-new/blob/master/nuget-packages/pack.ps1

It just works (minor improvements ongoing).

DatenMeister.dll auf Nuget

After a long time of doing nothing, I finally published the DatenMeister.dll in Nuget.

This C# library contains a small interface of the MOF specification as defined by the OMG object group.

image

It also include a very simple in-memory interface, which is capable to work on the MOF-instances.

In combination with other libraries, it is planned to create a library, which shows somehow a conformance to the MOF and UML specifications.

Of course, the complete library is available within GitHub. (https://github.com/mbrenn/datenmeister-new/tree/master/src/DatenMeister).

The server

Server was ordered and is assembled and running fine:

image

Due to space constraints, I decided to try out a barebone, where memory, power supply and housing is already included.

IMG_6149

The following components are included,. Since I’m totally non-aware of the current hardware specifications and technology, there was more wikipedia involved than real knowledge. Hard to keep up… also in hardware.

image

So, in total: a Skylake4 GB RAM, 12 TB HDD, 256 GB SSD for the operating system and a small CPU. Should be sufficient as a storage device.

Surprisingly, the assembly of CPUs, HDDs, SDDs (m.2) just lasted about 15 minutes. I expected at least one or two hours. The only guessing I had was the direction of the m.2 interface. It looks symmetric, there is not cut-in and there is no symbol about the upward side… I browsed through the internet and it was called ‘double-sided M.2’. I just tried out side with the logo upwards and hoped… It worked.

It is intended to run the HDDs as a 6 TB mirrored RAID-1 which allows the loss of one of the HDDs without losing any data.

The OS

image

I did not want to waste 90 EUR for a Windows licence and I wanted to improve my Linux knowledge, so the decision was very clear for me:

The OS will be a Gentoo Linux and probably one or two Ubuntu instances with kvm or another virtualization technology. Why Gentoo? Because I always used Gentoo. There is really no reasoning except having the feeling of total control…

The OS itself was installed after 1 hour. Another half an hour was needed to find out that the intel driver “e1000e” instead of “e1000” is necessary for the latest mainboard revisions. Minor issue, a little bit annoying.

Null Conditional Operator

A really cool feature in the latest version C# is the “?.”-operator.

What does it do? It checks whether the left side of the operator is null or not. If it is null, the operation will be evaluated as null, otherwise the “.”-operator will be used. A lot of null-comparison can be stripped out of source code.

Example:

return (x as IElement)?.metaclass?.Equals(UmlClasses[„g“]);

would be written in old format as:

var y = x as IElement;
if (y == null) { return null; }
var m = y.metaclass;
if (m == null) { return null; }
return m.Equals(UmlClassed[“Generalization”]);

Now availale as a single line. In combination with the “??”-operator even more powerful.

return (x as IElement)?.metaclass?.Equals(UmlClasses[„g“]) ?? true;

Gibt true statt null zurück, wenn einer der Ausdrücke als null gewertet werden.

image

http://www.codeproject.com/Articles/850832/What-s-new-in-Csharp-Null-conditional-operators

The rat came in

After thinking about getting a new homeserver for a long, long time, I finally decided to buy the components to assemble a new homeserver.

Unbenannt

The homeserver will be called “Ratte” as it is also living in the basement. All my PCs are called like animals:

  • Alligator: Old one… obsolete
  • Bueffel: My first laptop… also called “Aschenbecher” (Ash tray) as it was called as dirty as an ash tray, still working, but not used (more than 12 years old)
  • Chameleon: My first smartphone
  • Dingo: Another smartphone
  • Esel: Still living, my primary workstation (desktop)
  • Fuchs: Dead
  • Habicht: Dead… was my primary laptop… An Acer ultrabook, did not boot up one morning
  • Hamster: My NAS, hosting a lot of data
  • Henne
  • Iltis: My Surface 2
  • and now Rat: My basement server… will take over the task from Hamster

What are the requirements for “The Ratte”?

  • A lot of storage
  • Some computing power
  • Being able to host content being reachable via the internet
  • Media server

So I decided for a full PC instead of having a small foot-print raspberry pi not being able to do computing intensive work.

Owin modules in IIS

After having finished a self-hosting Owin-Module, I planned to integrate it as a module within the IIS. It was not as easy as I expected since the IIS does not support Owin modules directly.

The following steps were necessary and the article on asp.net gave some good support. Stackoverflow is still a very good source:

  1. Create new ASP.Net Web project within Visual Studio
  2. Via nuget, add “Microsoft.Owin.Host.SystemWeb”
  3. Add a startup class, which looks like the following one: Startup.cs

image

In contrast to the self-hosting Startup file, two modification were made:

a) When running within IIS, the current directory is not the one where the assembly is stored, so we have to find the current directory via ApplicationBase (could be included into the Iwon middleware)

b) We need to include a ‘StageMarker’ to give IIS a hint, that we would like to serve the file before the default IIS modules, which are non-managed and non-Owin become active.

  1. Change the web.config to include the information, that the managed assembly (our .dll) will get invoked for every request. By default, the IIS only calls the managed world if there is no file extension.

image

In total, not as fluent, as I thought, but still working.