Digital Tool Factory blog - Backend web development in Atlanta GA

The Digital Tool Factory Blog

How to fix your web.config files not transforming in Azure Pipelines and Releases

After much sturm and drang I finally found that if you change your build arguements to

msbuildArgs: ‘/p:DeployOnBuild=true  /p:WebPublishMethod=Package  /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true  /p:PackageLocation=”$(build.artifactStagingDirectory)”  /p:AutoParameterizationWebConfigConnectionStrings=false’

And do the the other tips listed on this blog then the web.config files should transform like they are supposed to.

Jul 22

Written By Steve French


A quick write up to document web config changes when deploying to azure using release pipelines in azure devops

So – you want a step by step guide to deploying web apps to azure web apps from azure devops and changing config files in the release pipelines? Look no further.

First create the new web.config files, as seen below

In the file properties – make sure they are set to “Content” and “Copy Always”

In the pipeline properties – make sure that xml transformation is checked, and that there is the proper value of

In Make sure your azure stage has the same name as the web.{name}.config file

May 22

Written By Steve French


How to Get the ID of the logged in user in mvc web api apicontroller

After much googling, and evening Bing-ing revealed nothing I discovered that for some reason I had the line


In my WebAPIConfig.cs file – I removed that and everything magically worked and I could use User.Identity.GetUserId();

Feb 22

Written By Steve French


Dynamic page redirects in TestCafe

So – you need to redirect to a dynamic page in TestCafe you say? Try the below

const setValue = ClientFunction(() => {
var idToUseForRedirection=document.querySelector(‘input[name=”ID”]’).value;
document.location.href=”” + idToUseForRedirection;


await setValue();

Jun 21

Written By Steve French


More Test Cafe Goodies

Generating a random string in some logical order

const setValue = ClientFunction(() => {
var dt = new Date();
var dateString =”Steve French Test – ” + dt.getTime();
document.querySelector(‘input[name=”ctl00$CPHSIURate$txtRiskName”]’).value =dateString;
document.querySelector(‘input[name=”ctl00$CPHSIURate$txtRiskName”]’).dispatchEvent(new window.Event(‘change’, { bubbles: true }))

await setValue();

as well as

const setValue = ClientFunction(() => { document.querySelector(‘input[name=”CaptchaAgentValueAsSupplied”]’).value = document.querySelector(‘input[name=”CaptchaAgentValue”]’).value;});
await setValue();

to play with dates

const setValue = ClientFunction(() => { var dt = new Date(); dt.setDate( dt.getDate() – 10 ); var dateString = ((dt.getMonth() > 8) ? (dt.getMonth() + 1) : (‘0’ + (dt.getMonth() + 1))) + ‘/’ + ((dt.getDate() > 9) ? dt.getDate() : (‘0’ + dt.getDate())) + ‘/’ + dt.getFullYear(); document.querySelector(‘input[name=”ExpirationDateOfPriorCoverage”]’).value =dateString; document.querySelector(‘input[name=”ExpirationDateOfPriorCoverage”]’).dispatchEvent(new window.Event(‘change’, { bubbles: true }))});
await setValue();

Mar 21

Written By Steve French


How to change out appsettings.json files upon in an Azure DevOps Release

As I continue to explore Blazor I came across an interesting problem – to wit – how does one change the appsettings.json in an Azure Release? Ideally you would want to use the appsettings.QA.json in your QA environment, your appsettings.Dev.json in your dev environment, etc. I could not find any obvious way of doing this.

Were is regular mvc 5 I could just name the release stage “QA” and the magic of Azure would do the necessary web.config changes (i.e. change to web.config upon release/publish.)

After writing out an email to a friend to ask him how he would do it I came across the answer – on this blog post actually. The key is to add an ASPNETCORE_Environment variable to whatever it is you want your environment to be, i.e. if you have appsettings.PublicDev.json you would just need to add an ASPNETCORE_ENVIRONMENT value of “PublicDev” – then release!

Dec 20

Written By Steve French


How to fix problems with Test Cafe Studio and Datepickers

I’ve become quite a fan of Test Cafe Studio this past year – I’ve found it to be an excellent mix of automated testing and browser automation. One persistent problem I’ve had is how it treats the datepicker – specifically it works for one month, and then doesn’t work at all (due to the position of the numbers changing on the datepicker).

One convenient way of always selecting the last item in the datepicker is by selecting the last table cell using css, namely by using this as the target of the click event


However, that doesn’t work if there are other tables on the page. The workaround I’ve found is to add the following to the click event. That will find the right box and click it properly.

Oct 20

Written By Steve French


How to fix the “failed to register url the process cannot access the file” problem

This happens when you attempt to run and install a Visual Studio 2019 web project – after several hours of searching (and uninstalling/reinstalling things) I came across this solution from the Visual Studio Developer Community – specifically

The fix is to run the following command from an admin cmd prompt:

netsh http add iplisten ipaddress=::

and that fixed everything – note the weird syntax

May 20

Written By Steve French


How to add extra parameters to post requests on web api 2

My only problem with web api 2 is the inability to pass additional parameters the action, along with a base object. For example – if you want to update a contact, but keep track of where the update request came from (the location is not really part of the contact object) you cannot just add location as an additional parameter in addition to contact.

The only way of doing this is to add a parameter to the route – for example

[OutputCache(NoStore = true, Duration = 0)]
public bool IsUniqueEmail(string locationArea,Contact contact)
//stuff happens
DoStuff(contact, locationArea);
return bool;

Apr 19

Written By Steve French


How to fix problems with entity framework migrations

  1. First – backup the __MigrationHistory table in the database
  2. Get rid of old migration files
  3. add-migration using the usual syntax, but with nothing modified
  4. Remove all of the “Create Table”, etc – the migration should look like
  5. public partial class domorenow : DbMigration
    public override void Up()

    <code>    }
        public override void Down()
  6. from there do the update-database -script to generate a sql file
  7. then just update-database -verbose
  8. All Fixed

Feb 19

Written By Steve French


Copyright 2011 Digital Tool Factory. All Rights Reserved. Powered by raw technical talent. And in this case, WordPress.