"...\System.Runtime.WindowsRuntime.dll" in item list "ReferencePath" does not define a value for metadata "CopyLocal". In order to use this metadata, either qualify it by specifying %(ReferencePath.CopyLocal), or ensure that all items in this list define a value for this metadata.
Я не могу создать приложение WinForms после добавления к нему компонента WebView из-за указанной выше ошибки. Я нашел возможные решения, такие как перенос package.config в PackageReference или добавление CopyLocal
в C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets
файл. Ни один из них у меня не работает.
System.Runtime.WindowsRuntime.targets
файл в проекте выглядит так:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Choose>
<When Condition="'$(DoNotReferenceWinRT)' != 'true'">
<!--
ResolveAssemblyReference was attempting to write binding redirects
for these assemblies (even though they are in the unification list).
-->
<PropertyGroup>
<!-- ...include the reference to System.Runtime -->
<DependsOnNETStandard>true</DependsOnNETStandard>
</PropertyGroup>
<ItemGroup>
<ReferencePath Include="$(MSBuildThisFileDirectory)..\..\ref\netstandard2.0\System.Runtime.WindowsRuntime.dll">
<!-- Private = false to make these reference only -->
<Private>false</Private>
<!-- given this package does not have NugetPackage metadata it will not show in solution explorer, making it explicit -->
<Visible>false</Visible>
</ReferencePath>
</ItemGroup>
</When>
</Choose>
<!-- when this package is referenced as a nuget reference the binding redirect is still present, add a target to remove it -->
<Target Name="_RemoveWindowsRuntimeSuggestedRedirect"
BeforeTargets="GenerateBindingRedirects"
DependsOnTargets="ResolveAssemblyReferences"
Condition="'$(DoNotReferenceWinRT)' != 'true'">
<ItemGroup>
<SuggestedBindingRedirects Remove="System.Runtime.WindowsRuntime, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</ItemGroup>
</Target>
</Project>
Я использую последнюю версию Visual Studio 2019 Professional.