How do we access Windows.Storage with either .NET7 or 8 and WPF Core packaged for the store?
As an example, we used to do:
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Information()
.WriteTo.File(Path.Combine(ApplicationData.Current.LocalFolder.Path, "app.log")
.CreateLogger();
However, ApplicationData.Current.LocalFolder.Path is now throwing:
System.TypeInitializationException:
'The type initializer for 'WinRT.ActivationFactory`1' threw an exception.'
Inner Exception:
COMException: ClassFactory cannot supply requested class
Just for info:
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows10.0.22621.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
</PropertyGroup>
It used to work under Windows 10, and can't seem to find any docs on the topic, is anyone aware?
The solution that worked for me after fiddling around, was to install package Microsoft.Windows.Compatibility, together with the SDK.Buildtools.