首页 > 解决方案 > 使用 Microsoft.CodeAnalysis Nuget 包会导致 WACK 失败

问题描述

我计划使用桌面桥在 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 系统上正确运行。

我不确定应用程序是否会因为“失败 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

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

标签: c#roslynroslyn-code-analysisdesktop-bridge

解决方案


Windows 应用认证工具包包含许多有助于确保您的应用已准备好发布到 Microsoft Store 的测试。

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

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

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

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

详细信息请查看Windows 桌面桥应用程序测试文档中每个测试的纠正措施部分。


推荐阅读