none
Uable to Publish Workflows in SharePoint Designer RRS feed

  • Question

  • I have 2 other Site Collections in which I can publish workflows.  When I attempt to publish a workflow on another Site Collection, I get:

    Errors were found when compiling the workflow. The workflow files were saved but cannot be run.

    Unexpected error on server associating the workflow.

    Thanks for the hope,

    Mike W


    SharePoint Engineer - Mike

    Tuesday, September 10, 2019 2:18 PM

Answers

  • Try running the below script which provided by Microsoft.

    <#
    
     This script will add the entries to all web.config files for all web applications in the farm.
    
     Run this script as Farm Administrator in one of the WFEs.
    
     This script only needs to run one time.
    
    SUMMARY: 
    
    This script leverages the native SharePoint SPWebConfigModification API to deploy new updates to the web.config file for each web application on each server in the farm.  Servers added a later date will also get the updates applied because the API configuration is persisted in the config database.  This API does not update the web.config for the central administration web application. 
    
    If you are running workflows on the central admin web application, you will need to manually update the web.config using the steps in the referenced blog.
    
    ==============================================================
    
    #>
    
    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue | Out-Null
    
    function Add-CodeDomAuthorizedType
    
    {
    
        <#
    
        .Synopsis
    
           Adds the necessary authorizedType elements to all web.config files for all non-central admin web applications 
    
     
    
        .DESCRIPTION
    
           Adds the necessary authorizedType elements to all web.config files for all non-central admin web applications 
    
     
    
        .EXAMPLE
    
           Add-CodeDomAuthorizedType
    
     
    
        #>
    
        [CmdletBinding()]
    
        param
    
        (
    
        )
    
        begin
    
        {
    
            $farmMajorVersion = (Get-SPFarm -Verbose:$false ).BuildVersion.Major
    
            $contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
    
            $typeNames = @( "CodeBinaryOperatorExpression", "CodePrimitiveExpression", "CodeMethodInvokeExpression", "CodeMethodReferenceExpression", "CodeFieldReferenceExpression","CodeThisReferenceExpression", "CodePropertyReferenceExpression")
    
        
    
        }
    
        process
    
        {
    
            if( @($contentService.WebConfigModifications | ? { $_.Name -eq "NetFrameworkAuthorizedTypeUpdate" }).Count -gt 0 )
    
            {
    
                Write-Warning "Existing NetFrameworkAuthorizedTypeUpdate entries found, this script only need to be run once per farm."
    
                return
    
            }
    
            if( $farmMajorVersion -le 14 ) # 2010, 2007
    
            {
    
                foreach( $typeName in $typeNames )
    
                {
    
                    # System, Version=2.0.0.0
    
                    $netFrameworkConfig = New-Object Microsoft.SharePoint.Administration.SPWebConfigModification
    
                    $netFrameworkConfig.Path     = "configuration/System.Workflow.ComponentModel.WorkflowCompiler/authorizedTypes"
    
                    $netFrameworkConfig.Name     = "authorizedType[@Assembly='System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'][@Namespace='System.CodeDom'][@TypeName='{0}'][@Authorized='True']" -f $typeName
    
                    $netFrameworkConfig.Owner    = "NetFrameworkAuthorizedTypeUpdate"
    
                    $netFrameworkConfig.Sequence = 0
    
                    $netFrameworkConfig.Type     = [Microsoft.SharePoint.Administration.SPWebConfigModification+SPWebConfigModificationType]::EnsureChildNode
    
                    $netFrameworkConfig.Value    = '<authorizedType Assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System.CodeDom" TypeName="{0}" Authorized="True"/>' -f $typeName
    
                
    
                    $contentService.WebConfigModifications.Add($netFrameworkConfig);
    
                }
    
            }
    
            else # 2013+
    
            {
    
                foreach( $typeName in $typeNames )
    
                {
    
                    # System, Version=4.0.0.0
    
                    $netFrameworkConfig = New-Object Microsoft.SharePoint.Administration.SPWebConfigModification
    
                    $netFrameworkConfig.Path     = "configuration/System.Workflow.ComponentModel.WorkflowCompiler/authorizedTypes/targetFx"
    
                    $netFrameworkConfig.Name     = "authorizedType[@Assembly='System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'][@Namespace='System.CodeDom'][@TypeName='{0}'][@Authorized='True']" -f $typeName
    
                    $netFrameworkConfig.Owner    = "NetFrameworkAuthorizedTypeUpdate"
    
                    $netFrameworkConfig.Sequence = 0
    
                    $netFrameworkConfig.Type     = [Microsoft.SharePoint.Administration.SPWebConfigModification+SPWebConfigModificationType]::EnsureChildNode
    
                    $netFrameworkConfig.Value    = '<authorizedType Assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System.CodeDom" TypeName="{0}" Authorized="True"/>' -f $typeName
    
                
    
                    $contentService.WebConfigModifications.Add($netFrameworkConfig);
    
                }
    
            }
    
            Write-Verbose "Updating web.configs"
    
            $contentService.Update()
    
            $contentService.ApplyWebConfigModifications();
    
        }
    
        end
    
        {
    
        }    
    
    }
    
    function Remove-CodeDomAuthorizedType
    
    {
    
        <#
    
        .Synopsis
    
           Removes any web configuration entires owned by "NetFrameworkAuthorizedTypeUpdate"
    
     
    
        .DESCRIPTION
    
           Removes any web configuration entires owned by "NetFrameworkAuthorizedTypeUpdate"
    
     
    
        .EXAMPLE
    
            Remove-CodeDomAuthorizedType
    
        #>
    
        [CmdletBinding()]
    
        param()
    
        begin
    
        {
    
            $contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
    
        }
    
        process
    
        {
    
            $webConfigModifications = @($contentService.WebConfigModifications | ? { $_.Owner -eq "NetFrameworkAuthorizedTypeUpdate" })
    
            foreach ( $webConfigModification in $webConfigModifications ) 
    
            {
    
                Write-Verbose "Found instance owned by NetFrameworkAuthorizedTypeUpdate"
    
                $contentService.WebConfigModifications.Remove( $webConfigModification ) | Out-Null
    
            }
    
            
    
            if( $webConfigModifications.Count -gt 0 )
    
            {
    
                $contentService.Update()
    
                $contentService.ApplyWebConfigModifications()
    
            }
    
        }
    
        end
    
        {
    
        }    
    
    }
    
    # will get the timerjob responsible for the web.config change deployment
    
    # Get-SPTimerJob | ? { $_.Name -eq "job-webconfig-modification" }
    
     
    
    # The command below will make the appropriate changes
    
    Add-CodeDomAuthorizedType
    
    # remove # below if you need to remove the web.config updates, you can with this function to retract the changes
    
    # Remove-CodeDomAuthorizedType 
    
    Thanks & Regards,


    sharath aluri

    Tuesday, September 10, 2019 4:15 PM
  • Just copy entire script from below and paste it in a .txt file and save it and then rename the file .ps1 and then open the file in PowerShell ISE and then just run it.

    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue | Out-Null
    
    function Add-CodeDomAuthorizedType
    
    {
        [CmdletBinding()]
    
        param
    
        (
    
        )
    
        begin
    
        {
    
            $farmMajorVersion = (Get-SPFarm -Verbose:$false ).BuildVersion.Major
    
            $contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
    
            $typeNames = @( "CodeBinaryOperatorExpression", "CodePrimitiveExpression", "CodeMethodInvokeExpression", "CodeMethodReferenceExpression", "CodeFieldReferenceExpression","CodeThisReferenceExpression", "CodePropertyReferenceExpression")
    
        
    
        }
    
        process
    
        {
    
            if( @($contentService.WebConfigModifications | ? { $_.Name -eq "NetFrameworkAuthorizedTypeUpdate" }).Count -gt 0 )
    
            {
    
                Write-Warning "Existing NetFrameworkAuthorizedTypeUpdate entries found, this script only need to be run once per farm."
    
                return
    
            }
    
            if( $farmMajorVersion -le 14 ) # 2010, 2007
    
            {
    
                foreach( $typeName in $typeNames )
    
                {
    
                    # System, Version=2.0.0.0
    
                    $netFrameworkConfig = New-Object Microsoft.SharePoint.Administration.SPWebConfigModification
    
                    $netFrameworkConfig.Path     = "configuration/System.Workflow.ComponentModel.WorkflowCompiler/authorizedTypes"
    
                    $netFrameworkConfig.Name     = "authorizedType[@Assembly='System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'][@Namespace='System.CodeDom'][@TypeName='{0}'][@Authorized='True']" -f $typeName
    
                    $netFrameworkConfig.Owner    = "NetFrameworkAuthorizedTypeUpdate"
    
                    $netFrameworkConfig.Sequence = 0
    
                    $netFrameworkConfig.Type     = [Microsoft.SharePoint.Administration.SPWebConfigModification+SPWebConfigModificationType]::EnsureChildNode
    
                    $netFrameworkConfig.Value    = '<authorizedType Assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System.CodeDom" TypeName="{0}" Authorized="True"/>' -f $typeName
    
                
    
                    $contentService.WebConfigModifications.Add($netFrameworkConfig);
    
                }
    
            }
    
            else # 2013+
    
            {
    
                foreach( $typeName in $typeNames )
    
                {
    
                    # System, Version=4.0.0.0
    
                    $netFrameworkConfig = New-Object Microsoft.SharePoint.Administration.SPWebConfigModification
    
                    $netFrameworkConfig.Path     = "configuration/System.Workflow.ComponentModel.WorkflowCompiler/authorizedTypes/targetFx"
    
                    $netFrameworkConfig.Name     = "authorizedType[@Assembly='System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'][@Namespace='System.CodeDom'][@TypeName='{0}'][@Authorized='True']" -f $typeName
    
                    $netFrameworkConfig.Owner    = "NetFrameworkAuthorizedTypeUpdate"
    
                    $netFrameworkConfig.Sequence = 0
    
                    $netFrameworkConfig.Type     = [Microsoft.SharePoint.Administration.SPWebConfigModification+SPWebConfigModificationType]::EnsureChildNode
    
                    $netFrameworkConfig.Value    = '<authorizedType Assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System.CodeDom" TypeName="{0}" Authorized="True"/>' -f $typeName
    
                
    
                    $contentService.WebConfigModifications.Add($netFrameworkConfig);
    
                }
    
            }
    
            Write-Verbose "Updating web.configs"
    
            $contentService.Update()
    
            $contentService.ApplyWebConfigModifications();
    
        }
    
        end
    
        {
    
        }    
    
    }
    
    function Remove-CodeDomAuthorizedType
    
    {
    
        [CmdletBinding()]
    
        param()
    
        begin
    
        {
    
            $contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
    
        }
    
        process
    
        {
    
            $webConfigModifications = @($contentService.WebConfigModifications | ? { $_.Owner -eq "NetFrameworkAuthorizedTypeUpdate" })
    
            foreach ( $webConfigModification in $webConfigModifications ) 
    
            {
    
                Write-Verbose "Found instance owned by NetFrameworkAuthorizedTypeUpdate"
    
                $contentService.WebConfigModifications.Remove( $webConfigModification ) | Out-Null
    
            }
    
            
    
            if( $webConfigModifications.Count -gt 0 )
    
            {
    
                $contentService.Update()
    
                $contentService.ApplyWebConfigModifications()
    
            }
    
        }
    
        end
    
        {
    
        }    
    
    } 
    
    Add-CodeDomAuthorizedType
    
    Thanks & Regards,


    sharath aluri

    Tuesday, September 10, 2019 7:35 PM
  • Hi,

    Please check ULS logs when you try to publish the workflow and run into this issue to see if there is any detailed error message for this issue.

    You can clear SharePoint Designer cache and then do an IISRESET to see the result.

    Here are your references.

    How to Clear Your SharePoint Designer 2010/2013 Cache.

    https://social.technet.microsoft.com/wiki/contents/articles/33469.how-to-clear-your-sharepoint-designer-20102013-cache.aspx

    SharePoint Designer 2010 Errors were found when compiling the workflow. The workflow files were saved but cannot be run. Unexpected error on server associating the workflow.

    https://support.microsoft.com/en-ae/help/2557533/sharepoint-designer-2010-errors-were-found-when-compiling-the-workflow

    Best regards,

    Chelsea Wu


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Wednesday, September 11, 2019 7:24 AM

