使用 Microsoft.CodeAnalysis Nuget 包导致 WACK 失败

Using Microsoft.CodeAnalysis Nuget package causes WACK to fail

我计划使用 Desktop Bridge 在 Microsoft Store 中发布我的 WPF 应用程序。应用正在使用 .NET 编译器平台 ("Roslyn")。我的问题是该应用程序当前未通过 2 个 WACK 测试。

失败 1:调试配置。 发现错误:调试配置测试检测到以下错误:

The binary Microsoft.Build.resources.dll is built in debug mode.
The binary Microsoft.Build.resources.dll is built in debug mode.
The binary System.Globalization.Calendars.dll is built in debug mode.
The binary System.Threading.Tasks.Parallel.dll is built in debug mode.
The binary Microsoft.Build.resources.dll is built in debug mode.
The binary System.Xml.XmlDocument.dll is built in debug mode.
The binary System.Diagnostics.FileVersionInfo.dll is built in debug mode.
The binary Microsoft.Build.Utilities.Core.resources.dll is built in debug mode.
The binary System.IO.FileSystem.DriveInfo.dll is built in debug mode.
The binary System.Net.Ping.dll is built in debug mode.
The binary System.ComponentModel.Primitives.dll is built in debug mode.
The binary Microsoft.Build.Utilities.Core.resources.dll is built in debug mode.
The binary Microsoft.Build.Tasks.Core.resources.dll is built in debug mode.
The binary System.Net.NameResolution.dll is built in debug mode.
The binary System.ComponentModel.dll is built in debug mode.
The binary System.Runtime.InteropServices.dll is built in debug mode.
The binary System.Diagnostics.Process.dll is built in debug mode.
The binary System.Collections.Concurrent.dll is built in debug mode.
The binary System.Reflection.Primitives.dll is built in debug mode.
The binary Microsoft.Build.Utilities.Core.resources.dll is built in debug mode.
The binary System.Text.Encoding.dll is built in debug mode.
The binary System.Reflection.dll is built in debug mode.
The binary Microsoft.Build.Tasks.Core.resources.dll is built in debug mode.
The binary System.IO.UnmanagedMemoryStream.dll is built in debug mode.
The binary System.IO.IsolatedStorage.dll is built in debug mode.
The binary System.Net.WebSockets.Client.dll is built in debug mode.
The binary System.Resources.Reader.dll is built in debug mode.
The binary System.Linq.Parallel.dll is built in debug mode.
The binary System.Collections.dll is built in debug mode.
The binary System.Linq.dll is built in debug mode.
The binary Microsoft.Build.Tasks.Core.resources.dll is built in debug mode.
The binary Microsoft.Build.Utilities.Core.resources.dll is built in debug mode.
The binary Microsoft.Build.Tasks.Core.resources.dll is built in debug mode.
The binary System.Diagnostics.Contracts.dll is built in debug mode.
The binary Microsoft.Build.Utilities.Core.resources.dll is built in debug mode.
The binary System.Diagnostics.Tools.dll is built in debug mode.
The binary System.Collections.NonGeneric.dll is built in debug mode.
The binary Microsoft.Build.Utilities.Core.resources.dll is built in debug mode.
The binary System.Linq.Expressions.dll is built in debug mode.
The binary System.Runtime.Handles.dll is built in debug mode.
The binary System.Net.Security.dll is built in debug mode.
The binary System.Threading.Timer.dll is built in debug mode.
The binary System.ComponentModel.EventBasedAsync.dll is built in debug mode.
The binary System.Net.WebHeaderCollection.dll is built in debug mode.
The binary Microsoft.Build.Tasks.Core.resources.dll is built in debug mode.
The binary Microsoft.Build.Utilities.Core.resources.dll is built in debug mode.
The binary System.IO.FileSystem.Watcher.dll is built in debug mode.
The binary Microsoft.Build.resources.dll is built in debug mode.
The binary Microsoft.Build.resources.dll is built in debug mode.
The binary Microsoft.Build.resources.dll is built in debug mode.
The binary Microsoft.Build.Utilities.Core.resources.dll is built in debug mode.
The binary System.Runtime.CompilerServices.VisualC.dll is built in debug mode.
The binary Microsoft.Win32.Primitives.dll is built in debug mode.
The binary Microsoft.Build.Tasks.Core.resources.dll is built in debug mode.
The binary System.Runtime.Extensions.dll is built in debug mode.
The binary System.Text.Encoding.Extensions.dll is built in debug mode.
The binary System.Security.Principal.dll is built in debug mode.
The binary Microsoft.Build.Utilities.Core.resources.dll is built in debug mode.
The binary System.Globalization.dll is built in debug mode.
The binary Microsoft.Build.resources.dll is built in debug mode.
The binary Microsoft.Build.Utilities.Core.resources.dll is built in debug mode.
The binary Microsoft.Build.Utilities.Core.resources.dll is built in debug mode.
The binary Microsoft.Build.resources.dll is built in debug mode.
The binary System.ObjectModel.dll is built in debug mode.
The binary System.Collections.Specialized.dll is built in debug mode.
The binary Microsoft.Build.resources.dll is built in debug mode.
The binary System.IO.Compression.ZipFile.dll is built in debug mode.
The binary System.AppContext.dll is built in debug mode.
The binary System.Diagnostics.TraceSource.dll is built in debug mode.
The binary Microsoft.Build.resources.dll is built in debug mode.
The binary System.Security.Claims.dll is built in debug mode.
The binary System.Console.dll is built in debug mode.
The binary Microsoft.Build.Tasks.Core.resources.dll is built in debug mode.
The binary Microsoft.Build.Tasks.Core.resources.dll is built in debug mode.
The binary System.IO.Pipes.dll is built in debug mode.
The binary Microsoft.Build.resources.dll is built in debug mode.
The binary Microsoft.Build.resources.dll is built in debug mode.
The binary System.Linq.Queryable.dll is built in debug mode.
The binary System.Security.Cryptography.Csp.dll is built in debug mode.
The binary System.Security.Cryptography.Primitives.dll is built in debug mode.
The binary System.IO.dll is built in debug mode.
The binary System.Dynamic.Runtime.dll is built in debug mode.
The binary System.Net.NetworkInformation.dll is built in debug mode.
The binary System.Security.Cryptography.X509Certificates.dll is built in debug mode.
The binary System.Resources.Writer.dll is built in debug mode.
The binary System.Net.Primitives.dll is built in debug mode.
The binary System.Net.Requests.dll is built in debug mode.
The binary System.Runtime.Serialization.Formatters.dll is built in debug mode.
The binary System.Runtime.Numerics.dll is built in debug mode.
The binary Microsoft.Build.Utilities.Core.resources.dll is built in debug mode.
The binary System.Xml.XmlSerializer.dll is built in debug mode.
The binary System.Resources.ResourceManager.dll is built in debug mode.
The binary System.IO.FileSystem.dll is built in debug mode.
The binary System.ComponentModel.TypeConverter.dll is built in debug mode.
The binary Microsoft.Build.Utilities.Core.resources.dll is built in debug mode.
The binary System.Text.RegularExpressions.dll is built in debug mode.
The binary System.Diagnostics.TextWriterTraceListener.dll is built in debug mode.
The binary System.Threading.Thread.dll is built in debug mode.
The binary Microsoft.Build.resources.dll is built in debug mode.
The binary Microsoft.Build.Tasks.Core.resources.dll is built in debug mode.
The binary Microsoft.Build.Tasks.Core.resources.dll is built in debug mode.
The binary Microsoft.Build.Utilities.Core.resources.dll is built in debug mode.
The binary Microsoft.Build.Tasks.Core.resources.dll is built in debug mode.
The binary System.Drawing.Primitives.dll is built in debug mode.
The binary Microsoft.Build.Tasks.Core.resources.dll is built in debug mode.
The binary System.IO.MemoryMappedFiles.dll is built in debug mode.
The binary Microsoft.Build.Tasks.Core.resources.dll is built in debug mode.
The binary System.Threading.dll is built in debug mode.
The binary System.Xml.XDocument.dll is built in debug mode.
The binary System.Net.WebSockets.dll is built in debug mode.
The binary Microsoft.Build.Tasks.Core.resources.dll is built in debug mode.
The binary System.Diagnostics.Debug.dll is built in debug mode.
The binary System.Security.Cryptography.Encoding.dll is built in debug mode.
The binary System.Xml.XPath.dll is built in debug mode.
The binary System.Runtime.Serialization.Json.dll is built in debug mode.
The binary System.Xml.ReaderWriter.dll is built in debug mode.
The binary System.Reflection.Extensions.dll is built in debug mode.
The binary System.Threading.Tasks.dll is built in debug mode.
The binary System.Threading.ThreadPool.dll is built in debug mode.
The binary Microsoft.Build.resources.dll is built in debug mode.
The binary System.IO.FileSystem.Primitives.dll is built in debug mode.
The binary System.Runtime.dll is built in debug mode.

影响(如果未修复):Microsoft Store 不允许应用程序的调试版本。

失败 2:被阻止的可执行文件 发现错误:被阻止的可执行文件测试检测到以下错误:

File CsToDartTranspiler.WPF\Microsoft.Build.dll contains a reference to a "Launch Process" related API kernel32.dll!CreateProcessW
File CsToDartTranspiler.WPF\Microsoft.Build.dll contains a reference to a "Launch Process" related API System.Diagnostics.Process.Start
File CsToDartTranspiler.WPF\Microsoft.Build.Utilities.Core.dll contains a reference to a "Launch Process" related API System.Diagnostics.Process.Start
File CsToDartTranspiler.WPF\Microsoft.Build.Tasks.Core.dll contains a reference to a "Launch Process" related API kernel32.dll!CreateProcessW
File CsToDartTranspiler.WPF\Microsoft.Build.Tasks.Core.dll contains a reference to a "Launch Process" related API System.Diagnostics.Process.Start
File Microsoft.Build.dll contains a blocked executable reference to "Microsoft\MSBuild".
File Microsoft.Build.dll contains a blocked executable reference to "MSBuild".
File Microsoft.Build.dll contains a blocked executable reference to "msbuild.exe".
File Microsoft.Build.dll contains a blocked executable reference to "SOFTWARE\Microsoft\MSBuild".
File Microsoft.Build.Framework.dll contains a blocked executable reference to "MSBuild".
File Microsoft.Build.Tasks.Core.dll contains a blocked executable reference to "cmd.exe".
File Microsoft.Build.Tasks.Core.dll contains a blocked executable reference to "MSBuild".
File Microsoft.Build.Tasks.Core.dll contains a blocked executable reference to "MSBuild.exe".
File Microsoft.Build.Utilities.Core.dll contains a blocked executable reference to "MSBuild".
File Microsoft.Build.Utilities.Core.dll contains a blocked executable reference to "MSBuild.exe".
File Microsoft.Build.Utilities.Core.dll contains a blocked executable reference to "cmd.exe".
File Microsoft.CodeAnalysis.Workspaces.Desktop.dll contains a blocked executable reference to "Msbuild".
File System.Runtime.InteropServices.dll contains a blocked executable reference to "DnX".
File System.Runtime.Serialization.Formatters.dll contains a blocked executable reference to "DnX".
File System.Security.Cryptography.Encoding.dll contains a blocked executable reference to "DnX".
File System.Text.Encoding.Extensions.dll contains a blocked executable reference to "DnX".
File System.Threading.dll contains a blocked executable reference to "DnX".
File System.Xml.XDocument.dll contains a blocked executable reference to "DnX".
File System.Xml.XmlSerializer.dll contains a blocked executable reference to "DnX".
File Microsoft.Build.resources.dll contains a blocked executable reference to "MSBuild".
File Microsoft.Build.resources.dll contains a blocked executable reference to "MSBuild.exe".
File Microsoft.Build.Tasks.Core.resources.dll contains a blocked executable reference to "MSBuild".
File Microsoft.Build.Utilities.Core.resources.dll contains a blocked executable reference to "MSBuild".
File Microsoft.Build.Tasks.Core.resources.dll contains a blocked executable reference to "Reg".

