Skip to content

Instantly share code, notes, and snippets.

@darrelmiller
Last active June 3, 2021 06:18
Show Gist options
  • Save darrelmiller/07fed784d2c20de9f5d3719977167181 to your computer and use it in GitHub Desktop.
Save darrelmiller/07fed784d2c20de9f5d3719977167181 to your computer and use it in GitHub Desktop.
Project.json comparison with XML equivalent
{
"authors": [
"Sam Saffron",
"Marc Gravell",
"Nick Craver"
],
"owners": [
"marc.gravell",
"nick.craver"
],
"projectUrl": "https://github.com/StackExchange/dapper-dot-net",
"licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0",
"summary": "A high performance Micro-ORM",
"description": "A high performance Micro-ORM supporting SQL Server, MySQL, Sqlite, SqlCE, Firebird etc..",
"version": "1.50-beta9",
"title": "Dapper dot net",
"tags": [
"orm",
"sql",
"micro-orm"
],
"copyright": "2015 Stack Exchange, Inc.",
"dependencies": {},
"releaseNotes": "http://stackexchange.github.io/dapper-dot-net/",
"compilationOptions": {
"warningsAsErrors": true
},
"frameworks": {
"net40": {
"frameworkAssemblies": {
"System.Data": "4.0.0.0",
"System.Xml": "4.0.0.0",
"System.Xml.Linq": "4.0.0.0"
}
},
"net45": {
"compilationOptions": {
"define": [
"ASYNC"
]
},
"frameworkAssemblies": {
"System.Data": "4.0.0.0",
"System.Xml": "4.0.0.0",
"System.Xml.Linq": "4.0.0.0"
}
},
"net451": {
"frameworkAssemblies": {
"System.Data": "4.0.0.0",
"System.Xml": "4.0.0.0",
"System.Xml.Linq": "4.0.0.0"
},
"compilationOptions": {
"define": [
"ASYNC"
]
}
},
"netstandard1.3": {
"compilationOptions": {
"define": [
"ASYNC",
"COREFX"
]
},
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24015",
"System.Data.SqlClient": "4.1.0-rc2-24015",
"System.Dynamic.Runtime": "4.0.11-rc2-24015",
"System.Reflection.Emit": "4.0.1-rc2-24015",
"System.Reflection.Emit.Lightweight": "4.0.1-rc2-24015",
"System.Xml.XmlDocument": "4.0.1-rc2-24015",
"System.Collections.NonGeneric": "4.0.1-rc2-24015",
"System.Reflection.TypeExtensions": "4.1.0-rc2-24015"
}
}
}
}
<project
authors="Sam Saffron, Marc Gravell, Nick Craver"
owners="marc.gravell, nick.craver"
projectUrl="https://github.com/StackExchange/dapper-dot-net"
licenseUrl="http://www.apache.org/licenses/LICENSE-2.0"
summary="A high performance Micro-ORM"
description="A high performance Micro-ORM supporting SQL Server, MySQL, Sqlite, SqlCE, Firebird etc.."
version= "1.50-beta9"
title= "Dapper dot net"
tags= "orm,sql,micro-orm"
copyright= "2015 Stack Exchange, Inc."
>
<releaseNotes>http://stackexchange.github.io/dapper-dot-net/</releaseNotes>
<compilationOptions warningsAsErrors="true"/>
<framework moniker="net40">
<assembly name="System.Data" version="4.0.0.0"/>
<assembly name="System.Xml" version="4.0.0.0"/>
<assembly name="System.Xml.Linq" version="4.0.0.0"/>
</framework>
<framework moniker="net45">
<compilationOptions define="ASYNC"/>
<assembly name="System.Data" version="4.0.0.0"/>
<assembly name="System.Xml" version="4.0.0.0"/>
<assembly name="System.Xml.Linq" version="4.0.0.0"/>
</framework>
<framework moniker="net451">
<compilationOptions define="ASYNC"/>
<assembly name="System.Data" version="4.0.0.0"/>
<assembly name="System.Xml" version="4.0.0.0"/>
<assembly name="System.Xml.Linq" version="4.0.0.0"/>
</framework>
<framework moniker="netstandard1.3">
<compilationOptions define="ASYNC,COREFX"/>
<dependency name="NETStandard.Library" version="1.5.0-rc2-24015"/>
<dependency name="System.Data.SqlClient" version="4.1.0-rc2-24015"/>
<dependency name="System.Dynamic.Runtime" version="4.0.11-rc2-24015"/>
<dependency name="System.Reflection.Emit" version="4.0.1-rc2-24015"/>
<dependency name="System.Reflection.Emit.Lightweight" version="4.0.1-rc2-24015"/>
<dependency name="System.Xml.XmlDocument" version="4.0.1-rc2-24015"/>
<dependency name="System.Collections.NonGeneric" version="4.0.1-rc2-24015"/>
<dependency name="System.Reflection.TypeExtensions" version="4.0.1-rc2-24015"/>
</framework>
</project>
@Mike-E-angelo
Copy link

This is a great discussion and examples! While format is important, what is more important to me is a strong backing model . I would rather see the project "schema" be a Project POCO that has a well-known/defined class structure which the file is based.

FWIW, I have created an issue around this here:
dotnet/project-system#37

And also there is an open discussion in MSBuild around formats here and project improvements here:
dotnet/msbuild#613

@malisancube
Copy link

I think XML is not bad. Parsing and tooling (for intellisense and stuff) should be easier to implement.

@douglasstarnes
Copy link

While XML is more verbose it has the advantage of being more descriptive. XML is also a better archival format. JSON is intended to be lightweight and ephemeral such as when passing small bits of data on a web service. If JSON is really a better format, then not only is Microsoft doing it wrong with .csproj and XAML but Apple is doing it wrong with Interface Builder and Google is doing it wrong with layout files. The W3C is even doing it wrong with HTML. At some point, archived files will need to be read by a human and XML is better suited for that. Just my two cents.

@asbjornu
Copy link

@whitlockjc, that hand edited YAML example almost brings me to tears of joy. If that was how project files in Visual Studio looked like, and the .sln file just disappeared (or turned into YAML as well), I'm sure my life would be lengthened by a few years. I at least know that currently, the horror of .sln, .csproj and MSBuild as a whole, is shortening my life expectancy due to heightened stress levels by a lot. I'm gnashing teeth just writing that last sentence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment