[go: nahoru, domu]

Skip to content

Commit

Permalink
Support multiple Json.Net versions
Browse files Browse the repository at this point in the history
  • Loading branch information
masbicudo committed Jan 25, 2018
1 parent 0cec38b commit b0bdd77
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,4 @@ FluentJsonNet.Tests.*.csproj
/FluentJsonNet.Tests.net45/
/FluentJsonNet.Tests.net40/
/FluentJsonNet/FluentJsonNet.Lib_v*.csproj
/FluentJsonNet.Tests.Lib_*.net45/
4 changes: 2 additions & 2 deletions Fluent-Json.NET-Configuration.sln
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FluentJsonNet.Tests.Lib_v10
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lib_v10", "Lib_v10", "{99DE0A34-6C58-46FE-905F-61B358E03F08}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentJsonNet.Tests.Lib_v9.net45", "FluentJsonNet.Tests.net45\FluentJsonNet.Tests.Lib_v9.net45.csproj", "{F393F64E-4497-4457-B051-27CB281FC4D3}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentJsonNet.Tests.Lib_v9.net45", "FluentJsonNet.Tests.Lib_v9.net45\FluentJsonNet.Tests.Lib_v9.net45.csproj", "{F393F64E-4497-4457-B051-27CB281FC4D3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentJsonNet.Tests.Lib_v10.net45", "FluentJsonNet.Tests.net45\FluentJsonNet.Tests.Lib_v10.net45.csproj", "{206C386B-AC91-4F03-B6CF-DF5F487029A9}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FluentJsonNet.Tests.Lib_v10.net45", "FluentJsonNet.Tests.Lib_v10.net45\FluentJsonNet.Tests.Lib_v10.net45.csproj", "{206C386B-AC91-4F03-B6CF-DF5F487029A9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lib_v9", "Lib_v9", "{55288B6D-BF6D-466B-B8B9-DECF9CC23232}"
EndProject
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard1.0;net40</TargetFrameworks>
<TargetFrameworks>netstandard1.0;netstandard2.0;net40</TargetFrameworks>
</PropertyGroup>

</Project>
4 changes: 2 additions & 2 deletions ProjectGenerator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Program
private static readonly string ProjectName = "FluentJsonNet";
private static readonly string TestProjectName = "FluentJsonNet.Tests";
private static readonly Dictionary<string, JsonNetVersionInfo> JsonNetVersions = new Dictionary<string, JsonNetVersionInfo> {
//{ "8.0.1", "netstandard1.0;netstandard2.0;net45;net40" },
//{ "8.0.1", "" },
{ "9.0.1", new JsonNetVersionInfo
{
//Frameworks = "net20;net35;net40;net45;netstandard1.0;portable-net40+sl5+wp80+win8+wpa81;portable-net45+wp80+win8+wpa81",
Expand Down Expand Up @@ -113,7 +113,7 @@ static void Main(string[] args)
if (target == "net45")
foreach (var file in listIncludes)
{
var targetFileName = Path.Combine(Path.GetFullPath($@"../{TestProjectName}.{target}/"), file);
var targetFileName = Path.Combine(Path.GetFullPath($@"../{TestProjectName}.Lib_v{jsonNetVer.Major}.{target}/"), file);
Directory.CreateDirectory(Path.GetDirectoryName(targetFileName));
File.Copy(
Path.Combine(Path.GetFullPath($@"../{TestProjectName}/"), file),
Expand Down
7 changes: 4 additions & 3 deletions ProjectGenerator/ProjectGenerator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<EnableDefaultCompileItems>False</EnableDefaultCompileItems>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Templates\**" />
<EmbeddedResource Remove="Templates\**" />
<None Remove="Templates\**" />
<Compile Include="**\*.cs" Exclude="obj\**;bin\**" />
<Compile Remove="Templates\**\*.cs" />
<None Include="Templates\**\*" Exclude="obj\**;bin\**" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Implemented as converter and contract resolver.</Description>
0.0.1 - removed JetBrains.Annotations dependency
0.0.0 - initial release
See the project page for more.</PackageReleaseNotes>
<PackageIconUrl>https://raw.githubusercontent.com/masbicudo/Fluent-Json.NET/master/Fluent-Json.NET-Configuration/icon-256.png</PackageIconUrl>
<PackageIconUrl>https://raw.githubusercontent.com/masbicudo/Fluent-Json.NET/master/icon-256.png</PackageIconUrl>
<PackageProjectUrl>https://github.com/masbicudo/Fluent-Json.NET</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/masbicudo/Fluent-Json.NET/blob/master/LICENSE</PackageLicenseUrl>
<RepositoryType>git</RepositoryType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.1.2.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=%DepVerMajor%.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.%DepVer%\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<packages>
<package id="MSTest.TestAdapter" version="1.2.0" targetFramework="net45" />
<package id="MSTest.TestFramework" version="1.2.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="%DepVer%" targetFramework="net45" />
</packages>
9 changes: 7 additions & 2 deletions Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ A problem happens if you load the project
targeting both Lib_v10 and Lib_v9 and try to
build them. Visual Studio gets confused and
load incorrect versions of the Newtonsoft.Json
library from the NuGet.
library from the NuGet. This is related with
this issue: https://github.com/NuGet/Home/issues/4463

Another problem happens if you load more than one
test project from the `Tests.Targeted` folder.
Load only one test project at a time.
Loading all of them will confuse Visual Studio
testing tool.
testing tool. The cause is the same as above,
the issue with multiple projects in one single folder.

To avoid errors when building for multiple versions
of the library, delete the \obj folder between builds.
File renamed without changes

0 comments on commit b0bdd77

Please sign in to comment.