我正在运行Visual Studio 2015。
我有一个实用程序库项目,该项目引用了许多在GAC中注册的第三方程序集。在该项目中,在GAC中注册的所有依赖项都是复制本地设置为false的引用。当我构建该项目时,GAC程序集不会复制到构建目录中。
然后,将“复制本地”设置为true,另一个项目将该实用程序项目作为一个项目引用。然后,在引用项目的构建过程中,该实用程序项目引用的所有GAC程序集均被复制到构建目录中。这些程序集很大,并且确实减慢了构建速度并使构建目录膨胀。
Visual Studio 2013未执行此操作。未复制在GAC中注册的二级参考文献。我还应注意,在Visual Studio 2015中,如果我将实用程序项目引用为文件而不是项目,则也会复制辅助引用。有没有办法阻止它复制辅助依赖项?
这是MSBuild的“详细”输出的一部分,其中包含要复制的辅助引用之一:
4> Dependency "ESRI.ArcGIS.Catalog, Version=10.5.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86".
4> Resolved file path is "C:\Program Files (x86)\ArcGIS\DeveloperKit10.5\DotNet\ESRI.ArcGIS.Catalog.dll".
4> Reference found at search path location "{Registry:Software\Microsoft\.NETFramework,v4.7.2,AssemblyFoldersEx}".
4> For SearchPath "C:\...\bin\Release".
4> Considered "C:\...\bin\Release\ESRI.ArcGIS.Catalog.winmd", but it didn't exist.
4> Considered "C:\...\bin\Release\ESRI.ArcGIS.Catalog.dll", but it didn't exist.
4> Considered "C:\...\bin\Release\ESRI.ArcGIS.Catalog.exe", but it didn't exist.
4> For SearchPath "{TargetFrameworkDirectory}".
4> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\ESRI.ArcGIS.Catalog.winmd", but it didn't exist.
4> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\ESRI.ArcGIS.Catalog.dll", but it didn't exist.
4> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\ESRI.ArcGIS.Catalog.exe", but it didn't exist.
4> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\Facades\ESRI.ArcGIS.Catalog.winmd", but it didn't exist.
4> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\Facades\ESRI.ArcGIS.Catalog.dll", but it didn't exist.
4> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\Facades\ESRI.ArcGIS.Catalog.exe", but it didn't exist.
4> For SearchPath "{Registry:Software\Microsoft\.NETFramework,v4.7.2,AssemblyFoldersEx}".
4> Considered AssemblyFoldersEx locations.
4> Required by "C:\...\bin\Release\ArcBase.dll".
4> Found related file "C:\Program Files (x86)\ArcGIS\DeveloperKit10.5\DotNet\ESRI.ArcGIS.Catalog.xml".
4> The ImageRuntimeVersion for this reference is "v4.0.30319".
我最终确实解决了这个问题。解决方案是将此部分添加到辅助库项目的.csproj文件中:
<Project... >
<PropertyGroup>
<DoNotCopyLocalIfInGac>true</DoNotCopyLocalIfInGac>
</PropertyGroup>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句