All replies

  • Hi Mike.

    Did you check the ULS logs for any detailed information about this error?
    Did you try to export the workflow to Visio and then import again and publish it?
    What about the permission of the account you're using to publish the workflows? Are they the same against all the site collections?

    Bye.


    Luigi Bruno
    MCP, MOS, MTA, MCTS, MCSA, MCSE

    Tuesday, September 10, 2019 3:01 PM
  • Is it for all the workflows or just for 2010 workflows ?

    Thanks & Regards,


    sharath aluri

    Tuesday, September 10, 2019 3:04 PM
  • I'm working on SharePoint 2010, so it's for SharePoint 2010 workflows

    SharePoint Engineer - Mike

    Tuesday, September 10, 2019 4:00 PM
  • Try running the below script which provided by Microsoft.

    <#
    
     This script will add the entries to all web.config files for all web applications in the farm.
    
     Run this script as Farm Administrator in one of the WFEs.
    
     This script only needs to run one time.
    
    SUMMARY: 
    
    This script leverages the native SharePoint SPWebConfigModification API to deploy new updates to the web.config file for each web application on each server in the farm.  Servers added a later date will also get the updates applied because the API configuration is persisted in the config database.  This API does not update the web.config for the central administration web application. 
    
    If you are running workflows on the central admin web application, you will need to manually update the web.config using the steps in the referenced blog.
    
    ==============================================================
    
    #>
    
    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue | Out-Null
    
    function Add-CodeDomAuthorizedType
    
    {
    
        <#
    
        .Synopsis
    
           Adds the necessary authorizedType elements to all web.config files for all non-central admin web applications 
    
     
    
        .DESCRIPTION
    
           Adds the necessary authorizedType elements to all web.config files for all non-central admin web applications 
    
     
    
        .EXAMPLE
    
           Add-CodeDomAuthorizedType
    
     
    
        #>
    
        [CmdletBinding()]
    
        param
    
        (
    
        )
    
        begin
    
        {
    
            $farmMajorVersion = (Get-SPFarm -Verbose:$false ).BuildVersion.Major
    
            $contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
    
            $typeNames = @( "CodeBinaryOperatorExpression", "CodePrimitiveExpression", "CodeMethodInvokeExpression", "CodeMethodReferenceExpression", "CodeFieldReferenceExpression","CodeThisReferenceExpression", "CodePropertyReferenceExpression")
    
        
    
        }
    
        process
    
        {
    
            if( @($contentService.WebConfigModifications | ? { $_.Name -eq "NetFrameworkAuthorizedTypeUpdate" }).Count -gt 0 )
    
            {
    
                Write-Warning "Existing NetFrameworkAuthorizedTypeUpdate entries found, this script only need to be run once per farm."
    
                return
    
            }
    
            if( $farmMajorVersion -le 14 ) # 2010, 2007
    
            {
    
                foreach( $typeName in $typeNames )
    
                {
    
                    # System, Version=2.0.0.0
    
                    $netFrameworkConfig = New-Object Microsoft.SharePoint.Administration.SPWebConfigModification
    
                    $netFrameworkConfig.Path     = "configuration/System.Workflow.ComponentModel.WorkflowCompiler/authorizedTypes"
    
                    $netFrameworkConfig.Name     = "authorizedType[@Assembly='System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'][@Namespace='System.CodeDom'][@TypeName='{0}'][@Authorized='True']" -f $typeName
    
                    $netFrameworkConfig.Owner    = "NetFrameworkAuthorizedTypeUpdate"
    
                    $netFrameworkConfig.Sequence = 0
    
                    $netFrameworkConfig.Type     = [Microsoft.SharePoint.Administration.SPWebConfigModification+SPWebConfigModificationType]::EnsureChildNode
    
                    $netFrameworkConfig.Value    = '<authorizedType Assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System.CodeDom" TypeName="{0}" Authorized="True"/>' -f $typeName
    
                
    
                    $contentService.WebConfigModifications.Add($netFrameworkConfig);
    
                }
    
            }
    
            else # 2013+
    
            {
    
                foreach( $typeName in $typeNames )
    
                {
    
                    # System, Version=4.0.0.0
    
                    $netFrameworkConfig = New-Object Microsoft.SharePoint.Administration.SPWebConfigModification
    
                    $netFrameworkConfig.Path     = "configuration/System.Workflow.ComponentModel.WorkflowCompiler/authorizedTypes/targetFx"
    
                    $netFrameworkConfig.Name     = "authorizedType[@Assembly='System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'][@Namespace='System.CodeDom'][@TypeName='{0}'][@Authorized='True']" -f $typeName
    
                    $netFrameworkConfig.Owner    = "NetFrameworkAuthorizedTypeUpdate"
    
                    $netFrameworkConfig.Sequence = 0
    
                    $netFrameworkConfig.Type     = [Microsoft.SharePoint.Administration.SPWebConfigModification+SPWebConfigModificationType]::EnsureChildNode
    
                    $netFrameworkConfig.Value    = '<authorizedType Assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System.CodeDom" TypeName="{0}" Authorized="True"/>' -f $typeName
    
                
    
                    $contentService.WebConfigModifications.Add($netFrameworkConfig);
    
                }
    
            }
    
            Write-Verbose "Updating web.configs"
    
            $contentService.Update()
    
            $contentService.ApplyWebConfigModifications();
    
        }
    
        end
    
        {
    
        }    
    
    }
    
    function Remove-CodeDomAuthorizedType
    
    {
    
        <#
    
        .Synopsis
    
           Removes any web configuration entires owned by "NetFrameworkAuthorizedTypeUpdate"
    
     
    
        .DESCRIPTION
    
           Removes any web configuration entires owned by "NetFrameworkAuthorizedTypeUpdate"
    
     
    
        .EXAMPLE
    
            Remove-CodeDomAuthorizedType
    
        #>
    
        [CmdletBinding()]
    
        param()
    
        begin
    
        {
    
            $contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
    
        }
    
        process
    
        {
    
            $webConfigModifications = @($contentService.WebConfigModifications | ? { $_.Owner -eq "NetFrameworkAuthorizedTypeUpdate" })
    
            foreach ( $webConfigModification in $webConfigModifications ) 
    
            {
    
                Write-Verbose "Found instance owned by NetFrameworkAuthorizedTypeUpdate"
    
                $contentService.WebConfigModifications.Remove( $webConfigModification ) | Out-Null
    
            }
    
            
    
            if( $webConfigModifications.Count -gt 0 )
    
            {
    
                $contentService.Update()
    
                $contentService.ApplyWebConfigModifications()
    
            }
    
        }
    
        end
    
        {
    
        }    
    
    }
    
    # will get the timerjob responsible for the web.config change deployment
    
    # Get-SPTimerJob | ? { $_.Name -eq "job-webconfig-modification" }
    
     
    
    # The command below will make the appropriate changes
    
    Add-CodeDomAuthorizedType
    
    # remove # below if you need to remove the web.config updates, you can with this function to retract the changes
    
    # Remove-CodeDomAuthorizedType 
    
    Thanks & Regards,


    sharath aluri

    Tuesday, September 10, 2019 4:15 PM
  • Are we sure this script will work and not do any damage to the site?

    SharePoint Engineer - Mike

    Tuesday, September 10, 2019 4:34 PM
  • Nope it won't damage anything. it will add some entries in web.config file and that script was preferred by Microsoft i was not able to find that link but it's won't harm anything. I ran that script couple of times for my clients.

    Thanks & Regards,


    sharath aluri

    Tuesday, September 10, 2019 4:42 PM
  • I assume I don't have to type the comments. Do I run the command in SharePoint 2010 Management Shell with as an Administrator?

    SharePoint Engineer - Mike

    Tuesday, September 10, 2019 4:48 PM
  • No you don't have to copy the comments section to your powershell. Yes open Management Shell and  runs As Administrator.

    Thanks & Regards,


    sharath aluri


    Tuesday, September 10, 2019 4:51 PM
  • That script comes back with tons of errors!

    1. unexpected attribute 'CmdletBinding'.

    2. The term 'param' is not recognized as the name of a cmdlet

    3. expression was expected after '('

    4. The splatting operator '@' cannot be used to reference variables in  an expression.


    SharePoint Engineer - Mike

    Tuesday, September 10, 2019 7:02 PM
  • Just copy entire script from below and paste it in a .txt file and save it and then rename the file .ps1 and then open the file in PowerShell ISE and then just run it.

    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue | Out-Null
    
    function Add-CodeDomAuthorizedType
    
    {
        [CmdletBinding()]
    
        param
    
        (
    
        )
    
        begin
    
        {
    
            $farmMajorVersion = (Get-SPFarm -Verbose:$false ).BuildVersion.Major
    
            $contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
    
            $typeNames = @( "CodeBinaryOperatorExpression", "CodePrimitiveExpression", "CodeMethodInvokeExpression", "CodeMethodReferenceExpression", "CodeFieldReferenceExpression","CodeThisReferenceExpression", "CodePropertyReferenceExpression")
    
        
    
        }
    
        process
    
        {
    
            if( @($contentService.WebConfigModifications | ? { $_.Name -eq "NetFrameworkAuthorizedTypeUpdate" }).Count -gt 0 )
    
            {
    
                Write-Warning "Existing NetFrameworkAuthorizedTypeUpdate entries found, this script only need to be run once per farm."
    
                return
    
            }
    
            if( $farmMajorVersion -le 14 ) # 2010, 2007
    
            {
    
                foreach( $typeName in $typeNames )
    
                {
    
                    # System, Version=2.0.0.0
    
                    $netFrameworkConfig = New-Object Microsoft.SharePoint.Administration.SPWebConfigModification
    
                    $netFrameworkConfig.Path     = "configuration/System.Workflow.ComponentModel.WorkflowCompiler/authorizedTypes"
    
                    $netFrameworkConfig.Name     = "authorizedType[@Assembly='System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'][@Namespace='System.CodeDom'][@TypeName='{0}'][@Authorized='True']" -f $typeName
    
                    $netFrameworkConfig.Owner    = "NetFrameworkAuthorizedTypeUpdate"
    
                    $netFrameworkConfig.Sequence = 0
    
                    $netFrameworkConfig.Type     = [Microsoft.SharePoint.Administration.SPWebConfigModification+SPWebConfigModificationType]::EnsureChildNode
    
                    $netFrameworkConfig.Value    = '<authorizedType Assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System.CodeDom" TypeName="{0}" Authorized="True"/>' -f $typeName
    
                
    
                    $contentService.WebConfigModifications.Add($netFrameworkConfig);
    
                }
    
            }
    
            else # 2013+
    
            {
    
                foreach( $typeName in $typeNames )
    
                {
    
                    # System, Version=4.0.0.0
    
                    $netFrameworkConfig = New-Object Microsoft.SharePoint.Administration.SPWebConfigModification
    
                    $netFrameworkConfig.Path     = "configuration/System.Workflow.ComponentModel.WorkflowCompiler/authorizedTypes/targetFx"
    
                    $netFrameworkConfig.Name     = "authorizedType[@Assembly='System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'][@Namespace='System.CodeDom'][@TypeName='{0}'][@Authorized='True']" -f $typeName
    
                    $netFrameworkConfig.Owner    = "NetFrameworkAuthorizedTypeUpdate"
    
                    $netFrameworkConfig.Sequence = 0
    
                    $netFrameworkConfig.Type     = [Microsoft.SharePoint.Administration.SPWebConfigModification+SPWebConfigModificationType]::EnsureChildNode
    
                    $netFrameworkConfig.Value    = '<authorizedType Assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Namespace="System.CodeDom" TypeName="{0}" Authorized="True"/>' -f $typeName
    
                
    
                    $contentService.WebConfigModifications.Add($netFrameworkConfig);
    
                }
    
            }
    
            Write-Verbose "Updating web.configs"
    
            $contentService.Update()
    
            $contentService.ApplyWebConfigModifications();
    
        }
    
        end
    
        {
    
        }    
    
    }
    
    function Remove-CodeDomAuthorizedType
    
    {
    
        [CmdletBinding()]
    
        param()
    
        begin
    
        {
    
            $contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
    
        }
    
        process
    
        {
    
            $webConfigModifications = @($contentService.WebConfigModifications | ? { $_.Owner -eq "NetFrameworkAuthorizedTypeUpdate" })
    
            foreach ( $webConfigModification in $webConfigModifications ) 
    
            {
    
                Write-Verbose "Found instance owned by NetFrameworkAuthorizedTypeUpdate"
    
                $contentService.WebConfigModifications.Remove( $webConfigModification ) | Out-Null
    
            }
    
            
    
            if( $webConfigModifications.Count -gt 0 )
    
            {
    
                $contentService.Update()
    
                $contentService.ApplyWebConfigModifications()
    
            }
    
        }
    
        end
    
        {
    
        }    
    
    } 
    
    Add-CodeDomAuthorizedType
    
    Thanks & Regards,


    sharath aluri

    Tuesday, September 10, 2019 7:35 PM
  • Hi,

    Please check ULS logs when you try to publish the workflow and run into this issue to see if there is any detailed error message for this issue.

    You can clear SharePoint Designer cache and then do an IISRESET to see the result.

    Here are your references.

    How to Clear Your SharePoint Designer 2010/2013 Cache.

    https://social.technet.microsoft.com/wiki/contents/articles/33469.how-to-clear-your-sharepoint-designer-20102013-cache.aspx

    SharePoint Designer 2010 Errors were found when compiling the workflow. The workflow files were saved but cannot be run. Unexpected error on server associating the workflow.

    https://support.microsoft.com/en-ae/help/2557533/sharepoint-designer-2010-errors-were-found-when-compiling-the-workflow

    Best regards,

    Chelsea Wu


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Wednesday, September 11, 2019 7:24 AM
  • Hi,

    I'm checking how it is going on with this issue.

    Please remember to update this thread if you have any progress.

    Thank you for your understanding.

    Best regards,

    Chelsea Wu


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Monday, September 16, 2019 1:34 AM
  • Thanks,

    I added the 7 lines to the configuration file for the port number hosting the website and it published.

    Mike W


    SharePoint Engineer - Mike

    Tuesday, September 17, 2019 4:25 PM