Hello.
We are having some trouble consuming the ActiproSoftware.Controls.Wpf.SyntaxEditor NuGet package from a cross-platform .NET 6.0 project. This project uses the text/parsing assemblies rather than the syntax editor itself, and the SyntaxEditor package helpfully includes both net5.0 and net5.0-windows variants, so it seems this should work.
Example project:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ActiproSoftware.Controls.Wpf.SyntaxEditor" Version="22.1.4" />
</ItemGroup>
</Project>
Unfortunately, attempting to build this (dotnet build) gives the error:
error NETSDK1136: The target platform must be set to Windows (usually by including '-windows' in the TargetFramework
property) when using Windows Forms or WPF, or referencing projects or packages that do so. [C:\work\gen2\actipro\exampl
e\example.csproj]
This seems to be down the to the .nuspec file not explicitly specifying a group for "net5.0" in the "frameworkReferences" section. If can make the error go away by hacking the .nuspec file so this section looks like this:
<frameworkReferences>
<group targetFramework="net5.0-windows">
<frameworkReference name="Microsoft.WindowsDesktop.App.WPF" />
</group>
<group targetFramework="net5.0" />
<group targetFramework=".NETCoreApp3.1">
<frameworkReference name="Microsoft.WindowsDesktop.App.WPF" />
</group>
</frameworkReferences>
Having done so, there is a second issue, which is that any code using the APIs is flagged. e.g. adding this code:
using ActiproSoftware.Text.Parsing;
namespace example;
public class Class1
{
public IAstNode Example(IAstNode node) => node.Parent;
}
Produces a warning:
warning CA1416: This call site is reachable on all platforms. 'IAstNode.P
arent' is only supported on: 'windows'. [C:\work\gen2\actipro\example\example.csproj]
This is because the assemblies (ActiproSoftware.Text.LLParser.Wpf.dll and ActiproSoftware.Text.Wpf.dll) both specify SupportedOSPlatform("windows"), when it appears that they don't need to do so. Would it be possible for you to remove this attribute in future releases?
For now we are working around these issues by explicitly referencing the .NET Standard 2.0 assemblies instead of using PackageReferences, but it would be great if we could just consume the package.
Thanks!