使用“优化代码”时缺少汇编错误

时间:2018-12-24 16:54:52

标签: c# visual-studio uwp release

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

已经尝试将其发布在MS论坛上,但是此帖子被标记为垃圾邮件,所以我想我可以在这里进行尝试。

当未选中“优化代码”时,我的应用程序在调试模式下也可以正常工作,而在发布模式下,我的应用程序仍可以正常工作。但是,当禁用优化时,提交到商店之前的检查失败了,我发现一些必须对优化进行检查的解决方案。

这是输出:

  

1> C:\ Program Files(x86)\ Microsoft SDKs \ UWPNuGetPackages \ microsoft.net.native.compiler \ 1.7.3 \ tools \ Microsoft.NetNative.targets(697,5):错误:Interner 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.FixedSizeQueue 1' 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.SnapshottingDictionary 2'未包含在编译中,但已在方法'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(字符串”)将始终由于缺少方法“ 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):error:Method'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.FixedSizeQueue 1' 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.SnapshottingDictionary 2'未包含在编译中,但已在方法'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(字符串”)将始终由于缺少方法“ 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):error:Method'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===========   ===========贝里斯泰伦:0 erfolgreich,0 fehlerhaft,0übersprungen==========

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

哦,我在新计算机上,当然,编译工作是在旧计算机上进行的。

非常感谢您的帮助。

感谢和圣诞快乐,

托马斯

1 个答案:

答案 0 :(得分:0)

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