diff --git a/Build/Newtonsoft.Json.nuspec b/Build/Newtonsoft.Json.nuspec
new file mode 100644
index 00000000..9509ee02
--- /dev/null
+++ b/Build/Newtonsoft.Json.nuspec
@@ -0,0 +1,12 @@
+
+
+
+ Newtonsoft.Json
+ 3.5.8
+
+ James Newton-King
+
+ Json.NET is a popular high-performance JSON framework for .NET
+ en-US
+
+
\ No newline at end of file
diff --git a/Build/build.ps1 b/Build/build.ps1
index 05f44f75..8b50a9d2 100644
--- a/Build/build.ps1
+++ b/Build/build.ps1
@@ -4,6 +4,7 @@
$signAssemblies = $false
$signKeyPath = "D:\Development\Releases\newtonsoft.snk"
$buildDocumentation = $false
+ $buildNuPackage = $true
$baseDir = resolve-path ..
$buildDir = "$baseDir\Build"
@@ -13,11 +14,11 @@
$releaseDir = "$baseDir\Release"
$workingDir = "$baseDir\Working"
$builds = @(
- @{Name = "Newtonsoft.Json"; TestsName = "Newtonsoft.Json.Tests"; Constants=""; FinalDir="DotNet"; Framework="net-4.0"},
- @{Name = "Newtonsoft.Json.Phone"; TestsName = $null; Constants="SILVERLIGHT;WINDOWS_PHONE"; FinalDir="Phone"; Framework="net-4.0"},
- @{Name = "Newtonsoft.Json.Silverlight"; TestsName = "Newtonsoft.Json.Tests.Silverlight"; Constants="SILVERLIGHT"; FinalDir="Silverlight"; Framework="net-2.0"},
- @{Name = "Newtonsoft.Json.Net20"; TestsName = "Newtonsoft.Json.Tests.Net20"; Constants="NET20"; FinalDir="DotNet20"; Framework="net-2.0"},
- @{Name = "Newtonsoft.Json.Net35"; TestsName = "Newtonsoft.Json.Tests.Net35"; Constants="NET35"; FinalDir="DotNet35"; Framework="net-2.0"}
+ @{Name = "Newtonsoft.Json"; TestsName = "Newtonsoft.Json.Tests"; Constants=""; FinalDir="Net"; NuPackDir = "40"; Framework="net-4.0"},
+ @{Name = "Newtonsoft.Json.WindowsPhone"; TestsName = $null; Constants="SILVERLIGHT;WINDOWS_PHONE"; FinalDir="WindowsPhone"; NuPackDir = "WP"; Framework="net-4.0"},
+ @{Name = "Newtonsoft.Json.Silverlight"; TestsName = "Newtonsoft.Json.Tests.Silverlight"; Constants="SILVERLIGHT"; FinalDir="Silverlight"; NuPackDir = "SL"; Framework="net-2.0"},
+ @{Name = "Newtonsoft.Json.Net35"; TestsName = "Newtonsoft.Json.Tests.Net35"; Constants="NET35"; FinalDir="Net35"; NuPackDir = "35"; Framework="net-2.0"},
+ @{Name = "Newtonsoft.Json.Net20"; TestsName = "Newtonsoft.Json.Tests.Net20"; Constants="NET20"; FinalDir="Net20"; NuPackDir = "20"; Framework="net-2.0"}
)
}
@@ -55,11 +56,11 @@ task Build -depends Clean {
# Merge LinqBridge into .NET 2.0 build
task Merge -depends Build {
- $binaryDir = "$sourceDir\Newtonsoft.Json\bin\Release\DotNet20"
+ $binaryDir = "$sourceDir\Newtonsoft.Json\bin\Release\Net20"
MergeAssembly "$binaryDir\Newtonsoft.Json.Net20.dll" $signKeyPath "$binaryDir\LinqBridge.dll"
del $binaryDir\LinqBridge.dll
- $binaryDir = "$sourceDir\Newtonsoft.Json.Tests\bin\Release\DotNet20"
+ $binaryDir = "$sourceDir\Newtonsoft.Json.Tests\bin\Release\Net20"
MergeAssembly "$binaryDir\Newtonsoft.Json.Tests.Net20.dll" $signKeyPath "$binaryDir\LinqBridge.dll"
MergeAssembly "$binaryDir\Newtonsoft.Json.Net20.dll" $signKeyPath "$binaryDir\LinqBridge.dll"
del $binaryDir\LinqBridge.dll
@@ -77,11 +78,28 @@ task Package -depends Merge {
if ($buildDocumentation)
{
- exec { msbuild "/t:Clean;Rebuild" /p:Configuration=Release "/p:DocumentationSourcePath=$workingDir\Package\Bin\DotNet" $docDir\doc.shfbproj } "Error building documentation. Check that you have Sandcastle, Sandcastle Help File Builder and HTML Help Workshop installed."
+ exec { msbuild "/t:Clean;Rebuild" /p:Configuration=Release "/p:DocumentationSourcePath=$workingDir\Package\Bin\Net" $docDir\doc.shfbproj } "Error building documentation. Check that you have Sandcastle, Sandcastle Help File Builder and HTML Help Workshop installed."
move -Path $workingDir\Documentation\Documentation.chm -Destination $workingDir\Package\Documentation.chm
move -Path $workingDir\Documentation\LastBuild.log -Destination $workingDir\Documentation.log
}
+ if ($buildNuPackage)
+ {
+ New-Item -Path $workingDir\NuPack -ItemType Directory
+ Copy-Item -Path "$buildDir\Newtonsoft.Json.nuspec" -Destination $workingDir\NuPack\Newtonsoft.Json.nuspec -recurse
+
+ foreach ($build in $builds)
+ {
+ $name = $build.TestsName
+ $finalDir = $build.FinalDir
+ $frameworkDir = $build.NuPackDir
+
+ Copy-Item -Path "$sourceDir\Newtonsoft.Json\bin\Release\$finalDir" -Destination $workingDir\NuPack\lib\$frameworkDir -recurse
+ }
+
+ exec { .\Tools\NuPack\NuPack.exe $workingDir\NuPack\Newtonsoft.Json.nuspec }
+ move -Path .\*.nupkg -Destination $workingDir\NuPack
+ }
Copy-Item -Path $docDir\readme.txt -Destination $workingDir\Package\
Copy-Item -Path $docDir\versions.txt -Destination $workingDir\Package\Bin\
diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj
index d32076d4..5d445750 100644
--- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj
+++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj
@@ -47,7 +47,7 @@
true
full
false
- bin\Debug\DotNet20\
+ bin\Debug\Net20\
TRACE;DEBUG;NET20
prompt
4
@@ -56,7 +56,7 @@
pdbonly
true
- bin\Release\DotNet20\
+ bin\Release\Net20\
TRACE
prompt
4
diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net35.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net35.csproj
index 55e858ce..0ec68d93 100644
--- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net35.csproj
+++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net35.csproj
@@ -49,7 +49,7 @@
true
full
false
- bin\Debug\DotNet35\
+ bin\Debug\Net35\
TRACE;DEBUG;NET35
prompt
4
@@ -58,7 +58,7 @@
pdbonly
true
- bin\Release\DotNet35\
+ bin\Release\Net35\
TRACE;NET35
prompt
4
diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Phone.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WindowsPhone.csproj
similarity index 95%
rename from Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Phone.csproj
rename to Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WindowsPhone.csproj
index 034f400d..c0d05f99 100644
--- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Phone.csproj
+++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WindowsPhone.csproj
@@ -9,8 +9,8 @@
{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
Library
Properties
- Newtonsoft.Json.Tests.Phone
- Newtonsoft.Json.Tests.Phone
+ Newtonsoft.Json.Tests.WindowsPhone
+ Newtonsoft.Json.Tests.WindowsPhone
v4.0
$(TargetFrameworkVersion)
WindowsPhone
@@ -23,7 +23,7 @@
true
full
false
- Bin\Debug\Phone\
+ Bin\Debug\WindowsPhone\
DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
true
true
@@ -33,7 +33,7 @@
pdbonly
true
- Bin\Release\Phone\
+ Bin\Release\WindowsPhone\
TRACE;SILVERLIGHT;WINDOWS_PHONE
true
true
@@ -211,9 +211,9 @@
-
+
{7A7F70AB-5C07-47ED-BDD2-ECC14DBACA5E}
- Newtonsoft.Json.Phone
+ Newtonsoft.Json.WindowsPhone
diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj
index 5f00323a..fc75f495 100644
--- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj
+++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj
@@ -49,7 +49,7 @@
true
full
false
- bin\Debug\DotNet\
+ bin\Debug\Net\
DEBUG;TRACE
prompt
4
@@ -58,7 +58,7 @@
pdbonly
true
- bin\Release\DotNet\
+ bin\Release\Net\
TRACE
prompt
4
diff --git a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs
index a49318fe..74d89f5d 100644
--- a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs
+++ b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs
@@ -3665,5 +3665,37 @@ keyword such as type of business.""
IDictionary d = JsonConvert.DeserializeObject>(json);
Assert.AreEqual(123456789876543.21m, d["Value"]);
}
+
+ public struct Vector
+ {
+ public float X;
+ public float Y;
+ public float Z;
+
+ public override string ToString()
+ {
+ return string.Format("({0},{1},{2})", X, Y, Z);
+ }
+ }
+
+ public class VectorParent
+ {
+ public Vector Position;
+ }
+
+ [Test]
+ public void DeserializeStructProperty()
+ {
+ VectorParent obj = new VectorParent();
+ obj.Position = new Vector { X = 1, Y = 2, Z = 3 };
+
+ string str = JsonConvert.SerializeObject(obj);
+
+ obj = JsonConvert.DeserializeObject(str);
+
+ Assert.AreEqual(1, obj.Position.X);
+ Assert.AreEqual(2, obj.Position.Y);
+ Assert.AreEqual(3, obj.Position.Z);
+ }
}
}
\ No newline at end of file
diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.Net20.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.Net20.csproj
index acf353f1..97c213d8 100644
--- a/Src/Newtonsoft.Json/Newtonsoft.Json.Net20.csproj
+++ b/Src/Newtonsoft.Json/Newtonsoft.Json.Net20.csproj
@@ -47,11 +47,11 @@
true
full
false
- bin\Debug\DotNet20\
+ bin\Debug\Net20\
TRACE;DEBUG;NET20
prompt
4
- bin\Debug\DotNet20\Newtonsoft.Json.Net20.xml
+ bin\Debug\Net20\Newtonsoft.Json.Net20.xml
true
@@ -60,11 +60,11 @@
pdbonly
true
- bin\Release\DotNet20\
+ bin\Release\Net20\
TRACE;NET20
prompt
4
- bin\Release\DotNet20\Newtonsoft.Json.Net20.xml
+ bin\Release\Net20\Newtonsoft.Json.Net20.xml
AllRules.ruleset
diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.Net35.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.Net35.csproj
index 7d922ee0..892a927d 100644
--- a/Src/Newtonsoft.Json/Newtonsoft.Json.Net35.csproj
+++ b/Src/Newtonsoft.Json/Newtonsoft.Json.Net35.csproj
@@ -48,11 +48,11 @@
true
full
false
- bin\Debug\DotNet35\
+ bin\Debug\Net35\
TRACE;DEBUG;CODE_ANALYSIS;NET35
prompt
4
- bin\Debug\DotNet35\Newtonsoft.Json.Net35.xml
+ bin\Debug\Net35\Newtonsoft.Json.Net35.xml
true
@@ -61,12 +61,12 @@
pdbonly
true
- bin\Release\DotNet35\
+ bin\Release\Net35\
TRACE;NET35
prompt
4
- bin\Release\DotNet35\Newtonsoft.Json.Net35.xml
- AllRules.ruleset
+ bin\Release\Net35\Newtonsoft.Json.Net35.xml
+ ..\..\..\..\trunk\Src\Newtonsoft.Json\Newtonsoft.Json.ruleset
true
diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.Phone.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.WindowsPhone.csproj
similarity index 95%
rename from Src/Newtonsoft.Json/Newtonsoft.Json.Phone.csproj
rename to Src/Newtonsoft.Json/Newtonsoft.Json.WindowsPhone.csproj
index c6bfcdb0..a686d4ca 100644
--- a/Src/Newtonsoft.Json/Newtonsoft.Json.Phone.csproj
+++ b/Src/Newtonsoft.Json/Newtonsoft.Json.WindowsPhone.csproj
@@ -9,8 +9,8 @@
{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
Library
Properties
- Newtonsoft.Json.Phone
- Newtonsoft.Json.Phone
+ Newtonsoft.Json.WindowsPhone
+ Newtonsoft.Json.WindowsPhone
v4.0
$(TargetFrameworkVersion)
WindowsPhone
@@ -23,7 +23,7 @@
true
full
false
- Bin\Debug\Phone\
+ Bin\Debug\WindowsPhone\
DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE
true
true
@@ -35,13 +35,13 @@
pdbonly
true
- Bin\Release\Phone\
+ Bin\Release\WindowsPhone\
TRACE;SILVERLIGHT;WINDOWS_PHONE
true
true
prompt
4
- Bin\Release\Phone\Newtonsoft.Json.Phone.xml
+ Bin\Release\WindowsPhone\Newtonsoft.Json.WindowsPhone.xml
diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.csproj
index 7c6902d3..a7ca2cbf 100644
--- a/Src/Newtonsoft.Json/Newtonsoft.Json.csproj
+++ b/Src/Newtonsoft.Json/Newtonsoft.Json.csproj
@@ -48,11 +48,11 @@
true
full
false
- bin\Debug\DotNet\
+ bin\Debug\Net\
DEBUG;TRACE
prompt
4
- bin\Debug\DotNet\Newtonsoft.Json.xml
+ bin\Debug\Net\Newtonsoft.Json.xml
true
@@ -61,11 +61,11 @@
pdbonly
true
- bin\Release\DotNet\
+ bin\Release\Net\
TRACE
prompt
4
- bin\Release\DotNet\Newtonsoft.Json.xml
+ bin\Release\Net\Newtonsoft.Json.xml
AllRules.ruleset
diff --git a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs
index 386816fe..8d77d63e 100644
--- a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs
+++ b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs
@@ -26,7 +26,9 @@ using System.Security;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
-#if SILVERLIGHT
+#if WINDOWS_PHONE
+[assembly: AssemblyTitle("Newtonsoft Json.NET Windows Phone")]
+#elif SILVERLIGHT
[assembly: AssemblyTitle("Newtonsoft Json.NET Silverlight")]
#elif PocketPC
[assembly: AssemblyTitle("Newtonsoft Json.NET Compact")]
@@ -44,7 +46,7 @@ using System.Security;
#if !SIGNED
#if WINDOWS_PHONE
-[assembly: InternalsVisibleTo("Newtonsoft.Json.Tests.Phone")]
+[assembly: InternalsVisibleTo("Newtonsoft.Json.Tests.WindowsPhone")]
#elif SILVERLIGHT
[assembly: InternalsVisibleTo("Newtonsoft.Json.Tests.Silverlight")]
#elif PocketPC
diff --git a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs
index 2c60ac4a..ca80b5d8 100644
--- a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs
+++ b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs
@@ -516,7 +516,10 @@ namespace Newtonsoft.Json.Serialization
currentValue = property.ValueProvider.GetValue(target);
gottenCurrentValue = true;
- useExistingValue = (currentValue != null && !property.PropertyType.IsArray && !ReflectionUtils.InheritsGenericDefinition(property.PropertyType, typeof(ReadOnlyCollection<>)));
+ useExistingValue = (currentValue != null
+ && !property.PropertyType.IsArray
+ && !ReflectionUtils.InheritsGenericDefinition(property.PropertyType, typeof(ReadOnlyCollection<>))
+ && !property.PropertyType.IsValueType);
}
if (!property.Writable && !useExistingValue)
diff --git a/Tools/NuPack/NuPack.exe b/Tools/NuPack/NuPack.exe
new file mode 100644
index 00000000..6d899486
Binary files /dev/null and b/Tools/NuPack/NuPack.exe differ