I have created a folder called Effects, which should contain all the effects for my project. It has one effect in it with the following attribution:
[assembly: ResolutionGroupName("Effects")]
[assembly: ExportEffect(typeof(SomeProject.iOS.Effects.SliderEffect), "SliderEffect")]
Now I want to add another effect (as separate file), with the same ResolutionGroupName
, but I get
Duplicate 'ResolutionGroupName' attribute
I understand that
Note that this attribute can only be applied once per project.
and
Attribute that identifies a group name, typically a company name or reversed company URL, that provides a scope for effect names.
, but how can you use multiple effects in separate files? All the examples I found are only using one effect ...
Note that this attribute can only be applied once per project.
Yes that's correct, you can use it only once, for the rest of the effects you don't have to declare the ResolutionGroupName. The system will resolve the effects based on Unique effects name.
Below sample code should give a clear idea.
The below code has DummyApp as groupname which can't be changed for different effects and ImageEffects which should be unique to get executed.
[assembly: ResolutionGroupName("DummyApp")]
[assembly: ExportEffect(typeof(ImageEffects), "ImageEffects")]
namespace DummyApp.Droid.Effects
{
public class ImageEffects : PlatformEffect
{
now for the second Effect you can simply declare and register the export effect attribute.
[assembly: ExportEffect(typeof(FocusEffect), "FocusEffect")]
namespace GrowerApp.Droid.Effects
{
public class FocusEffect : PlatformEffect
{
Now the Forms Declaration sample code will be
public class ImageEffects : RoutingEffect
{
public ImageEffects() : base("DummyApp.ImageEffects")
{
}
}
public class FocusEffect : RoutingEffect
{
public FocusEffect() : base("DummyApp.FocusEffect")
{
}
}
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With