Closed migueBarrera closed 9 months ago
This seems like a good change to make, however there are some things I don't understand about the changes that will be made.
I understood the changes in the video you linked but not this part:
Any alternative?
Now, by default, If you have unit tests and add XCalendar, it adds conditions in the csproj like this:
`
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-ios'"> <PackageReference Include="XCalendar.Maui"> <Version>4.5.3</Version> </PackageReference> </ItemGroup>
@ME-MarvinE . If you see this as a good solution. I can do it myself.
Are you saying the above code snippet is what is added currently or will it be added after the changes?
Also if you don't hide the using of xcalendar in #if Android, it will fail to run the tests.
What do you mean by "Hide the using of XCalendar in #If Android"? I don't see any preprocessor directives in our current csproj files or the csproj file of the repo you linked. And when you say "Using of XCalendar" do you mean the package reference?
I am currently facing this as well and may be able to clarify what @migueBarrera means. With the current version of XCalendar you will need to have the following added to your csproj file:
<ItemGroup>
<PackageReference Include="XCalendar.Core" Version="4.5.5" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
<PackageReference Include="XCalendar.Maui" Version="4.5.3" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
<PackageReference Include="XCalendar.Maui" Version="4.5.3" />
</ItemGroup>
This is necessary because a unit-testable MAUI project like the above would target net8, net8-android and net8-ios. After the change, this whole section would be replaced by just
<ItemGroup>
<PackageReference Include="XCalendar.Maui" Version="4.5.3" />
</ItemGroup>
(Note the change from XCalendar.Core to XCalendar.Maui).
Ah thanks for explaining, definitely something to implement then.
I have a maui project that has unit tests. To have unit tests, the maui project has to support net-8. You can learn more about this here: https://youtu.be/C9vIDLQwc7M?t=169
We have to add to the maui library, the net8 framework. This solution is inspired by how this library does it: https://github.com/hjam40/Camera.MAUI/blob/master/Camera.MAUI/Camera.MAUI.csproj.
Any alternative?
Now, by default, If you have unit tests and add XCalendar, it adds conditions in the csproj like this:
`
`
Also if you don't hide the using of xcalendar in #if Android, it will fail to run the tests.
@ME-MarvinE . If you see this as a good solution. I can do it myself.