Closed GeertvanHorrik closed 5 years ago
1) Upgrade to 2.0.0-preview.7 in global.json 2) Add netcoreapp3.0 to target frameworks (note that you don't have to include the frameworkreference, it will be done by msbuild sdk extras) 3) Make sure to enable this in the project settings:
<PropertyGroup>
<!-- WPF specific -->
<UseWpf>true</UseWpf>
</PropertyGroup>
This works fine for non-xaml related libraries (outputting a netcoreapp3.0 library). Hitting this error:
2>C:\Source\Orc.FilterBuilder\src\Orc.FilterBuilder.Xaml\Orc.FilterBuilder.Xaml.csproj : error NU1105: Unable to find project information for 'C:\Source\Orc.FilterBuilder\src\Orc.FilterBuilder\Orc.FilterBuilder.csproj'. Inside Visual Studio, this may be because the project is unloaded or not part of current solution. Otherwise the project file may be invalid or missing targets required for restore.
2>Done building project "Orc.FilterBuilder.Xaml.csproj" -- FAILED.
Do you have a repro? Can you remove the bin\obj directories and make sure to run msbuild /restore to make sure it restores the new bits?
It's a separate branch on the repository (feature/netcore30), but I am updating my sdk's first, could be that. Will try to keep this thread up-to-date while I am investigating.
Keep in mind that for a pure WPF library, you shouldn't need the extras anymore (though it should still work as it delegates to the built-in SDK).
It should also fall back to existing current behavior if the nightly SDK isn't there, but it may not be setting ExtrasEnableWpfProjectSetup
. IOW, if the nightly SDK is there then UseWpf
is all you need. Otherwise, you need at least ExtrasEnableWpfProjectSetup
. That can be fixed/defaulted.
Note: make sure to update the SDK, it was not working for me until I updated to the latest (one before was 1 week old):
Looks like most of it is working, last one left, but still investigating:
2>C:\Source\Orc.FilterBuilder\src\Orc.FilterBuilder.Xaml\Views\EditFilterView.xaml(54,10): error MC3074: The tag 'Interaction.Behaviors' does not exist in XML namespace 'http://schemas.microsoft.com/expression/2010/interactivity'. Line 54 Position 10.
This is because a dependency explicitly specifies it for a target framework, will probably need to reference it manually for now.
@onovotny Question: can you safely use UseWpf on a multi-targeting lib targeting other stuff (xamarin, uap) or should I protect like this:
<!-- .NET 4.6 -->
<PropertyGroup Condition="'$(TargetFramework)' == 'net46'">
<UseWpf>true</UseWpf>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net46'">
<PackageReference Include="Expression.Blend.Sdk.WPF" Version="1.0.1" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
Looks like Orc.FilterBuilder is compiling as .NET Core 3.0 lib with the example app also being a .NET Core 3.0 app :-)
Fantastic work @onovotny , thanks for all the effort you are putting into this library.
I would condition UseWpf
on the TFM's you want as the WindowsDesktop SDK sets default globs which may conflict.
You also don't need to include System.Windows.Forms on .NET 4.6, just set UseWindowsForms
to true as well.
Thanks for the tip, will do that instead. I think that initially came from before I was using the extras.
While converting another project, I was able to build using VS 2017 preview, but not using VS 2017. Trying to install the x86 SDK side-by-side with the X64 one to see if that solves the issue.
C:\Program Files\dotnet\sdk\2.1.500\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 3.0. [C:\Source\catel\src\Catel.Core\Catel.Core.csproj]
Found something in the release notes:
.NET Core Tools for Visual Studio Starting with this release, the .NET Core tools for Visual Studio will now default to using only the latest stable version of a .NET Core SDK that is installed on your machine for GA releases of Visual Studio. For future previews, the tools will use only preview .NET Core SDKs.
Just customized the build scripts to allow the usage of VS 2017 preview, now it's even working on massive projects. Hope this thread will be useful for others walking into the same sort of things.
Currently migrating an existing component on a specific branch, see https://github.com/wildgums/orc.filterbuilder/tree/feature/netcore30
Will post the progress here, it might help iron the last bits out / maybe help others hitting the same bumps.