查看文件Microsoft.Common.targets
的問題的答案是文件Microsoft.Common.targets
爲你的目標框架版本英寸
對於.NET Framework版本4.0 AssemblySearchPaths元素的定義是這樣的(和4.5!):
<!--
The SearchPaths property is set to find assemblies in the following order:
(1) Files from current project - indicated by {CandidateAssemblyFiles}
(2) $(ReferencePath) - the reference path property, which comes from the .USER file.
(3) The hintpath from the referenced item itself, indicated by {HintPathFromItem}.
(4) The directory of MSBuild's "target" runtime from GetFrameworkPath.
The "target" runtime folder is the folder of the runtime that MSBuild is a part of.
(5) Registered assembly folders, indicated by {Registry:*,*,*}
(6) Legacy registered assembly folders, indicated by {AssemblyFolders}
(7) Resolve to the GAC.
(8) Treat the reference's Include as if it were a real file name.
(9) Look in the application's output folder (like bin\debug)
-->
<AssemblySearchPaths Condition=" '$(AssemblySearchPaths)' == ''">
{CandidateAssemblyFiles};
$(ReferencePath);
{HintPathFromItem};
{TargetFrameworkDirectory};
{Registry:$(FrameworkRegistryBase),$(TargetFrameworkVersion),$(AssemblyFoldersSuffix)$(AssemblyFoldersExConditions)};
{AssemblyFolders};
{GAC};
{RawFileName};
$(OutDir)
</AssemblySearchPaths>
對於.NET Framework 3.5的定義是相同的,但評論是錯誤的。 2.0定義略有不同,它使用$(OutputPath)而不是$(OutDir)。
在我的機器我有文件Microsoft.Common.targets以下版本:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets
C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Microsoft.Common.targets
C:\Windows\Microsoft.NET\Framework64\v3.5\Microsoft.Common.targets
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets
這是一臺安裝在Windows 7
事實的Visual Studio 2008年,2010年和2013年這輸出目錄被搜索可能有點令人沮喪(如原始海報指出),因爲它可能隱藏不正確的HintPath。該解決方案在您的本地計算機上生成「確定」,但在建立在乾淨的文件夾結構(例如生成計算機)上時會中斷。
我有類似的問題,在這種情況下,我應該在哪裏放置dll文件?框架或框架64? https://stackoverflow.com/questions/45945579/where-to-place-the-dll-files-to-resolve-the-reference – 2017-08-30 15:06:14