2010-08-02 23 views
3

在VS 2008中有沒有一種方法可以指定我想在所生成的xap中包含所有/某些dll的pdb文件?如何將PDB文件包含在Silverlight XAP中?

背景

我們已經編寫了用於多個項目,一些基本的UI控件和功能的Silverlight框架。這些框架dll和pdbs通過svn:externals引入項目到一個lib文件夾中。 Silverlight應用程序通過將Copy Local設置爲True來引用項目lib文件夾中的dll。編譯時,dll包含在xap中,但是pdb不包含。如果我沒有滿足框架DLL的前提條件(即沒有設置控件的ItemSource),則會引發錯誤。我在VS 2008中的異常對話框中都選中了「拋出」和「用戶未處理」的CLR異常。在附加了VS 2008的情況下,我沒有收到錯誤報告。由於標準生成的Application_UnhandledException處理程序在附加調試程序時不會警告未處理的錯誤,並且由於某些原因VS不會在錯誤中斷。如果我手動將pdbs包含在xap中,則VS在正確的行上停止顯示錯誤。

Private Sub Application_UnhandledException(ByVal sender As Object, ByVal e As ApplicationUnhandledExceptionEventArgs) Handles Me.UnhandledException 

     ' If the app is running outside of the debugger then report the exception using 
     ' the browser's exception mechanism. On IE this will display it a yellow alert 
     ' icon in the status bar and Firefox will display a script error. 
     If Not System.Diagnostics.Debugger.IsAttached Then 

      ' NOTE: This will allow the application to continue running after an exception has been thrown 
      ' but not handled. 
      ' For production applications this error handling should be replaced with something that will 
      ' report the error to the website and stop the application. 
      e.Handled = True 
      Deployment.Current.Dispatcher.BeginInvoke(New Action(Of ApplicationUnhandledExceptionEventArgs)(AddressOf ReportErrorToDOM), e) 
     End If 
    End Sub 

回答

1

您應該將PDB文件放在XAP旁邊。如果你喜歡,你可以使用後期製作的動作來做到這一點。

確保您的Web服務器可以爲PDB提供服務,它們在一些默認配置中被鎖定。只需通過瀏覽器請求PDB,看看它是否會下載。如果沒有,請將MIME類型添加到您的服務器以獲取x-application/octet-stream。

+0

這似乎不起作用,至少不是在SL 4 – 2011-04-22 20:24:56

+0

請仔細檢查MIME類型,「適用於我的機器」:-) – 2011-05-03 05:34:22

+0

試過了,沒有運氣 – 2011-05-04 22:52:15

相關問題