I am trying to create an instance of StorageFile in my class library...
var localFolder = ApplicationData.Current.LocalFolder;
StorageFile destinationFile = await localFolder.CreateFileAsync(destination, CreationCollisionOption.GenerateUniqueName);
VS11 is not building say: 'await' requires that the type 'Windows.Foundation.IAsyncOperation' have a suitable GetAwaiter method. Are you missing a using directive for 'System'?
obviously I am using .net 4.5 as target and I am referencing Windows Assemblies... not sure why this code work in MetroStyle but does not build in a class library... How can I create an instance of Storagefile in a class library??? at this stage it is not important if the file is created in an async way...
pls let me know your thoughts... Stelio
What worked for me is to "manually" add the TargetPlatformVersion
<PropertyGroup>
<TargetPlatformVersion>8.0</TargetPlatformVersion>
</PropertyGroup>
and in Item group add the following
<ItemGroup>
<Reference Include="System.Runtime.WindowsRuntime" />
<Reference Include="System.Runtime" />
<Reference Include="Windows" />
</ItemGroup>
Then the project should compile normaly.