我的项目中绝对需要一个外部别名System.Core
。不幸的是,在 .Net 4.0 项目中,您甚至无法添加对的引用,System.Core
因为显然构建系统默认包含它。有没有人知道如何强制系统让我为这个库指定一个外部别名?谢谢!
问问题
1139 次
1 回答
4
这个问题很老,但我遇到了同样的问题。据我了解,这是由于 Visual Studio 隐式添加了对 System.Core 的引用。
您可以通过编辑您的 csproj msbuild 文件并添加以下内容来覆盖它:
<PropertyGroup>
<AdditionalExplicitAssemblyReferences/>
</PropertyGroup>
在最后。
这将禁用AdditionalExplicitAssemblyReferences
我认为 Visual Studio 已使用 /p[roperty] 开关传递给 MSBuild 的任何内容。当然,我们现在仍然需要添加 System.Core 引用,因为它不再被引用。通过添加来做到这一点
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
<Aliases>global,ActualSystemCore</Aliases>
</Reference>
到ItemGroup
包含引用(或新引用)的那个。
您现在可以System.Core
使用
ActualSystemCore::System....
于 2011-06-18T15:32:16.293 回答