【发布时间】:2017-07-26 00:48:57
【问题描述】:
我按照这个 msdn 教程将我的 WPF 转换为 UWP
我在尝试构建应用程序时出现此构建错误。
Severity Code Description Project File Line Suppression State
Error MSB4018 The "GenerateResource" task failed unexpectedly.
System.InvalidOperationException: Item named 'themes/lightbrushes.baml' of
type 'System.IO.UnmanagedMemoryStream' cannot be added to the resource file
because it is not serializable.
at Microsoft.Build.Tasks.ProcessResourceFiles.WriteResources(ReaderInfo
reader, IResourceWriter writer)
at Microsoft.Build.Tasks.ProcessResourceFiles.WriteResources(ReaderInfo
reader, String filename)
at Microsoft.Build.Tasks.ProcessResourceFiles.ProcessFile(String inFile,
String outFileOrDir)
at Microsoft.Build.Tasks.ProcessResourceFiles.Run(TaskLoggingHelper log,
ITaskItem[] assemblyFilesList, List`1 inputs, List`1 satelliteInputs, List`1
outputs, Boolean sourcePath, String language, String namespacename, String
resourcesNamespace, String filename, String classname, Boolean publicClass,
Boolean extractingResWFiles, String resWOutputDirectory)
at Microsoft.Build.Tasks.ProcessResourceFiles.Run(TaskLoggingHelper log,
ITaskItem[] assemblyFilesList, List`1 inputs, List`1 satelliteInputs, List`1
outputs, Boolean sourcePath, String language, String namespacename, String
resourcesNamespace, String filename, String classname, Boolean publicClass,
Boolean extractingResWFiles, String resWOutputDirectory)
at Microsoft.Build.Tasks.GenerateResource.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecution
Host.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.
<ExecuteInstantiatedTask>d__26.MoveNext() Deployment.Bridge C:\Program
Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets 1251
请注意,“themes/lightbrushes.baml”不是应用文件的一部分 非常感谢任何帮助
【问题讨论】:
-
我认为你需要弄清楚“themes/lightbrushes.baml”是什么。如果它不是您的应用文件的一部分,那么它来自哪里?
-
@Scavenger 可能是捆绑在其中一个依赖项中的 wpf 字典资源。我搜索它在任何地方都找不到。
-
但即使它是我依赖的一部分,我们哪里有这个错误?如何解决?
标签: wpf uwp visual-studio-2017 desktop-bridge