C# Zork running on Ubuntu

So I’ve finally got my VSTS builds running on Ubuntu (and Windows). I haven’t installed Linux on a PC in well over a decade but it has come a long way in that time.

  1. Installed Ubuntu 16.04 on HyperV on my Windows 10 dev box. Just boot the HyperV machine to an Ubuntu install disc. That was easy!
  2. Update the project.json file of my .NET Core console host
    1. to build a self-contained application (not required but I figured it would help prevent any deployment weirdness later on)
    2. to target windows and ubuntu so I can use the “dotnet publish” command
      "runtimes": {
        "win10-x64": {},
        "osx.10.11-x64": {},
        "rhel.7.2-x64": {},
        "ubuntu.14.04-x64": {}
      }
    3. Include my game data folder in the publish output
      "publishOptions": {
        "include": [ "GameFiles" ]
      },
  3. Updated the VSTS build to include two command line tasks to do the publish for both Windows and Ubuntu
    1. Add a Command Line Task
    2. Set the Tool to “dotnet”
    3. Set the Arguments to “publish –output $(build.artifactstagingdirectory)/publish/ubuntu.14.04-x64 –runtime ubuntu.14.04-x64 –configuration Release”capture20160814125439163

      This publish command will publish the given runtime package to the directory that will ultimately be copied to the drop folder by the rest of the process

      On this I step originally wasn’t paying attention to the dialog and put the entire command line  in the “tool” text box. That won’t work and you’ll get an error claiming the tool executable can’t be found. That took a while to chase down in my case because a lot of the older posts/forums discuss how to get the dotnet tooling installed into a VSTS Build agent – but it is now built in (Its at C:\program files\dotnet”)

      The final build process looks like this
      capture20160814130253915

  4. After a build is performed the drop folder looks like this
    capture20160814130415970
    I left in the original “Copy Files to” step in the build so that I had access to everything that was built as things progressed. But to run things I just need the folders under the “publish” directory
  5. Log in to Ubuntu and download the publish directory
    capture20160814130646617
  6. Last step is to run it
    capture20160814111814829

 

So the current overall workflow now is

  1. Update the project on Windows in Visual Studio Community 2015
  2. Check in to Github
  3. VSTS automatically builds, runs unit test, and packages
  4. Download to Windows or Ubuntu to run

Next I’m thinking “What could be better than running a 35 year old text adventure on Azure Service Fabric?”

About Negative Eddy

Professional Geek - I work for Microsoft
This entry was posted in Dev Stuff, ZMachine, Zork. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s