nuget - Using msbuild /p:OutDir with projects that reference different versions of the same library (PCL) -
Reference: I am creating a solution on AppHarbor, which basically says MSBill in this way () :
msbuild solution.sln / p: Configuration = Release / Property: Outdoor = C: \ Temp
To make the scenario somewhat simpler Say, I have these three projects in my solution.
- A refers to a .NET 4.5 project Newtonsoft.Json (.NET 4.5) < Li> B is a portable class line Reri Nutonsft referenced. Jason (PCL)
- C is a PCL referenced B
The point of construction of C, I have an MSbuild See error:
C: \ Windows \ Microsoft.NET \ Framework 64 \ v4.0.30319 \ Microsoft.Common.targets (1605,5): Warning MSB3268: Primary Reference "B" Can not be solved because this framework assent is "indirect reliance on" MScRillib, version = 4.0.0.0, culture = neutral, public keycon = B 77A5C 561934 E. 9 9 ", which currently exists The target structure can not be resolved. ".NETPortable, version = v4.0, profile = Profile47". To resolve this problem, either remove the reference "B" or retake your application in Framework version, which contains "mscorlib, Version = 4.0.0.0, Culture = Neutral, PublicKeyToken = b77a5c561934e089". [C]
This is what I think that happens:
- B has been created. B did the netvansoft In the context of Jason (PCL), Outdoor
- A has been copied and Newtonsoft has been copied. JSON (.NET 4.5) is referenced by an overdressing the previous PCL version and copied it to the Outdoor. Note that B will still be "Runable", because NuGet package recommends the author to have a more specialized version of the library API compatible (and the name of the same assembly and strong name should be named).
- C has been created, however, when it resolves to close the assembly references, then it is Neutrift. In the context of JSN (.NET 4.5) the B will solve the Newtonsoft.Json (PCL) reference, which in turn booms instead of a retraceable MScReplip for reference mscorlib 4.0 PCL.
I see a way to solve this problem. The manner in which I can not change the solution of the apparatus (so there is no change in the MSBL command line) and should remain in the B and C portable class libraries. A solution can either compel a fixed build order or stop OutDir
at AssemblySearchPaths
when the C was created is. I'm open to suggestions though
Or maybe I'm new to Newtons J.S. Can I install the code in the A
using the PCL version? It is not certain that it will break other libraries, which depend on one and depending on NewtonSoft. Jason in return
I have found a solution (after some excavation) for this problem, please Note that it requires shipped MSBuild with .NET 4.5 or later.
Microsoft added the property, which will add a subdirectory with the project name under OutDir
. To solve the above problem, I set the property right in every PCL project in my solution. Because in my solution plain NET projects have project references to those PCLs, they will also be copied in the Outder during build, while PCL itself is being made "in isolation".
Here's how to set the property based on the example (I'm including this project file instead of Microsoft.).
& lt ;? Xml version = "1.0" encoding = "UTF-8" & gt; & Lt; Project ToolVersion = "4.0" xmlns = "http://schemas.microsoft.com/developer/msbuild/2003" & gt; & Lt; PropertyGroup & gt; & Lt ;! - When building in the apparatus, we need a special special folder, so that assembly references do not conflict with those simple NATT projects. & Gt; & Lt; GenerateProjectSpecificOutputFolder & gt; True & lt; / GenerateProjectSpecificOutputFolder & gt; & Lt; / PropertyGroup & gt; & Lt; Import Project = "$ (MSBuildExtensionsPath32) \ Microsoft \ Portable \ $ (TargetFrameworkVersion) \ Microsoft.Portable.CSharp.targets" /> & Lt; / Project & gt;
Comments
Post a Comment