影响(如果未修复):在 Windows 10 S 系统上启动可执行文件受到限制。依赖此功能的应用可能无法在 Windows 10 S 系统上正确 运行。

我不确定应用程序是否会因为 "Fail 2" 而被商店拒绝(我个人对 Windows 10 S 模式不感兴趣)。

我的应用程序中的所有模块都是使用发布配置构建的。这是引用 Microsoft.CodeAnalysis:

的模块的 packages.config
<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Microsoft.CodeAnalysis" version="2.8.2" targetFramework="net461" />
  <package id="Microsoft.CodeAnalysis.Analyzers" version="2.6.1" targetFramework="net461" developmentDependency="true" />
  <package id="Microsoft.CodeAnalysis.Common" version="2.8.2" targetFramework="net461" />
  <package id="Microsoft.CodeAnalysis.CSharp" version="2.8.2" targetFramework="net461" />
  <package id="Microsoft.CodeAnalysis.CSharp.Workspaces" version="2.8.2" targetFramework="net461" />
  <package id="Microsoft.CodeAnalysis.VisualBasic" version="2.8.2" targetFramework="net461" />
  <package id="Microsoft.CodeAnalysis.VisualBasic.Workspaces" version="2.8.2" targetFramework="net461" />
  <package id="Microsoft.CodeAnalysis.Workspaces.Common" version="2.8.2" targetFramework="net461" />
  <package id="System.AppContext" version="4.3.0" targetFramework="net461" />
  <package id="System.Collections" version="4.3.0" targetFramework="net461" />
  <package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net461" />
  <package id="System.Collections.Immutable" version="1.5.0" targetFramework="net461" />
  <package id="System.Composition" version="1.2.0" targetFramework="net461" />
  <package id="System.Composition.AttributedModel" version="1.2.0" targetFramework="net461" />
  <package id="System.Composition.Convention" version="1.2.0" targetFramework="net461" />
  <package id="System.Composition.Hosting" version="1.2.0" targetFramework="net461" />
  <package id="System.Composition.Runtime" version="1.2.0" targetFramework="net461" />
  <package id="System.Composition.TypedParts" version="1.2.0" targetFramework="net461" />
  <package id="System.Console" version="4.3.1" targetFramework="net461" />
  <package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net461" />
  <package id="System.Diagnostics.FileVersionInfo" version="4.3.0" targetFramework="net461" />
  <package id="System.Diagnostics.StackTrace" version="4.3.0" targetFramework="net461" />
  <package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net461" />
  <package id="System.Dynamic.Runtime" version="4.3.0" targetFramework="net461" />
  <package id="System.Globalization" version="4.3.0" targetFramework="net461" />
  <package id="System.IO.Compression" version="4.3.0" targetFramework="net461" />
  <package id="System.IO.FileSystem" version="4.3.0" targetFramework="net461" />
  <package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net461" />
  <package id="System.Linq" version="4.3.0" targetFramework="net461" />
  <package id="System.Linq.Expressions" version="4.3.0" targetFramework="net461" />
  <package id="System.Reflection" version="4.3.0" targetFramework="net461" />
  <package id="System.Reflection.Metadata" version="1.6.0" targetFramework="net461" />
  <package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net461" />
  <package id="System.Runtime" version="4.3.0" targetFramework="net461" />
  <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.0" targetFramework="net461" />
  <package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net461" />
  <package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net461" />
  <package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net461" />
  <package id="System.Security.Cryptography.Algorithms" version="4.3.1" targetFramework="net461" />
  <package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
  <package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
  <package id="System.Security.Cryptography.X509Certificates" version="4.3.2" targetFramework="net461" />
  <package id="System.Text.Encoding" version="4.3.0" targetFramework="net461" />
  <package id="System.Text.Encoding.CodePages" version="4.5.0" targetFramework="net461" />
  <package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net461" />
  <package id="System.Threading" version="4.3.0" targetFramework="net461" />
  <package id="System.Threading.Tasks" version="4.3.0" targetFramework="net461" />
  <package id="System.Threading.Tasks.Parallel" version="4.3.0" targetFramework="net461" />
  <package id="System.Threading.Thread" version="4.3.0" targetFramework="net461" />
  <package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
  <package id="System.Xml.ReaderWriter" version="4.3.1" targetFramework="net461" />
  <package id="System.Xml.XDocument" version="4.3.0" targetFramework="net461" />
  <package id="System.Xml.XmlDocument" version="4.3.0" targetFramework="net461" />
  <package id="System.Xml.XPath" version="4.3.0" targetFramework="net461" />
  <package id="System.Xml.XPath.XDocument" version="4.3.0" targetFramework="net461" />
