如何为 System.Core 创建外部别名?
我的项目中绝对需要 System.Core 的外部别名。不幸的是,在 .Net 4.0 项目中,您甚至无法添加对 System.Core 的引用,因为显然构建系统默认包含它。有谁知道如何强制系统让我为该库指定外部别名?谢谢!
I absolutely need an extern alias for System.Core
in my project. Unfortunately, in a .Net 4.0 project, you cannot even add a reference to System.Core
because, apparently, the build system includes it by default. Does anyone have any idea on how I can coerce the system to let me specify an extern alias for this lib? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个问题很老了,但我遇到了同样的问题。据我了解,这是由于 Visual Studio 隐式添加了对 System.Core 的引用。
您可以通过编辑 csproj msbuild 文件并
在末尾添加: 来覆盖此设置。
这将禁用我认为 Visual Studio 已使用 /p[roperty] 开关传递给 MSBuild 的任何
AdditionalExplicitAssemblyReferences
。当然,我们现在仍然需要添加 System.Core 引用,因为它不再被引用。 实现此目的
通过添加到包含引用(或新引用)的
ItemGroup
来。您现在可以使用
System.Core
类型来引用This question is old but I ran into the same problem. As far as I understood, this is due to Visual Studio implicitly adding a reference to System.Core.
You can override this by editing your csproj msbuild file and adding:
at the end.
This disables any
AdditionalExplicitAssemblyReferences
that I assume Visual Studio has passed to MSBuild using the /p[roperty] switch.Of course, we now still have to add the System.Core reference as it is no longer referenced. Do so by adding
to the
ItemGroup
that contains references (or a new one).You can now refer to a
System.Core
type using