I have an existing WPF application from which I'd like to make a VisualStudio extension.
Basically, I have a xaml window in which I use the library Extended.Wpf.Toolkit for AvalonDock. This application works perfectly without any issue.
I tried to re-use the same window in my extension project and I got XamlParseException on load
Here is the sample code which fails :
<Window x:Class="Company.VisualStudioExtension.Window2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:xcad="http://schemas.xceed.com/wpf/xaml/avalondock"
Title="Window2" Height="300" Width="300">
<Grid>
<xcad:DockingManager AllowMixedOrientation="True" BorderThickness="1">
<xcad:DockingManager.DocumentHeaderTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Test" />
</StackPanel>
</DataTemplate>
</xcad:DockingManager.DocumentHeaderTemplate>
<xcad:LayoutRoot x:Name="_layoutRoot">
<xcad:LayoutPanel Orientation="Horizontal">
<xcad:LayoutAnchorablePane DockWidth="300">
</xcad:LayoutAnchorablePane>
</xcad:LayoutPanel>
</xcad:LayoutRoot>
</xcad:DockingManager>
</Grid>
The exception is highlighted on the following line :
<xcad:LayoutPanel Orientation="Horizontal">
"The method or operation is not implemented."
EDIT
It seems registering all AvalonDock dll in GAC fixes the issue but obviously, it's not an acceptable solution...
I guess these dll are not properly registered while running as an Extension, I propably need to reference them in a specific way... for now, they are referenced in Extension's csproj + CopyLocal=True
EDIT2
Added source code to reproduce the issue https://github.com/MrLuje/VSPackage_NotWorking
There are 2 projects :
I found an easier solution, 'ProvideBindingPath' this will add your current extension folder to the resolution folders of dlls.
[ProvideBindingPath]
public sealed class MainWindowPackage : Package
{
}
based on solution purposed in: VSIX - Cannot load file or assembly of a referenced dll
The solution of adding to the gac wont work 'as is'...VSIX extensions dont allow register on the gac, maybe a workaround will be run gacutil.