2017-06-26 8 views
1

私は、これを概念の証明として新鮮なプロジェクトを作成しましたが、動作させることができません。.NET Publisher Policy Assemblyを動作させるのに問題がある

バージョン1.0.0.0の簡単な方法でClassLibrary1.dllを作成しました。 バージョン1.0.0.0でもそのメソッドを呼び出すWindowsFormsApplication1を作成しました。 各ソリューションに関連するセットアッププロジェクトを作成し、MSIをインストールしました。これまでのところすべて良い。

次に、ClassLibrary1のすべてのバージョン番号を1.0.1.0に増やしました。 私は新しいバージョンへリダイレクトするように設定ファイルを作成した:私はにそれを挿入

al /embed:ClassLibrary1.dll.config /out:Policy.1.0.ClassLibrary1.dll /keyfile:TestKey.snk /platform:anycpu /v:1.0.1.0 

:私は、このコマンドでpolicy.1.0.ClassLibrary1.dll発行者ポリシーを作成することを使用

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 

    <dependentAssembly> 
     <assemblyIdentity name="ClassLibrary1" publicKeyToken="99e3abf647b4f724" culture="neutral" /> 
     <bindingRedirect oldVersion="1.0.0.0" newVersion="1.0.1.0"/> 
     </dependentAssembly> 

     </assemblyBinding> 
    </runtime> 
</configuration> 

セットアッププログラムを使用してGAC、およびセットアッププログラムによってDLLがインストールされた後に手動で実行されます。結果は同じです。 GACutil/l policy..0.ClassLibrary1は、GACでポリシーのインスタンスを1つ返しますが、プログラムを実行すると新しいバージョンが使用できなくなります。

C:\Program Files (x86)\Liberty Testing\ClassLibrary1>gacutil /l Policy.1.0.ClassLibrary1 
Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.0 
Copyright (c) Microsoft Corporation. All rights reserved. 

The Global Assembly Cache contains the following assemblies: 
    Policy.1.0.ClassLibrary1, Version=1.0.1.0, Culture=neutral, PublicKeyToken=99e3abf647b4f724, processorArchitecture=MSIL 

Number of items = 1 

けれども、私は手動でCで見ていることに注意します:\ WINDOWS \アセンブリは、ポリシーアセンブリは、どこにでもそのサブツリー内に存在することを示していません。 すべてのライブラリをアンインストールして新しいバージョンを再インストールしましたが、新しいDLLを使用する代わりにプログラムがクラッシュするようになりました。 fuslogvw-を出力は次のようになります。

*** Assembly Binder Log Entry (6/26/2017 @ 2:31:59 PM) *** 

The operation failed. 
Bind result: hr = 0x80070002. The system cannot find the file specified. 

Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll 
Running under executable C:\Program Files (x86)\Liberty Testing\Test Form\WindowsFormsApplication1.exe 
--- A detailed error log follows. 

=== Pre-bind state information === 
LOG: User = DOMAIN\user 
LOG: DisplayName = ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=99e3abf647b4f724 
(Fully-specified) 
LOG: Appbase = file:///C:/Program Files (x86)/Liberty Testing/Test Form/ 
LOG: Initial PrivatePath = NULL 
LOG: Dynamic Base = NULL 
LOG: Cache Base = NULL 
LOG: AppName = NULL 
Calling assembly : WindowsFormsApplication1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. 
=== 
LOG: This bind starts in default load context. 
LOG: No application configuration file found. 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config. 
LOG: Post-policy reference: ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=99e3abf647b4f724 
LOG: The same bind was seen before, and was failed with hr = 0x80070002. 
ERR: Unrecoverable error occurred during pre-download check (hr = 0x80070002). 

それがすべてで発行者ポリシーのために見ているようには見えません。 私たちは何が間違っているのか理解しようと何時間も過ごしました。誰か他のアイデアはありますか?

答えて

2

作業ディレクトリがマップされたドライブ上にあったときにal.exeコマンドを実行していたために問題が発生していました。

ネットワーク共有にVisual Studioプロジェクトフォルダがあり、Visual Studioのコマンドプロンプトでpushdを使用してドライブを自動的にマップするように設定しました。プロセス全体でエラーは発生しませんでしたが、マップドライブのためにポリシー設定がインストールされていませんでした。

フォルダーの1つがローカルにコピーされ、肯定的な結果が得られました。

私たちはプロジェクトフォルダをローカルにしたくないため、代わりにUNCパスを作業ディレクトリとしてネイティブにサポートするpowershellを使用して問題を解決しました。

私はこれをやろうとしている誰かを助けるガイドを作成しました。それはUNCの問題には対処していませんが、多くの人がそうしているようです。

Creating a Publisher Policy Assembly for Custom Libraries

関連する問題