Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4571470
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:30:31+00:00 2026-05-21T19:30:31+00:00

The following code works, when I do not use .NET 4.0 Framwork ipmo WPK

  • 0

The following code works, when I do not use .NET 4.0 Framwork

ipmo WPK


$ConnectionString = $ConnectionString = "Server=localhost;Integrated Security=True"

$conn = new-object System.Data.SQLClient.SQLConnection
$conn.ConnectionString = $ConnectionString 
$conn.Open() 


function Invoke-sql1
{
    param( [string]$sql,
           [System.Data.SQLClient.SQLConnection]$connection
           )
    $cmd = new-object System.Data.SQLClient.SQLCommand($sql,$connection)
    $ds = New-Object system.Data.DataSet
    $da = New-Object System.Data.SQLClient.SQLDataAdapter($cmd)
    $da.fill($ds) | Out-Null
    return $ds.tables[0]
}


function Show-Bockmarks ($resource) {
    New-Window   {
    New-Grid -ColumnDefinitions @(
            New-ColumnDefinition -Width 900*
        ) -RowDefinitions @(
            New-RowDefinition -Height 30
            New-RowDefinition -Height 600*
        )     {

        New-StackPanel -Orientation horizontal -column 0 -row 0 -Children {
            New-Button -Name Search "Press me" -On_Click {
            $ff_sql = @"
SELECT 'abc' title, getdate() dateAdded , 'xyz' url
UNION
SELECT 'efg' title, getdate() dateAdded , 'xyz' url
"@
            $conn = $resource.conn
            $window.Title = "$($conn.database) Database Browser"
            $TableView = $window | Get-ChildControl TableView
            $TableView.ItemsSource = Invoke-sql1 -sql $ff_sql -connection $conn
             } 
             New-Button -Name Cancel "Close" -On_Click {$window.Close()} 
        }
        New-ListView -Column 0 -Row 1 -Name TableView -View {
           New-GridView -AllowsColumnReorder -Columns {
               New-GridViewColumn "title" 
               New-GridViewColumn "dateAdded" 
               New-GridViewColumn "url" 
           }
        }
    }
    } -asjob -Resource $resource
}

Show-Bockmarks -resource @{conn = $conn}

Press the show me button and the grid fills with 3 rows.

But when I use the .Net 4.0 framework by adding powershell_ise.exe.Config as such

<?xml version="1.0"?>
<configuration>
    <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0.30319" />
        <supportedRuntime version="v2.0.50727" />
    </startup>
</configuration>

I get the following error:

Add-Type : c:\Users\berndk.MMEDVNT\AppData\Local\Temp\eps22jnq.0.cs(24) : The type 'System.Windows.Markup.IQueryAmbient' is defined in an assembly that is not referenced. You must add a
 reference to assembly 'System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

I suppose, that in some cases using WPK with -asJob causes the problem, but I’m not sure.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T19:30:32+00:00Added an answer on May 21, 2026 at 7:30 pm

    Open the Start-WPFJob.ps1 file, and on line 48:

        Add-Type -IgnoreWarnings -ReferencedAssemblies "WindowsBase",
        "PresentationCore", 
        "PresentationFramework" @"
    

    replace with:

        Add-Type -IgnoreWarnings -ReferencedAssemblies "WindowsBase",
        "PresentationCore", 
        "PresentationFramework",
        "System.Xaml" @"
    

    WPK was only designed for .NET 3.5. You might have a few more to fix. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code works great in IE, but not in FF or Safari. I
The following code works for 90+ % of global security groups, but for one
The following attempt works in IE8 but not in Firefox (cannot use JQuery for
Why does the following code not work as I was expecting? <?php $data =
I have the following code, which will not work. The javascript gives no errors
The following html code works in Firefox, but for some reason fails in IE
I have the following code which works just fine when the method is POST,
I have the following code which works fine. However, I only want to return
I was loading an image resource with the following code and it works fine
Given the following code,the hover function works correctly, but when clicked, loses the clicked_no_event_box

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.