如何指向.NET Core PCL中的另一个project.json位置? [英] How to point to a different project.json location in a .NET Core PCL?
问题描述
假设您有一个.NET Core PCL,该PCL应该可以针对多个平台进行编译.由于基于csproj的项目一次仅支持针对一个平台的编译,因此无法共享project.json
.因此,您的目录结构如下所示:
Say you have a .NET Core PCL that's supposed to compile for multiple platforms. Since csproj-based projects only support compiling for one platform at a time, you can't have a shared project.json
. Thus, your directory structure looks like this:
LibFoo
|
---- LibFoo.csproj
|
---- Platforms
|
---- net45
| |
| ---- project.json
|
---- netcore451
|
---- project.json
您还具有两个MSBuild目标平台:Net45
和NetCore451
.为Net45
构建时,要在Platforms/net45
中包含项目文件,而对于NetCore451
(顺便说一下,它是Windows 8.1),要在netcore451
中包含项目文件.
You also have two MSBuild target platforms: Net45
and NetCore451
. When building for Net45
you want to include the project file in Platforms/net45
, and for NetCore451
(which is Windows 8.1, by the way) you want to include the one in netcore451
.
您将如何在MSBuild中实现它?这是我到目前为止的内容:
How would you go about implementing this in MSBuild? Here is what I have so far:
<PropertyGroup>
<ProjectJsonRoot>Platforms\$(Platform.ToLower())</ProjectJsonRoot>
<ProjectJson>$(ProjectJsonRoot)\project.json</ProjectJson>
</PropertyGroup>
<!-- Now $(ProjectJson) is set to the project.json location,
what do I do to 'register' it with the compiler? -->
TL; DR::如果project.json
与csproj文件不在同一位置,如何将其设置为与csproj文件不同的位置?
TL;DR: How would you set the project.json
to a different location from your csproj file, if it isn't in the same location as it?
感谢您的帮助.
推荐答案
如果您查看 AutoMapper存储库,您将看到Jimmy Bogard如何构建代码,其中csproj文件针对较旧"的项目类型.
If you look at the AutoMapper repo you can see how Jimmy Bogard have structured the code, where csproj files are targeting "older" project types.
这篇关于如何指向.NET Core PCL中的另一个project.json位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!