Redth / ResizetizerNT

Add SVG's and PNG's to your shared Xamarin Project
MIT License
318 stars 31 forks source link

Images not generated for .NET Core 3.1 WPF project #29

Open follesoe opened 4 years ago

follesoe commented 4 years ago

The images are not generated for my .NET Core 3.1 WPF project. I have verified that my app works as expected on Android, iOS, and UWP.

Looking at https://github.com/Redth/ResizetizerNT/blob/master/Resizetizer.NT/Resizetizer.NT.targets#L21 the _ResizetizerIsWPF variable is set using this expression:

<_ResizetizerIsWPF Condition="'$(IsApplication)' == 'True' And '$(NuGetRuntimeIdentifier)' == 'win' And '$(TargetPlatformIdentifier)'=='Windows'">True</_ResizetizerIsWPF>

In my WPF project I added the following target to debug the build:

<Target Name="ResizeTizerDebug" BeforeTargets="Build" Condition="true">
  <Message Text="IsApplication=$(IsApplication), NuGetRuntimeIdentifier=$(NuGetRuntimeIdentifier), TargetPlatformIdentifier=$(TargetPlatformIdentifier), _ResizetizerIsWPF=$(_ResizetizerIsWPF)" Importance="high" />
</Target>

The output of the debug message is as follow:

IsApplication=true, NuGetRuntimeIdentifier=, TargetPlatformIdentifier=Windows, _ResizetizerIsWPF=

So based on the check it looks like the '$(NuGetRuntimeIdentifier)' == 'win' check will not be true, as the $(NuGetRuntimeIdentifier) is not set.

follesoe commented 4 years ago

I was able to work around the issue by setting the _ResizetizerIsWPF property manually in the WPF .csproj file:

<PropertyGroup>
  <_ResizetizerIsWPF>true</_ResizetizerIsWPF>
</PropertyGroup>

But the $(NuGetRuntimeIdentifier) issue is probably something to fix/understand.

Redth commented 4 years ago

Looks like i'll need to find a better way to detect WPF for net core.