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

Can't add to a project if plain net8.0 support is present #21

Open
PavloLukianets opened this issue Jan 22, 2024 · 6 comments · May be fixed by #22
Open

Can't add to a project if plain net8.0 support is present #21

PavloLukianets opened this issue Jan 22, 2024 · 6 comments · May be fixed by #22

Comments

@PavloLukianets
Copy link

Failing to build if added to such project, because of this:

Screenshot 2024-01-22 at 9 54 29 PM

@PavloLukianets PavloLukianets linked a pull request Jan 23, 2024 that will close this issue
@Redth
Copy link
Owner

Redth commented Feb 15, 2024

I'm going to look at merging this PR, but to be honest I'm conflicted. You shouldn't be trying to reference this type from net8.0 in your project. Can you provide more info about what code you are trying to use that is giving you this error?

@themronion
Copy link

Just added the net8.0 TF to support a test project

@themronion
Copy link

If u can recommend any other way to make a unit test project work with MAUI would be grateful!

@eth-ellis
Copy link

My team are experiencing the same issue due to having a test project in our solution.

That PR would greatly help us.

Currently we are working around by doing the below in our MauiProgram:

public static MauiAppBuilder ConfigureVirtualListView(this MauiAppBuilder mauiAppBuilder)
{
#if IOS || ANDROID
	mauiAppBuilder.UseVirtualListView();
#endif
	return mauiAppBuilder;
}

And to create a custom adapter creating the below classes:

#if NET && !IOS && !ANDROID
namespace Microsoft.Maui.Adapters
{
	public interface IVirtualListViewAdapter
	{
		void InvalidateData();
	}
}
#endif
#if NET && !IOS && !ANDROID
namespace Microsoft.Maui.Adapters
{
	public abstract class VirtualListViewAdapterBase<TSection, TItem>
		where TItem : class
	{
		public abstract TItem GetItem(int sectionIndex, int itemIndex);

		public abstract int GetNumberOfItemsInSection(int sectionIndex);
	}
}
#endif

@eth-ellis
Copy link

And to get the view working we did the below:

namespace MyHealth.Controls
{
	public class VirtualListView : Microsoft.Maui.Controls.VirtualListView
	{

	}
}

#if NET && !IOS && !ANDROID
namespace Microsoft.Maui.Controls
{
	public class VirtualListView : View
	{
                // Fake properties, methods and events
	}
}
#endif

@rmorin04
Copy link

sill an issue with 0.3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants