Saturday, February 11, 2017

VS Is Becoming Worse & Worse...


Recently, I tried, using VS 2015 Community, to create a simple Xamarin Forms app. All I did was select the standard template, and then tried to run the Android program. Didn't work ...

I don't remember the details, but rather than go through the tedious repair/uninstall process with VS 2015, I thought I'd try to install the VS 2017 Community Beta. I selected the standard template for Xamarin and then got this:

Not entirely encouraging ...
So I stopped VS 2107 and re-opened it. Then created the project again. I removed the iOS project, as I don't have a Mac, and don't want to see the "no mac" error window all the time. The Android project is the default start project. No error about packages this time. So I did a clean/rebuild of the solution. Here's the first error in the list of 3780!

Severity Code Description Project File Line Suppression State
Error CS0012 The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'. DemoXamarinForms.Droid C:\repos\DemoCode\DemoXamarinForms\DemoXamarinForms\DemoXamarinForms.Droid\MainActivity.cs 7 Active

So first error is that mscorlib is not in any of the assemblies in the reference list for the Android project.

Does anyone do any testing at Microsoft anymore? It seems that since they went to this "open source" model, all they do is post s**t with the attitude "Well, this ought to work. If it doesn't the users will let us know ..."

As DJT might tweet: "SO SAD"...

Monday, May 30, 2016

Living Far From the Edge ...

I've been using Windows 10 for quite some time now. It's running on an "older" machine - a Dell Studio 1555 with one of the early duo core CPU's, the "Intel Mobile Core 2 Duo  T6600". It doesn't support hyperthreading (which is another problem for me), and runs at about 2.1GHz. Not too bad, and I upgraded it sometime ago with a 500GB SSD, and a total of 8GB RAM. Oh, and an FHD, non-touch, LCD display. I'm actually pretty impressed that Win 10 works very reliably on this 5+ year old machine.

The Edge browser, on the other hand, is still just one more piece of crap from what is turning into a longer and longer line of crap from Microsoft. My complaints about Edge basically come down to two:
  • I can't change the "new tab" page to be my own home page.
  • I can't block all the fracking ads and trackers from loading that turn the browser into a dog-shit slow lump of lead.
As it turns out, I like Bing, and I use Bing as my home page in all my browsers. In IE, I could specify what page I wanted opened when I clicked on the "new tab" button.  While Firefox and Chrome don't have that feature natively, I could install some simple extensions that allow me to fix that problem.

Similarly, I use Ghostery to block useless intrusive ads and trackers - my other browsers load MUCH faster than Edge.

While I like the Edge interface, the lack of control about what I am presented is just too big a disappointment.

Good luck with all that "We are in control" bullshit, Microsoft. It might work in China ...

Saturday, December 5, 2015

Typescript Turmoil in VS Code!

Recently, at work, we've switched from ASP.NET MVC development to AngularJS / Nodejs. It's been a bit of a struggle, and a decision that was outside my purview. Nevertheless, learning something new is always good, and it seems that MS is joining the MEAN camp part way by supporting Node, Angular, and Express with their suite of Visual Studio products. I believe you can also have a Mongo instance in Azure, but don't quote me on that - could be a senior moment ....

Unfortunately, with great complexity, comes great confusion...

At first, I simply added the Nodejs tools to Visual Studio 2013. That seemed to work ok, but at work we're using WebStorm. Visual Studio with Node simply seems to make projects and applications in a different enough way that it wasn't helping me with work. So I installed VS Code. I tried for weeks (part time at home on the weekends while managing family obligations) to get VS Code to do something as simple as build a one file .ts application. Finally, after banging my head against the wall (figuratively), I have gotten it to work. Hopefully, I can save some people some bruising ...

There were two salient factors that made my life so miserable for so long.

  • If you have installed Node Tools for Visual Studio, and then subsequently run (as suggested) "npm install typescript -g" to install typescript for VS Code, you now have TWO (count them, two!) potentially different versions of the typescript compiler in TWO different places. 
  • Running "npm install typescript -g" puts typescript in a location that is not reflected in your PATH system variable. Yet all of the "examples" of how to configure your tasks.json file seem to assume that the npm-installed typescript compiler will be found automagically. Oddly enough, this did not happen for me.

So the corrective actions that I took to get things to work are actually quite simple.
  • Remove the path to the Node Tools installed version of typescript from your PATH system variable. If you don't know how to do that instructions are here.
  • In a command or powershell window enter "npm list -g". This will show you all the globally installed npm packages. Here's what mine looks like:
c:\>npm list -g
C:\Users\Steven Archibald\AppData\Roaming\npm
└── typescript@1.7.3

What's important is that first line of the response:
"C:\Users\Steven Archibald\AppData\Roaming\npm"
Copy that from your machine and save it in a text file for the moment.

When you create your first tasks.json file in VS Code, it will look like this:
// A task runner that calls the Typescript compiler (tsc) and
// Compiles a HelloWorld.ts program
{
"version": "0.1.0",

// The command is tsc. Assumes that tsc has been installed using npm install -g typescript
"command": "tsc",

// The command is a shell script
"isShellCommand": true,

The line, "command" : "tsc", is why my .ts files were not being compiled. The root of the problem is,  VS Code is just going to look in your local directory (apparently) to find the typescript compiler. It won't find it there - you installed it globally, remember? And you don't have a path statement to point to where it really is.

So, you could add the "...\npm" path to your PATH system variable (I haven't tried that yet), or you could change your tasks.json file to have:
"command": "C:\\Users\\Steven Archibald\\AppData\\Roaming\\npm\\tsc",
It now works as expected!
Note that your path will be different based on what your "npm list -g" returns, and that the "\\" are required to escape the "\" character.

Hope this helps save people some time, and Happy Typescripting!