Hi,
I have a funny problem that suddenly appeared, because I assume there were some changes in the Rhino Extension for Visual Studio that were not there before.
I created a brand new Rhino 8 C# Plugin and checked “Use WPF”. I then simply created a new WPF Window and Visual Studio will not display it.
An interesting addition is that if I don’t go to Build, but add a window first, then it will display it…but the moment I do Build I get this Exception. (If I do Build before creating the Window, I also get the Exception…so Build is the problem)
I checked the .csproj file and realized it looks slightly different than it did until recently. It used to look something like this:
<PropertyGroup>
<TargetFrameworks>net7.0-windows;</TargetFrameworks>
<Version>1.0</Version>
<Title>MyPlugin</Title>
<Description>Description</Description>
<TargetExt>.rhp</TargetExt>
<UseWpf>true</UseWpf>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<PropertyGroup>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
It also did not have this “-windows” in the TargetFrameworks, I had to add it manually. Now, when I created the plug-in and checked the csproj file it looks like this:
<PropertyGroup>
<!-- Select the framework(s) you wish to target.
Rhino 6: net45
Rhino 7: net48
Rhino 8 Windows: net48, net7.0, net7.0-windows, net7.0-windows10.0.22000.0, etc
Rhino 8 Mac: net7.0, net7.0-macos, net7.0-macos12.0, etc
-->
<TargetFrameworks>net7.0-windows;net48</TargetFrameworks>
<EnableDynamicLoading>true</EnableDynamicLoading>
<TargetExt>.rhp</TargetExt>
<NoWarn>NU1701</NoWarn>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
</PropertyGroup>
<PropertyGroup>
<!-- Specifies information for Assembly and Yak -->
<Version>1.0</Version>
<Title>MyPlugin</Title>
<Company>MyPluginAuthors</Company>
<Description>Description of MyPlugin</Description>
</PropertyGroup>
There are some obvious updates…so that we do not have to add that"-windows" manually and do not have to look at those NU701 warning…but I think the problem is also somewhere there…
It should be simple to reproduce…I did this on two separate computers and I got the same result.
Any ideas? Is this related to some new changes? I create new Plugins fairly often and they are always using WPF, but this is the first time this has happened, and it is a pretty large problem.
Exit code: 80008089 apparently has to do something with frameworks… I also tried removing the net48 framework but it was the same. I also tried including WindowsForms AND Wpf, but with the same result
SOLUTION: I did find one solution, but it is a “hack”, so I still wanted to make you aware of the problem. I simply replaced the PropertyGroups in the csproj file, and made it look like it did in the old plugin versions…this did the trick. I guess I could change line by line to pinpoint exactly where the problem might be, but I did not do that yet…
Thanks
Milos