How to point to another project.json location in .NET Core PCL?

Say you have a .NET Core PCL that should compile for multiple platforms. Since csproj-based projects only support compilation for one platform at a time, you cannot have one in common project.json. So your directory structure is as follows:

LibFoo
|
---- LibFoo.csproj
|
---- Platforms
     |
     ---- net45
     |    |
     |    ---- project.json
     |
     ---- netcore451
          |
          ---- project.json

You also have two MSBuild target platforms: Net45and NetCore451. When creating for, Net45you want to include the project file in Platforms/net45, and for NetCore451(by the way, this is Windows 8.1) you want to include it in NetCore451.

How could you implement this in MSBuild? Here is what I still have:

<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, , ?

.

+2
2

AutoMapper, , , csproj .

+1

, , , MSBuild, :

https://github.com/dotnet/corefx/issues/6169

@Nyegaard csproj.

0

Source: https://habr.com/ru/post/1629082/


All Articles