Skip to content
This repository has been archived by the owner on Dec 20, 2018. It is now read-only.

Add Support for installing NuGet Packages #19

Open
adam-birds-test opened this issue May 22, 2018 · 4 comments
Open

Add Support for installing NuGet Packages #19

adam-birds-test opened this issue May 22, 2018 · 4 comments

Comments

@adam-birds-test
Copy link

Manage NuGet Packages is greyed out and doesn't let you install them when developing a project in Powershell Pro Tools.

Specifically the one I want to use is the below to add more functionality to WPF.:

https://www.nuget.org/packages/Extended.Wpf.Toolkit/

@adam-birds-test
Copy link
Author

image
This is the error I get when I right click the project and click Manage NuGet Packages.

@adam-birds-test
Copy link
Author

@adamdriscoll any update on this?

@adamdriscoll
Copy link
Member

This requires an update to the NuGet package manager and it's not something I can control with PoshTools. :(

@adam-birds-test
Copy link
Author

In the absence of being able to use nuget or dotnet to install these packages, do you know how to get the extended wpf toolkit working within a project.

I have got the DLL for it, created a reference for it in the project.

I have also added the below to the .xaml file:

xmlns:xctk="clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit"

But when running the project I get the below error:

[ERROR] Exception calling "Load" with "1" argument(s): "Cannot create unknown type '{clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit}DateTimePicker'."
[ERROR] At C:\SCRIPTS\HWT Tools - Github\script-user-creation-tool\User-Creation-Tool\User-Creation-Tool\Forms\MainScreen.xaml.ps1:9 char:2
[ERROR] +     [Windows.Markup.XamlReader]::Load($XamlReader)
[ERROR] +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ERROR]     + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
[ERROR]     + FullyQualifiedErrorId : XamlParseException
[ERROR]  

My .xaml.ps1 file is as below:

Function Load-Xaml {
	[xml]$Xaml = Get-Content -Path $PSScriptRoot\MainScreen.xaml
	$Manager = New-Object System.Xml.XmlNamespaceManager -ArgumentList $Xaml.NameTable
	$Manager.AddNamespace("x", "http://schemas.microsoft.com/winfx/2006/xaml");
	$Manager.AddNamespace("xctk", "clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit");
	$XamlReader = New-Object System.Xml.XmlNodeReader $Xaml
	[Windows.Markup.XamlReader]::Load($XamlReader)
}

$MainScreenWindow = Load-Xaml

I tried adding the $Manager.AddNamespace("xctk", "clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit"); line to solve the issue, but I get the same error. Any ideas how to use these custom wpf namespaces in these projects?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants