Wednesday, March 8, 2017

VS 2017 setup the product definitions failed to load

I tried to upgrade my Visual Studio 2017 RC to the release version and got an error product definitions failed to load

The way I got the installer to work was to delete the folder  %LocalAppData%\Microsoft\VisualStudio\Packages\ 

After that running the installer I was able to update my install to the released version

Sunday, March 5, 2017

Cloning an Object in an PCL

Here is an example on how to clone an object in a portable class library

I am using to help.  Add the Json.Net nuget package to any project in the solution that uses the PCL

Then you an serialize the object into Json and then deserialize it right away to create a clone of a object

        public T CloneObject<T>(T toBeCloned)
            T clone = default(T);
            string serialized = JsonConvert.SerializeObject(toBeCloned);
            clone = JsonConvert.DeserializeObject<T>(serialized);
            return clone;