Closed trampster closed 3 years ago
Which version of wpf are you using? I believe generators only work on 5.1 of the SDK
How do I change to 5.1 of the SDK?
my project file looks like this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<None Remove="search.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="StrongInject" Version="1.2.0" />
</ItemGroup>
<ItemGroup>
<Resource Include="search.png">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Resource>
</ItemGroup>
</Project>
Do you mean the .Net SDK? because the lastest version of that I can find is 5.0.8. My Visual Studio is upto date.
I found this issue which appears to have a work around https://github.com/dotnet/wpf/issues/3404
Which is to add the following to my project file:
<IncludePackageReferencesDuringMarkupCompilation>true</IncludePackageReferencesDuringMarkupCompilation>
Seems that this will be on by default in .net 6.
This is obviously not the fault of StrongInject so I'm closing this.
It's also on by default in dotnet SDK 5.0.2
I have a .net 5 WPF project that I tried to use StronInject on. But the injection code is not being generated.
My Container is as follows:
However when I build the build fails I get the following errors in my build output (but strangely not in my Errors list)