Visual Studio 2017 – NETFramework Versions

If Visual Studio 2017 is not displaying the relevant Target Frameworks for your machine then it may be that the targeting packs are not installed on your machine.

Run the Visual Studio Installer (from within Visual Studio, select Tools | Get Tools And Features) and select the necessary targeting packs.

When you restart Visual Studio you will find the Target Frameworks have been added to the list.

Useful links…

Troubleshoot blocked .NET Framework installations and uninstallations

How to: Determine Which .NET Framework Versions Are Installed


Snipping Tool – Save As not working

If your Save option in the Windows Snipping Tool is not working have a look at the Registry Setting for My Pictures under Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

If it is pointing to an invalid location, for example you have previously modified a drive letter, you may need to update this to the correct location. Just make sure you restart the Snipping Tool when you have made the Registry Correction. Please note, any modifications you make to the Windows Registry are made at your own risk.

Using PowerShell to get a D365 record count

The Microsoft.Xrm.Data.PowerShell module provides a number of very useful functions for getting information from Microsoft CRM/D365 using PowerShell. The Get-CrmEntityRecordCount is just one of those functions but it only returns a count of all records for an entity. What if I need a record count for a filtered view? Fortunately, this is where the Get-CrmRecordsByFetch function can be combined with FetchXml aggregation.

# Create my connection to D365
$conn = Connect-CrmOnlineDiscovery -InteractiveMode

# Create my FetchXML with the relevant filter to return an aggregate (Count)
$count = Get-CrmRecordsByFetch -conn $conn -Fetch @"
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" aggregate="true">
    <entity name="msdyn_workorder">
        <attribute name="msdyn_name" alias="msdyn_name_count" aggregate="count" />
        <filter type="and">
            <condition attribute="createdon" operator="on-or-before" value="2018-02-01" />

# Get the actual number of records from the AliasedValue

HTTP Actions and 202 Responses

When calling a Function App that returns a 202 (Accepted) Status Code I found my HTTP action in my Logic App was returning a status code of 405 with the a message of “The HTTP ‘GET’ method is not supported by the ‘GenericJsonWebHookReceiver’ WebHook receiver.”.

This seemed a bit odd because I had tested my Function App using the exact same request using Postman and it was returning a valid 202 response. After reading a bit more about HTTP Actions ( the section on Asynchronous Patterns gave me the answer. To disable the asynchronous behavior previously described, set operationOptions to DisableAsyncPattern in the action inputs. In this case, the action’s output is based on the initial 202 response from the server.

Having made this change to the Logic App the server response was accepted and considered a success.

Azure Web App – Read local XML file

I needed a way to get read access to a local XML file in the Azure Web App that is not a .config file. Using the standard naming format for the root folder I can read the XML data file into a DataSet.

DataSet dataSet = new DataSet();
var wscXML = string.Concat(Environment.GetEnvironmentVariable("HOME", EnvironmentVariableTarget.Process), @"\site\wwwroot\wsc.xml");

LINQPad – D365 Connections

You can create connections to Dynamics 365 (CRM 2016 etc) without using the LINQPad CRM Driver.

  1. Create a new query
  2. Select Query | References and Properties from the menu (F4)
  3. Add the following references to the Query Properties
  4. linqpad-d365-1
  5. If you have an assembly with Early Bound entities you can also add it here.
  6. Open the Additional Namespace Imports tab and select the following namespaces. Include any Early Bound entity namespaces here too.
  7. linqpad-d365-2
  8. Enter the following code into LINQPad to make your connection and generate your queries.
  9. The Util.GetPassword is the LINQPad utility method for retrieving a password encrypted in the LINQPad Password Manager.
void Main()
 string url = ""; 
 string username = "";
 string password = Util.GetPassword("d365-crmadmin");
 CrmServiceClient conn = new CrmServiceClient($"Url={url};Username={username};Password={password}; AuthType=Office365");

conn.OrganizationServiceProxy.Timeout = new System.TimeSpan(0, 3, 0);
 IOrganizationService orgService = conn.OrganizationWebProxyClient != null ? (IOrganizationService)conn.OrganizationWebProxyClient : (IOrganizationService)conn.OrganizationServiceProxy;

Context = new XrmServiceContext(orgService);

// Write your queries as normal
 // var myQuery = from a in Context.AccountSet where ....

public XrmServiceContext Context { get; set; }


Visual Studio & Node JS

When you install Visual Studio 2017 it very kindly gives you the option to install Node.js

The only problem with this is that if you are not using v15.3 (or greater) of VS2017 then working with Azure Functions can present a couple of unusal issues.

  • Not being able to install the Azure Client Tools.
  • My application not being able to read from the local.settings.json file using the WebConfigurationManager.

The problem turned out to be the version of Node.js that was installed with Visual Studio and that I needed to update it to a more recent version. After completing the updated installation I was able to install the Azure tools and successfully read values from my local.settings.json file in my local development environment.