9

一部のマシンでは、csproj でアセンブリへの参照を追加すると、次のタグが生成されました。

<Reference Include="Microsoft.Expression.Interactions">
  <HintPath>..\Libs.SL\Blend\Microsoft.Expression.Interactions.dll</HintPath>
</Reference>

ただし、一部のマシンでは、バージョン、カルチャ、トークン、およびプロセッサ アーキテクチャを使用して参照が生成されます。

 <Reference Include="Microsoft.Expression.Interactions, Version=5.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\Libs.SL\Blend\Microsoft.Expression.Interactions.dll</HintPath>
</Reference>

どうしてこれなの?

4

3 に答える 3

1

Extracted from msdn:

Processor architecture is added to the assembly identity in the .NET Framework version 2.0, to allow processor-specific versions of assemblies. You can create versions of an assembly whose identity differs only by processor architecture, for example 32-bit and 64-bit processor-specific versions. Processor architecture is not required for strong names. For more information, see AssemblyNameProcessorArchitecture. In this example, the fully qualified name indicates that the myTypes assembly has a strong name with a public key token, has the culture value for US English, and has a version number of 1.0.1234.0. Its processor architecture is "msil", which means that it will be just-in-time (JIT)-compiled to 32-bit code or 64-bit code depending on the operating system and processor.

Code that requests types in an assembly must use a fully qualified assembly name. This is called fully qualified binding. Partial binding, which specifies only an assembly name, is not permitted when referencing assemblies in the .NET Framework.

All assembly references to assemblies that make up the .NET Framework also must contain a fully qualified name of the assembly. For example, to reference the System.Data .NET Framework assembly for version 1.0 would include:

See more in source:

http://msdn.microsoft.com/en-us/library/k8xx4k69.aspx

于 2012-12-04T13:22:23.390 に答える
1

これらの行は、アプリケーションが正しい参照を見つけたり、完全修飾アセンブリ名を作成したりするのに役立ちません。これらの行は、Visual Studio が参照を見つけるのに役立ちます。おそらく、これらの行は、ロードする dll を識別するのに VS に問題があった場合にのみ見つかります。

これは、あなたが期待している答えではないことはわかっています:)しかし、正しい方向に検索するのに役立つことを願っています.

于 2012-12-04T15:53:29.580 に答える
0

I'm not 100% sure, but according to the usual behavior model of .NET Assemblies, in second case you get detailed description (fully qualified name) of the referenced assembly as there are more then one version of the assembly on the machine.

In this way compiler knows which assembly exactly is referenced in your project.

于 2012-12-04T13:22:37.343 に答える