Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netcoreapp3.0 support #1323

Merged
merged 19 commits into from
Aug 9, 2019
Merged

netcoreapp3.0 support #1323

merged 19 commits into from
Aug 9, 2019

Conversation

jespersh
Copy link
Contributor

@jespersh jespersh commented Jul 16, 2019

The csproj files for the WPF solution are updated to csproj2017 format and (almost) all nuget/paket packages are updated to packages that have (started to) support core 3.0. Buttons are no longer a mess because ShowMeTheXaml works 🎉

Packages that possibly need a replacement in the future because of wrong targeting framework (TF) or package versioning constraint conflicts (VCC):

  • Microsoft.Xaml.Behaviors.Wpf 1.0.1 (TF)
  • ShowMeTheXAML.AvalonEdit 1.0.13-ci65 (VCC)
  • Dragablz (TF)
  • ShowMeTheXAML.MSBuild (TF)
  • RhinoMocks (TF)

There is 1 test that fail:

  • IsMockableWithRhino (Can't find a constructor with matching arguments) Skipped for now

There are 2 tests that makes xunit crash. Something about the MemberData isn't serializable
MaterialDesignThemes.Wpf.Tests: Catastrophic error during deserialization: System.InvalidOperationException: Could not de-serialize type 'Xunit.Sdk.UITheoryTestCase' because it lacks a parameterless constructor.:

  • CanParseLocalizedTimeString
  • DisplayExpectedTest

MahAppsDragablzDemo

Currently runtime fails because baselight and basedark were removed in 2.0 and were instead replaced by a sort of combined light/dark+theme deal generated here: https://github.com/MahApps/MahApps.Metro/blob/69c80f396d2e7057779dce0238081cac179f5c7f/src/MahApps.Metro/Styles/Themes/GeneratorParameters.json

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
-       <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
-       <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Crimson.xaml" />
-       <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
+       <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Crimson.xaml" />
        <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/FlatButton.xaml" />
    </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

MahApps/MahApps.Metro@1d3cf16#diff-a45c69bf811dd66e5acb8d25802982be

dotnet build

I used msbuild in Visual studio I suspect is able to do something dotnet build isn't, since I am getting this error:

path\packages\showmethexaml.msbuild\1.0.13-ci65\build\net45\ShowMeTheXAML.MSBuild.targets(12,5): error MSB4062: The "ShowMeTheXAML.MSBuild.BuildXamlDictionaryTask" task could not be loaded from the assembly path\packages\ShowMeTheXAML.MSBuild\build\net45....\ShowMeTheXAML.MSBuild.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [path\MainDemo.Wpf\MaterialDesignDemo.csproj]

ShowMeTheXaml.MSBuild

I modified MaterialDesignDemo.csproj to have this:

<Import Project="..\packages\ShowMeTheXAML.MSBuild\build\net45\ShowMeTheXAML.MSBuild.targets" Label="Paket" />

It might have been a false positive and the original might have worked

<Import Project="..\packages\ShowMeTheXAML.MSBuild\build\$(__paket__ShowMeTheXAML_MSBuild_targets).targets" Condition="Exists('..\packages\ShowMeTheXAML.MSBuild\build\$(__paket__ShowMeTheXAML_MSBuild_targets).targets')" Label="Paket" />

What I am unsure about and probably wont be able to fix

  • Paket, to me it is a mess, being only used to Nuget that just works :-)
  • How to fix the test cases as Rhino is foreign to me and MemberData should appear to work.
  • What could, if anything, should be done about the two other solutions
  • I changed most version 1.0.* to 1.0.1 for now as csproj2017 doesn't like as this format thinks the input and output should be deterministic. (see https://stackoverflow.com/questions/43019832/auto-versioning-in-visual-studio-2017-net-core for possible future solutions)

Final notes

Used:

@jespersh jespersh marked this pull request as ready for review July 16, 2019 10:01
@jespersh
Copy link
Contributor Author

#1134

@Keboo Keboo requested review from Keboo and ButchersBoy July 16, 2019 16:08
@wdkr
Copy link

wdkr commented Jul 29, 2019