</packages>

用于重现问题的简单测试应用程序:https://github.com/kinex/roslyn_test

我怎样才能解决这些问题?

Windows 应用认证工具包包含大量测试,可帮助确保您的应用已准备好发布到 Microsoft Store。

Fail 1: Debug configuration. Error Found: The debug configuration test detected the following errors:

根据 Windows Desktop Bridge app tests 调试配置测试 部分,调试配置测试用于测试应用程序以确保它不是调试版本且未链接任何调试框架。要修复它,如果您已经使用 Release 配置构建,请检查您是否安装了正确版本的 .NET Framework。

Fail 2: Blocked executables Error Found: The blocked executables test has detected the following errors:

这属于包完整性测试。对于桌面桥接应用程序,此测试可帮助您在 Windows 10 S 机器上构建更好的桌面桥接应用程序以 运行。对于存档文件使用错误,您可以尝试从存档文件中删除可执行文件,不要使用自解压存档将可执行文件放在磁盘上。对于已阻止的可执行文件警告,如果标记的文件是您的应用程序的一部分,您可以忽略该警告。

详情请查看 Windows Desktop Bridge app tests 文档中每个测试的纠正措施部分。

Fail 1 和Fail 2 都可以忽略,尤其是因为它们源自微软开发的模块。这些测试只是 WACK 中的可选测试,因此即使这些测试失败,您的应用程序也会被 Windows Store 接受。有关详细信息,请参阅 Windows Desktop Bridge app tests

有关报告失败的一些详细信息:

失败 1:由于 Microsoft.CodeAnalysis nuget 包的某些依赖项存在问题,所有二进制文件 *.resources.dll 都包含调试信息(一些讨论关于这个问题 here)。我不知道为什么像 System.Collections.dll 这样的其他(可执行)二进制文件被报告包含调试信息,我认为它是一些与 "feature" 相关的 .NET Framework 版本。但幸运的是,这也可以被忽略。

失败 2:无法修复这些 "issues"。 Microsoft.CodeAnalysis 和相关模块需要做他们需要做的事情。