diff --git a/Build/build.ps1 b/Build/build.ps1
new file mode 100644
index 00000000..d688a1de
--- /dev/null
+++ b/Build/build.ps1
@@ -0,0 +1,116 @@
+properties {
+ $zipFileName = "Json35r7.zip"
+ $signAssemblies = $false
+ $signKeyPath = "D:\Development\Releases\newtonsoft.snk"
+ $buildDocumentation = $false
+
+ $baseDir = resolve-path ..
+ $buildDir = "$baseDir\Build"
+ $sourceDir = "$baseDir\Src"
+ $toolsDir = "$baseDir\Tools"
+ $releaseDir = "$baseDir\Release"
+ $workingDir = "$baseDir\Working"
+ $builds = @(
+ @{Name = "Newtonsoft.Json.Silverlight"; TestsName = "Newtonsoft.Json.Tests.Silverlight"; Constants="SILVERLIGHT"; FinalDir="Silverlight"},
+ @{Name = "Newtonsoft.Json.Compact"; TestsName = "Newtonsoft.Json.Tests.Compact"; Constants="PocketPC"; FinalDir="Compact"},
+ @{Name = "Newtonsoft.Json.Net20"; TestsName = "Newtonsoft.Json.Tests.Net20"; Constants="NET20"; FinalDir="DotNet20"},
+ @{Name = "Newtonsoft.Json"; TestsName = "Newtonsoft.Json.Tests"; Constants=""; FinalDir="DotNet"}
+ )
+}
+
+task default -depends Build
+
+task Clean {
+ Set-Location $baseDir
+
+ if (Test-Path -path $workingDir)
+ {
+ Write-Output "Deleting Working Directory"
+
+ del $workingDir -Recurse -Force
+ }
+
+ New-Item -Path $workingDir -ItemType Directory
+}
+
+task Build -depends Clean {
+
+ foreach ($build in $builds)
+ {
+ $name = $build.Name
+ Write-Host -ForegroundColor Green "Building " $name
+ Write-Host
+ exec { msbuild "/t:Clean;Rebuild" /p:Configuration=Release /p:AssemblyOriginatorKeyFile=$signKeyPath "/p:SignAssembly=$signAssemblies" (GetConstants $build.Constants $signAssemblies) ".\Src\Newtonsoft.Json\$name.csproj" } "Error building $name"
+ }
+}
+
+task Package -depends Build {
+ $compileOutputDir = "$sourceDir\Newtonsoft.Json\bin\Release"
+
+ Copy-Item -Path $compileOutputDir -Destination $workingDir -recurse
+
+ New-Item -Path $workingDir\Merge -ItemType Directory
+
+ $ilMergeKeyFile = switch($signAssemblies) { $true { "/keyfile:$signKeyPath" } default { "" } }
+
+ exec { .\Tools\ILMerge\ilmerge.exe "/internalize" $ilMergeKeyFile "/out:$workingDir\Merge\Newtonsoft.Json.Net20.dll" "$workingDir\Release\Newtonsoft.Json.Net20.dll" "$workingDir\Release\LinqBridge.dll" } "Error executing ILMerge"
+
+ del $workingDir\Release\Newtonsoft.Json.Net20.dll
+ del $workingDir\Release\Newtonsoft.Json.Net20.pdb
+ del $workingDir\Release\LinqBridge.dll
+
+ Copy-Item -Path $workingDir\Merge\Newtonsoft.Json.Net20.dll -Destination $workingDir\Release\
+ Copy-Item -Path $workingDir\Merge\Newtonsoft.Json.Net20.pdb -Destination $workingDir\Release\
+
+ foreach ($build in $builds)
+ {
+ $name = $build.Name
+ $finalDir = $build.FinalDir
+
+ New-Item -Path $workingDir\Package\Bin\$finalDir -ItemType Directory
+ dir $workingDir\Release | where { $_.Name -like "*$name*" -and $_.PSIsContainer -ne $true } | move -Destination $workingDir\Package\Bin\$finalDir\$_
+ }
+
+ del $workingDir\Merge -Recurse
+ del $workingDir\Release -Recurse
+
+ if ($buildDocumentation)
+ {
+ exec { msbuild "/t:Clean;Rebuild" /p:Configuration=Release .\Doc\doc.shfbproj } "Error building documentation. Check that you have Sandcastle, Sandcastle Help File Builder and HTML Help Workshop installed."
+
+ New-Item -Path $workingDir\Package\Documentation -ItemType Directory
+ move -Path $workingDir\Documentation\Documentation.chm -Destination $workingDir\Package\Documentation\Documentation.chm
+ move -Path $workingDir\Documentation\LastBuild.log -Destination $workingDir\Documentation.log
+ }
+
+ robocopy $sourceDir $workingDir\Package\Source\Src /MIR /NP /XD .svn bin obj /XF *.suo *.user
+ robocopy $buildDir $workingDir\Package\Source\Build /MIR /NP /XD .svn
+ robocopy $docDir $workingDir\Package\Source\Doc /MIR /NP /XD .svn
+ robocopy $toolsDir $workingDir\Package\Source\Tools /MIR /NP /XD .svn
+
+ exec { .\Tools\7-zip\7za.exe a -tzip $workingDir\$zipFileName $workingDir\Package\* } "Error zipping"
+}
+
+task Deploy -depends Package {
+ exec { .\Tools\7-zip\7za.exe x -y "-o$workingDir\Deployed" $workingDir\$zipFileName } "Error unzipping"
+}
+
+task Test -depends Deploy {
+ foreach ($build in $builds)
+ {
+ $name = $build.TestsName
+ Write-Host -ForegroundColor Green "Building " $name
+ Write-Host
+ exec { msbuild "/t:Clean;Rebuild" /p:Configuration=Release /p:AssemblyOriginatorKeyFile=$signKeyPath "/p:SignAssembly=$signAssemblies" (GetConstants $build.Constants $signAssemblies) ".\Src\Newtonsoft.Json.Tests\$name.csproj" } "Error executing MSBUILD"
+ Write-Host -ForegroundColor Green "Running tests " $name
+ Write-Host
+ exec { .\Tools\NUnit\nunit-console.exe ".\Src\Newtonsoft.Json.Tests\bin\Release\$name.dll" /xml:$workingDir\$name.xml } "Error running $name tests"
+ }
+}
+
+function GetConstants($constants, $includeSigned)
+{
+ $signed = switch($includeSigned) { $true { ";SIGNED" } default { "" } }
+
+ return "/p:DefineConstants=`"TRACE;$constants$signed`""
+}
\ No newline at end of file
diff --git a/Build/runbuild.cmd b/Build/runbuild.cmd
new file mode 100644
index 00000000..fa2115ea
--- /dev/null
+++ b/Build/runbuild.cmd
@@ -0,0 +1 @@
+powershell -Command "& {Import-Module ..\Tools\PSake\psake.psm1; Invoke-psake .\build.ps1 %*}"
\ No newline at end of file
diff --git a/Build/runbuild.ps1 b/Build/runbuild.ps1
new file mode 100644
index 00000000..e019ffa1
--- /dev/null
+++ b/Build/runbuild.ps1
@@ -0,0 +1,5 @@
+cls
+
+Import-Module '..\Tools\PSake\psake.psm1'
+Invoke-psake '.\build.ps1' Test -framework 3.5
+Remove-Module psake
\ No newline at end of file
diff --git a/Src/Doc/ContractResolver.html b/Doc/ContractResolver.html
similarity index 100%
rename from Src/Doc/ContractResolver.html
rename to Doc/ContractResolver.html
diff --git a/Src/Doc/ConvertingJSONandXML.html b/Doc/ConvertingJSONandXML.html
similarity index 100%
rename from Src/Doc/ConvertingJSONandXML.html
rename to Doc/ConvertingJSONandXML.html
diff --git a/Src/Doc/CustomCreationConverter.html b/Doc/CustomCreationConverter.html
similarity index 100%
rename from Src/Doc/CustomCreationConverter.html
rename to Doc/CustomCreationConverter.html
diff --git a/Src/Doc/DatesInJSON.html b/Doc/DatesInJSON.html
similarity index 100%
rename from Src/Doc/DatesInJSON.html
rename to Doc/DatesInJSON.html
diff --git a/Src/Doc/Introduction.html b/Doc/Introduction.html
similarity index 100%
rename from Src/Doc/Introduction.html
rename to Doc/Introduction.html
diff --git a/Src/Doc/LINQtoJSON.html b/Doc/LINQtoJSON.html
similarity index 100%
rename from Src/Doc/LINQtoJSON.html
rename to Doc/LINQtoJSON.html
diff --git a/Src/Doc/PreserveObjectReferences.html b/Doc/PreserveObjectReferences.html
similarity index 100%
rename from Src/Doc/PreserveObjectReferences.html
rename to Doc/PreserveObjectReferences.html
diff --git a/Src/Doc/ReadingWritingJSON.html b/Doc/ReadingWritingJSON.html
similarity index 100%
rename from Src/Doc/ReadingWritingJSON.html
rename to Doc/ReadingWritingJSON.html
diff --git a/Src/Doc/ReducingSerializedJSONSize.html b/Doc/ReducingSerializedJSONSize.html
similarity index 100%
rename from Src/Doc/ReducingSerializedJSONSize.html
rename to Doc/ReducingSerializedJSONSize.html
diff --git a/Src/Doc/SelectToken.html b/Doc/SelectToken.html
similarity index 100%
rename from Src/Doc/SelectToken.html
rename to Doc/SelectToken.html
diff --git a/Src/Doc/SerializationAttributes.html b/Doc/SerializationAttributes.html
similarity index 100%
rename from Src/Doc/SerializationAttributes.html
rename to Doc/SerializationAttributes.html
diff --git a/Src/Doc/SerializationCallbacks.html b/Doc/SerializationCallbacks.html
similarity index 100%
rename from Src/Doc/SerializationCallbacks.html
rename to Doc/SerializationCallbacks.html
diff --git a/Src/Doc/SerializationErrorHandling.html b/Doc/SerializationErrorHandling.html
similarity index 100%
rename from Src/Doc/SerializationErrorHandling.html
rename to Doc/SerializationErrorHandling.html
diff --git a/Src/Doc/SerializingCollections.html b/Doc/SerializingCollections.html
similarity index 100%
rename from Src/Doc/SerializingCollections.html
rename to Doc/SerializingCollections.html
diff --git a/Src/Doc/SerializingJSON.html b/Doc/SerializingJSON.html
similarity index 100%
rename from Src/Doc/SerializingJSON.html
rename to Doc/SerializingJSON.html
diff --git a/Src/Doc/SerializingJSONFragments.html b/Doc/SerializingJSONFragments.html
similarity index 100%
rename from Src/Doc/SerializingJSONFragments.html
rename to Doc/SerializingJSONFragments.html
diff --git a/Src/Doc/custom.css b/Doc/custom.css
similarity index 100%
rename from Src/Doc/custom.css
rename to Doc/custom.css
diff --git a/Src/Doc/doc.shfbproj b/Doc/doc.shfbproj
similarity index 93%
rename from Src/Doc/doc.shfbproj
rename to Doc/doc.shfbproj
index 5b9f6125..0efcc45d 100644
--- a/Src/Doc/doc.shfbproj
+++ b/Doc/doc.shfbproj
@@ -14,7 +14,7 @@
Documentation
Documentation
- .\Output\
+ ..\Working\Documentation\
Documentation
@@ -36,8 +36,8 @@
Prototype
MemberName
-
-
+
+
diff --git a/Src/Doc/doc.sitemap b/Doc/doc.sitemap
similarity index 100%
rename from Src/Doc/doc.sitemap
rename to Doc/doc.sitemap
diff --git a/Src/Doc/donate.gif b/Doc/donate.gif
similarity index 100%
rename from Src/Doc/donate.gif
rename to Doc/donate.gif
diff --git a/Src/Doc/styles.css b/Doc/styles.css
similarity index 100%
rename from Src/Doc/styles.css
rename to Doc/styles.css
diff --git a/Src/Newtonsoft.Json.sln b/Src/Newtonsoft.Json.sln
index c093427e..d058c512 100644
--- a/Src/Newtonsoft.Json.sln
+++ b/Src/Newtonsoft.Json.sln
@@ -11,28 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Newtonsoft.Json", "Newtonso
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Newtonsoft.Json.Tests", "Newtonsoft.Json.Tests\Newtonsoft.Json.Tests.csproj", "{3E6E2335-B079-4B5B-A65A-9D586914BCBB}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Doc", "Doc", "{8F9E13D9-4181-4BA6-8802-EB5B3EB9445A}"
- ProjectSection(SolutionItems) = preProject
- Doc\ContractResolver.html = Doc\ContractResolver.html
- Doc\custom.css = Doc\custom.css
- Doc\CustomCreationConverter.html = Doc\CustomCreationConverter.html
- Doc\DatesInJSON.html = Doc\DatesInJSON.html
- Doc\doc.sitemap = Doc\doc.sitemap
- Doc\donate.gif = Doc\donate.gif
- Doc\Introduction.html = Doc\Introduction.html
- Doc\LINQtoJSON.html = Doc\LINQtoJSON.html
- Doc\PreserveObjectReferences.html = Doc\PreserveObjectReferences.html
- Doc\ReadingWritingJSON.html = Doc\ReadingWritingJSON.html
- Doc\ReducingSerializedJSONSize.html = Doc\ReducingSerializedJSONSize.html
- Doc\SelectToken.html = Doc\SelectToken.html
- Doc\SerializationAttributes.html = Doc\SerializationAttributes.html
- Doc\SerializationErrorHandling.html = Doc\SerializationErrorHandling.html
- Doc\SerializingCollections.html = Doc\SerializingCollections.html
- Doc\SerializingJSON.html = Doc\SerializingJSON.html
- Doc\SerializingJSONFragments.html = Doc\SerializingJSONFragments.html
- Doc\styles.css = Doc\styles.css
- EndProjectSection
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
diff --git a/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs b/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs
index 5df4fa31..73eb3bb4 100644
--- a/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs
+++ b/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs
@@ -316,6 +316,11 @@ namespace Newtonsoft.Json.Serialization
}
#if !SILVERLIGHT && !PocketPC
+ ///
+ /// Creates a for the given type.
+ ///
+ /// Type of the object.
+ /// A for the given type.
protected virtual JsonISerializableContract CreateISerializableContract(Type objectType)
{
JsonISerializableContract contract = new JsonISerializableContract(objectType);
@@ -333,6 +338,11 @@ namespace Newtonsoft.Json.Serialization
}
#endif
+ ///
+ /// Creates a for the given type.
+ ///
+ /// Type of the object.
+ /// A for the given type.
protected virtual JsonStringContract CreateStringContract(Type objectType)
{
JsonStringContract contract = new JsonStringContract(objectType);
@@ -341,6 +351,11 @@ namespace Newtonsoft.Json.Serialization
return contract;
}
+ ///
+ /// Determines which contract type is created for the given type.
+ ///
+ /// Type of the object.
+ /// A for the given type.
protected virtual JsonContract CreateContract(Type objectType)
{
if (JsonConvert.IsJsonPrimitiveType(objectType))
diff --git a/Src/Newtonsoft.Json/Serialization/JsonISerializableContract.cs b/Src/Newtonsoft.Json/Serialization/JsonISerializableContract.cs
index f44373ae..ee1eadb1 100644
--- a/Src/Newtonsoft.Json/Serialization/JsonISerializableContract.cs
+++ b/Src/Newtonsoft.Json/Serialization/JsonISerializableContract.cs
@@ -37,6 +37,10 @@ namespace Newtonsoft.Json.Serialization
///
public class JsonISerializableContract : JsonContract
{
+ ///
+ /// Gets or sets the ISerializable object constructor.
+ ///
+ /// The ISerializable object constructor.
public ObjectConstructor