I think for now you'll have to add a step in azure-pipelines.yml to get it to build using .NET Core 3. Try adding this task directly below line 21:

- task: DotNetCoreInstaller@0
  displayName: 'Use .NET Core sdk 3.0.100-preview7-012821'
  inputs:
    version: '3.0.100-preview7-012821'

@wdkr
Copy link

wdkr commented Jul 29, 2019

I forked your repo and used a "dotnet build" task instead of "VSBuild" and got it to build, but ran into the following issue further down the line:

C:\hostedtoolcache\windows\dncs\3.0.100-preview7-012821\x64\sdk\3.0.100-preview7-012821\Sdks\Microsoft.NET.Sdk.WindowsDesktop\targets\Microsoft.WinFX.targets(687,5): error RG1000: Unknown build error, 'An item with the same key has already been added. Key: themes/materialdesigntheme.checkbox.baml' [d:\a\1\s\MaterialDesignThemes.Wpf\MaterialDesignThemes.Wpf.csproj]

The configuration I used (in azure-pipelines.yml):

- task: DotNetCoreCLI@2
  displayName: 'dotnet build'
  inputs:
    projects: '$(solution)'
    arguments: '/p:Configuration=AppVeyor /p:Platform="Any CPU" /p:MDIX_CORE_VERSION=$(mdixVersion).$(Build.BuildID) /p:MDIX_COLORS_VERSION=$(mdixColorsVersion).$(Build.BuildID) /p:MDIX_MAHAPPS_VERSION=$(mdixMahappsVersion).$(Build.BuildID)'

So this replaces the task "VSBuild@1" (line 29).

@jespersh
Copy link
Contributor Author

@wdkr there are some differences I'm trying to resolve between msbuild and dotnet build right now

@wdkr
Copy link

wdkr commented Jul 29, 2019

Seems good now, thanks for your effort! This is the last package preventing me from switching to .NET Core 3, will be happy when this gets merged :)

@jespersh
Copy link
Contributor Author

@wdkr It probably wont get merged until we manage to add configuration that means it can build as framework too. It is a step in the right direction though.
dotnet build's failure on ShowMeTheXAML.MsBuild is being looked at by @Keboo

@jespersh
Copy link
Contributor Author

@wdkr Thanks for the dotnet build yml task

@steven62f
Copy link

Seems good now, thanks for your effort! This is the last package preventing me from switching to .NET Core 3, will be happy when this gets merged :)

Same thing here. This is the last package preventing me from switching to .NET Core 3.

@jespersh
Copy link
Contributor Author

jespersh commented Aug 1, 2019

The next effort is creating a net45+core combined nuget package for everyone to be happy

@wdkr
Copy link

wdkr commented Aug 1, 2019

I'd be happy to test this if needed, we're using this setup at my company as well. I could use our private NuGet feed to consume both the netfw and netcore versions of the package to see if it works as expected.

@jespersh
Copy link
Contributor Author

jespersh commented Aug 6, 2019

Added a combined net45 and netcoreapp3.0 for libraries and nuspec configuration. The main demo app can switch between net472 and netcoreapp3.0 like this:

image

@Keboo
Copy link
Member

Keboo commented Aug 6, 2019

This is great @jespersh! I will try to get this reviewed this week. I would really like to start seeing preview NuGets with this.

@Keboo Keboo added this to the 3.0.0 milestone Aug 9, 2019
@Keboo Keboo added enhancement mdix.colors Item relates to the MaterialDesignColors project mdix.mahapps Item relates to the MaterialDesignThemes.MahApps project labels Aug 9, 2019
@Keboo
Copy link
Member

Keboo commented Aug 9, 2019

Looks like things are working. Thanks for the great work.

@Keboo Keboo merged commit 254ed6b into MaterialDesignInXAML:master Aug 9, 2019
@jamesport079
Copy link

image

Still getting this warning...

@Logikoz
Copy link

Logikoz commented Dec 28, 2019

works on .net core 3.1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement mdix.colors Item relates to the MaterialDesignColors project mdix.mahapps Item relates to the MaterialDesignThemes.MahApps project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants