当应用程序引用 Windows.winmd 时无法使用 Windows 应用程序包
Unable to use Windows Application Package when the app references Windows.winmd
我尝试使用创建 Appx 包的新方法,Windows Application Package 项目使用 Visual Studio 2017。主要 (WPF) 项目使用 UWP api 通过引用 Windows.winmd 按照建议 here.
<Reference Include="Windows, Version=255.255.255.255, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\Windows Kits\UnionMetadata.0.16299.0\Windows.winmd</HintPath>
</Reference>
主项目像以前一样编译得很好,但是当我尝试从 Windows 应用程序包项目创建 appx 包时,我收到一条警告和数千个类似的错误,如下所示:
No implementation file was provided for the .winmd file
'[ApplicationOutputDirectory]\Windows.winmd'. To generate registration
information in the app manifest, specify the 'Implementation' metadata
on the .winmd reference item in the project file.
The .winmd file 'Windows.winmd' contains type
'Windows.Storage.IKnownFoldersStatics2'. The use of the Windows
namespace is reserved.
The .winmd file 'Windows.winmd' contains type
'Windows.Storage.NameCollisionOption'. The use of the Windows namespace is reserved.
是否有其他方法可以在 WPF 应用中添加对 UWP 的引用来避免此问题?
确保为此引用将“Copy Local”设置为 false。您只在构建时需要它,不需要将 .winmd 文件打包到 .appx 包中。
我尝试使用创建 Appx 包的新方法,Windows Application Package 项目使用 Visual Studio 2017。主要 (WPF) 项目使用 UWP api 通过引用 Windows.winmd 按照建议 here.
<Reference Include="Windows, Version=255.255.255.255, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\Windows Kits\UnionMetadata.0.16299.0\Windows.winmd</HintPath>
</Reference>
主项目像以前一样编译得很好,但是当我尝试从 Windows 应用程序包项目创建 appx 包时,我收到一条警告和数千个类似的错误,如下所示:
No implementation file was provided for the .winmd file '[ApplicationOutputDirectory]\Windows.winmd'. To generate registration information in the app manifest, specify the 'Implementation' metadata on the .winmd reference item in the project file.
The .winmd file 'Windows.winmd' contains type 'Windows.Storage.IKnownFoldersStatics2'. The use of the Windows namespace is reserved.
The .winmd file 'Windows.winmd' contains type 'Windows.Storage.NameCollisionOption'. The use of the Windows namespace is reserved.
是否有其他方法可以在 WPF 应用中添加对 UWP 的引用来避免此问题?
确保为此引用将“Copy Local”设置为 false。您只在构建时需要它,不需要将 .winmd 文件打包到 .appx 包中。