【问题标题】:Missing assembly errors when using "optimize code"使用“优化代码”时缺少汇编错误
【发布时间】:2019-05-23 18:21:11
【问题描述】:

我已经为此苦苦挣扎了两天,在互联网上找不到任何解决方案。

已经尝试在 MS 论坛上发布此帖子,但此帖子被标记为垃圾邮件,所以我想我在这里尝试一下。

当“优化代码”未选中时,我的应用程序在调试模式下运行良好,并且在发布模式下也运行良好。但是在禁用优化时,提交到商店之前的检查失败,我找到了一些必须检查优化的解决方案。

这是输出:

1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5):错误:内部 Compilerfehler 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5):错误:键入“Microsoft.ApplicationInsights.Extensibility .Implementation.IClock' 未包含在编译中,但在类型“Microsoft.ApplicationInsights.Extensibility.Windows.SessionTelemetryModule”中被引用。可能缺少程序集。 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5):错误:键入“Microsoft.ApplicationInsights.Extensibility .Implementation.FixedSizeQueue1' was not included in compilation, but was referenced in type 'Microsoft.ApplicationInsights.Channel.Storage'. There may have been a missing assembly. 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : Method 'UnhandledExceptionTelemetryModule.CreateClient()' will always throw an exception due to the missing method 'TelemetryClient.set_Channel(ITelemetryChannel)'. There may have been a missing assembly. 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : Type 'Microsoft.ApplicationInsights.Extensibility.Implementation.Clock' was not included in compilation, but was referenced in method 'SessionTelemetryModule..ctor()'. There may have been a missing assembly. 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : Method 'SessionTelemetryModule..ctor()' will always throw an exception due to the missing method 'Clock.get_Instance()'. There may have been a missing assembly. 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : Method 'SessionTelemetryModule.GetPreviousSession(string, DateTimeOffset)' will always throw an exception due to the missing method 'IPlatform.GetApplicationSettings()'. There may have been a missing assembly. 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : Method 'SessionTelemetryModule.IsSessionActive(DateTimeOffset)' will always throw an exception due to the missing method 'IClock.get_Time()'. There may have been a missing assembly. 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : Method 'SessionTelemetryModule.SaveSessionState()' will always throw an exception due to the missing method 'IPlatform.GetApplicationSettings()'. There may have been a missing assembly. 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : Method 'SessionTelemetryModule.TrackSessionState()' will always throw an exception due to the missing method 'IClock.get_Time()'. There may have been a missing assembly. 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : Method 'UserContextInitializer.Initialize(ITelemetry)' will always throw an exception due to the missing method 'UserContext.set_AcquisitionDate(Nullable<DateTimeOffset>)'. There may have been a missing assembly. 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : Method 'UserContextInitializer.InitializeUserData()' will always throw an exception due to the missing method 'IPlatform.GetApplicationSettings()'. There may have been a missing assembly. 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : Method 'WindowsAppInitializer.Initalize()' will always throw an exception due to the missing method 'TelemetryConfiguration.get_ContextInitializers()'. There may have been a missing assembly. 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : Type 'Microsoft.ApplicationInsights.Extensibility.Implementation.SnapshottingDictionary2' 未包含在编译中,但在方法 'Storage..ctor(string)' 中被引用。可能缺少程序集。 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): 错误:方法'Storage..ctor( string)' 由于缺少方法 'SnapshottingDictionary..ctor()' 而总是抛出异常。可能缺少程序集。 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5):错误:方法'Storage.Peek() ' 由于缺少方法 'FixedSizeQueue.Contains(string)',总是会抛出异常。可能缺少程序集。 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): 错误:方法'Storage.Delete(StorageTransmission )' 由于缺少方法 'FixedSizeQueue.Enqueue(string)' 将始终抛出异常。可能缺少程序集。 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): 错误:方法'PersistenceTransmitter.SendForDeveloperMode(ITelemetry , string)' 由于缺少方法 'Transmission.SendAsync()' 将始终引发异常。可能缺少程序集。 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): 错误:方法'Sender.Send(StorageTransmission , TimeSpan)' 由于缺少方法 'Transmission.SendAsync()' 将始终引发异常。可能缺少程序集。 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5):错误:键入“Microsoft.ApplicationInsights.Extensibility .IContextInitializer' 未包含在编译中,但在应用程序中被引用。可能缺少程序集。 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5):错误:键入“Microsoft.ApplicationInsights.Extensibility .Implementation.IClock' 未包含在编译中,但在类型“Microsoft.ApplicationInsights.Extensibility.Windows.SessionTelemetryModule”中被引用。可能缺少程序集。 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5):错误:键入“Microsoft.ApplicationInsights.Extensibility .Implementation.FixedSizeQueue1' was not included in compilation, but was referenced in type 'Microsoft.ApplicationInsights.Channel.Storage'. There may have been a missing assembly. 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : Method 'UnhandledExceptionTelemetryModule.CreateClient()' will always throw an exception due to the missing method 'TelemetryClient.set_Channel(ITelemetryChannel)'. There may have been a missing assembly. 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : Type 'Microsoft.ApplicationInsights.Extensibility.Implementation.Clock' was not included in compilation, but was referenced in method 'SessionTelemetryModule..ctor()'. There may have been a missing assembly. 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : Method 'SessionTelemetryModule..ctor()' will always throw an exception due to the missing method 'Clock.get_Instance()'. There may have been a missing assembly. 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : Method 'SessionTelemetryModule.GetPreviousSession(string, DateTimeOffset)' will always throw an exception due to the missing method 'IPlatform.GetApplicationSettings()'. There may have been a missing assembly. 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : Method 'SessionTelemetryModule.IsSessionActive(DateTimeOffset)' will always throw an exception due to the missing method 'IClock.get_Time()'. There may have been a missing assembly. 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : Method 'SessionTelemetryModule.SaveSessionState()' will always throw an exception due to the missing method 'IPlatform.GetApplicationSettings()'. There may have been a missing assembly. 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : Method 'SessionTelemetryModule.TrackSessionState()' will always throw an exception due to the missing method 'IClock.get_Time()'. There may have been a missing assembly. 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : Method 'UserContextInitializer.Initialize(ITelemetry)' will always throw an exception due to the missing method 'UserContext.set_AcquisitionDate(Nullable<DateTimeOffset>)'. There may have been a missing assembly. 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : Method 'UserContextInitializer.InitializeUserData()' will always throw an exception due to the missing method 'IPlatform.GetApplicationSettings()'. There may have been a missing assembly. 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : Method 'WindowsAppInitializer.Initalize()' will always throw an exception due to the missing method 'TelemetryConfiguration.get_ContextInitializers()'. There may have been a missing assembly. 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): error : Type 'Microsoft.ApplicationInsights.Extensibility.Implementation.SnapshottingDictionary2' 未包含在编译中,但在方法 'Storage..ctor(string)' 中被引用。可能缺少程序集。 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): 错误:方法'Storage..ctor( string)' 由于缺少方法 'SnapshottingDictionary..ctor()' 而总是抛出异常。可能缺少程序集。 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5):错误:方法'Storage.Peek() ' 由于缺少方法 'FixedSizeQueue.Contains(string)',总是会抛出异常。可能缺少程序集。 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): 错误:方法'Storage.Delete(StorageTransmission )' 由于缺少方法 'FixedSizeQueue.Enqueue(string)' 将始终抛出异常。可能缺少程序集。 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): 错误:方法'PersistenceTransmitter.SendForDeveloperMode(ITelemetry , string)' 由于缺少方法 'Transmission.SendAsync()' 将始终引发异常。可能缺少程序集。 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): 错误:方法'Sender.Send(StorageTransmission , TimeSpan)' 由于缺少方法 'Transmission.SendAsync()' 将始终引发异常。可能缺少程序集。 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5):错误:键入“Microsoft.ApplicationInsights.Extensibility .IContextInitializer' 未包含在编译中,但在应用程序中被引用。可能缺少程序集。 1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): 错误:ILT0005: 'C:\Program文件 (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\x86\ilc\Tools\nutc_driver.exe @"C:\Users\tstark\source\repos\Christiani-Windows\ Christiani\obj\x86\Release\ilc\intermediate\MDIL\Christiani.rsp"' 返回退出代码 1 ========== Erstellen: 0 erfolgreich, 1 fehlerhaft, 0 aktuell, 0 übersprungen ========== ========== Bereitstellen: 0 erfolgreich, 0 fehlerhaft, 0 übersprungen ==========

Visual Studio 是最新版本,我尝试使用目标版本 1803 和 1809 进行编译。

哦,我在一台新电脑上,当然编译工作在旧电脑上。

非常感谢任何帮助。

谢谢,圣诞快乐,

托马斯

【问题讨论】:

  • 如果新建一个空白UWP项目,能否编译成功?

标签: c# visual-studio uwp release


【解决方案1】:

我找到了解决方案。 感谢 Xavier,您为我指明了正确的方向,并通过一个简单的项目从头开始。 我删除了 ApplicationInsights 引用并更新了通过 nuget 部署的所有其他引用。 我只能猜测,但在将项目转移到我的新计算机时,nuget 引用似乎被破坏了。但仅在使用优化时。 之后项目编译没有错误。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-07-24
    • 1970-01-01
    • 1970-01-01
    • 2016-12-25
    • 2015-04-26
    • 1970-01-01
    • 1970-01-01
    • 2012-04-19
    相关资源
    最近更新 更多