Am I running in the Azure Devfabric?

There are several ways to check if you’re running in the DevFabric. Here is my way.

if (cloudStorageAccount.TableEndpoint.OriginalString.StartsWith("") && IsRunningInDevFabric())
               // Yes I'm running in DevFabric
        private static bool IsRunningInDevFabric()
            // Try to translate deployment ID into guid
            Guid guidId;
            if (GuidTryParse(RoleEnvironment.DeploymentId, out guidId))
                return false;   // Valid guid? We're in Azure Fabric
            return true;        // Can't parse into guid? We're in Dev Fabric
        // This is needed as Guid.TryParse is only available in .NET4
        private static bool GuidTryParse(string s, out Guid result)
            if (s == null)
                throw new ArgumentNullException("s");
            Regex format = new Regex(
                "^[A-Fa-f0-9]{32}$|" +
                "^({|\\()?[A-Fa-f0-9]{8}-([A-Fa-f0-9]{4}-){3}[A-Fa-f0-9]{12}(}|\\))?$|" +
                "^({)?[0xA-Fa-f0-9]{3,10}(, {0,1}[0xA-Fa-f0-9]{3,6}){2}, {0,1}({)([0xA-Fa-f0-9]{3,4}, {0,1}){7}[0xA-Fa-f0-9]{3,4}(}})$");
            Match match = format.Match(s);
            if (match.Success)
                result = new Guid(s);
                return true;
                result = Guid.Empty;
                return false;