2012-02-24 13 views
4

Visual Studio 2010のReportViewer 10.0.0.0をWebアプリケーションに使用していますが、アセンブリに問題があります。 サーバーにはReportViewer 8.0.0.0と9.0.0.0がインストールされていますが、10.0.0.0バージョンのインストールは避けようとしています。VS2010のReportViewerアセンブリの問題

ReportViewer10 dllをインストールしていなくても、サーバー上で使用することができると思っていました。 DLLのBuild ActionプロパティをContentに設定して、それらを出力ビンフォルダにコピーします。プロパティCopy to Output DirectoryDo not copyです。

次のエラーが示すように、私のプロジェクトでは、ReportViewerからGACに1つ、Temporary ASP.NET Filesに2つのアセンブリが見つかりました。検索すると、Temporary ASP.NET Filesがサーバーへのリクエストごとに再生成されることも発見されました。

Temporary ASP.NET FilesからDLLを削除しましたが、アプリケーション全体がGACまたはbinフォルダからではなく、Temporary ASP.NET FilesからのDLLを使用していたことを示しています。私はbinフォルダからdllを使用するように私のアプリケーションを設定したい、またはとします。なぜなら、dllが正しいバージョン(10.0.0.0)であるからです。以下のエラーは、GACのReportViewer9 dllとTemporary ASP.NET FilesのReportViewer10のDLLとの間の競合を示しています。

An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

CS0433: The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both 
'c:\\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\9.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' and 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\project\4ec9147f\d072b522\assembly\dl3\662a86a1\009c93d3_afeccc01\Microsoft.ReportViewer.WebForms.DLL' 

Line 180: 
Line 181: [System.Diagnostics.DebuggerNonUserCodeAttribute()] 
Line 182: private global::Microsoft.Reporting.WebForms.ReportViewer @__BuildControlReportViewer1() { 
Line 183: global::Microsoft.Reporting.WebForms.ReportViewer @__ctrl; 
Line 184: 

Source File: C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\project\4ec9147f\d072b522\App_Web_default.aspx.cdcab7d2.dmkwuxko.0.cs 
Line: 182 

答えて

6

私の問題は、次のようにして解決された:

私は私のプロジェクトによって参照することが、私はbinフォルダからそれらを削除したDLLを残しました。この方法では、DLLの競合を終了、一時ASP.NET Filesフォルダ内で再生成されて停止:

CS0433: The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both 
'c:\\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\9.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' and 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\project\4ec9147f\d072b522\assembly\dl3\662a86a1\009c93d3_afeccc01\Microsoft.ReportViewer.WebForms.DLL' 

レポートビューアは、それが期待されていたか、働いていないまま(GACは唯一のバージョン8とDLLの9を持っていました)。その後、レポートビューア10.0.0.0は、サーバーにインストールされており、この時、新たなエラーが示されていました:

CS0433: The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both 
'c:\\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\9.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' and 'c:\\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\10.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' 

は、私は、この紛争はのDLLの異なるバージョン間で起こったことを奇妙だと思ったし、この時間完了

<runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v2.0.50727"> 
    <dependentAssembly> 
    <assemblyIdentity name="Microsoft.ReportViewer.WebForms" publicKeyToken="b03f5f7f11d50a3a"/> 
    <bindingRedirect oldVersion="9.0.0.0" newVersion="10.0.0.0"/> 
    </dependentAssembly> 
</assemblyBinding> 

:解決策は、web.configファイルに次のタグを追加することでした。これは矛盾なく機能し、レポートをエクスポートすることができました。

私の問題を解決し、私はまだ1つの疑問を持っている、と私は誰かがこの1で私を助け願っていました:

はなぜサーバは、異なるバージョンの中GAC_MSILから2つのDLLの間の葛藤があったのですか?サーバーは、自分のプロジェクトで参照し、Web.configで指定したバージョンのみを検索するべきではありませんか? (10.0.0.0)

machine.configファイルとは関係がありますか?

関連する問題