microsoft / XamlBehaviorsWpf

Home for WPF XAML Behaviors on GitHub.
MIT License
852 stars 140 forks source link

Microsoft.VisualStudio.DesignTools.Extensibility not found #142

Closed BMa-BS closed 1 year ago

BMa-BS commented 1 year ago

When using the newest version 1.1.75, I get a compiler error that the depdendency Microsoft.VisualStudio.DesignTools.Extensibility is not found. When reverting back to version 1.1.39 it compiles fine.

mgoertz-msft commented 1 year ago

Thanks, that shouldn't happen. We'll look into it...

mgoertz-msft commented 1 year ago

@BMa-BS It builds and runs just fine for me in a blank .NET 8 WPF app where I added a simple change property behavior:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net8.0-windows</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <UseWPF>true</UseWPF>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.75" />
  </ItemGroup>

</Project>
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp2"
        xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
        x:Class="WpfApp2.MainWindow"
        mc:Ignorable="d"
        Title="MainWindow"
        Height="450"
        Width="800">
    <Grid>
        <Button x:Name="button"
                Content="Button"
                HorizontalAlignment="Left"
                Margin="173,97,0,0"
                VerticalAlignment="Top">
            <b:Interaction.Triggers>
                <b:EventTrigger EventName="Click">
                    <b:ChangePropertyAction PropertyName="Background">
                        <b:ChangePropertyAction.Value>
                            <SolidColorBrush Color="#FFA53434" />
                        </b:ChangePropertyAction.Value>
                    </b:ChangePropertyAction>
                </b:EventTrigger>
            </b:Interaction.Triggers>
        </Button>

    </Grid>
</Window>

What does your project look like?

BMa-BS commented 1 year ago

I am using a legacy style .NET Framework 4.8 Class Library project with Visual Studio 2019.

mgoertz-msft commented 1 year ago

Thanks! That repros for me as well in VS 2022 and I see what the issue is. The new version includes support for the new design tools extensibility model in VS 2022. SDK style projects handle this automatically but legacy framework projects do not. The new design tools assembly needs to be explicitly removed in the nuget install script that's included in the package. Currently, that script only removes the design assembly. We will need to update that script and publish a new package.

Thank you for bringing this to our attention!

LordMartron94 commented 8 months ago

I also have this issue currently.

Occurs with the latest version, it's a blank project created in Jetbrains Rider. image

image

Nothing in the project yet and I can confirm it is this package, because when I remove it, my app builds fine. Regardless, I need this package to work as Caliburn.Micro depends on it.

LordMartron94 commented 8 months ago

I also have this issue currently.

Occurs with the latest version, it's a blank project created in Jetbrains Rider. image

image

Nothing in the project yet and I can confirm it is this package, because when I remove it, my app builds fine. Regardless, I need this package to work as Caliburn.Micro depends on it.

Nevermind, I am dumb. It's been a while since I programmed in C#, I don't know why I chose .NET Framework instead of .NET itself. 🤦‍♂️