Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <h1>Generate .csproj for .net standard</h1>
<p>Extracting package references from packages.config and project references from the old .csproj file to generate a new .net standard .csproj file
Will also map the PCL profile version to the corresponding .net standard version based on this document: <a href="" target="_blank"></a>
  <br/>Tested in latest versions of Firefox and Chrome. Will not work in IE or Edge</p>
<h3>1. Paste old .csproj</h3>
<p style="color:red" id="csprojErrorField"></p>
<textarea id="csproj"></textarea>
<h3>2. Paste packages.config</h3>
<p style="color:red" id="packageConfigErrorField"></p>
<textarea id="packageConfig"></textarea>
<h3>3. Here is your new .net standard 2.0 .csproj file</h3>
<textarea id="output" ></textarea>
<h3>Ps! Remember to delete assemblyreferences.cs and packages.config from your project</h3>
  height: 200px;
              // Run when changes are detected in input text areas

function generate(){
  // Clear error messages
  document.getElementById("csprojErrorField").innerHtml = "";  
  document.getElementById("packageConfigErrorField").innerHtml = "";

  // Parse xml document and get all package tags
  var packages = getPackageArray();
  var projectReferences = getProjectReferenceArray();
  // Build new xml document containing packages
  var xml = buildNewConfigFile(packages,projectReferences);
  // Serialize xml document to string and output
  var serializer = new XMLSerializer();
  document.getElementById("output").value = serializer.serializeToString(xml);

function buildNewConfigFile(packages,projects){
  // Need xml document to create tags
  var xml = document.implementation.createDocument(null,"dontneed");
  // Create root tag with attribute
  var root = xml.createElement("Project");
  // Set target framework
  var targetFramework = xml.createElement("TargetFramework");
  targetFramework.textContent = "netstandard" + getDotnetVersion();
  var propertyGroup = xml.createElement("PropertyGroup");
  // Add all packages
  var itemGroup = xml.createElement("ItemGroup");
  for(const p of packages){    
    var packageReference = xml.createElement("PackageReference");
  var projectItemGroup = xml.createElement("ItemGroup");
  for(const p of projects){
    var projectReference = xml.createElement("ProjectReference");
  return root;

function getPackageArray(){
  var packages = [];
  const inputstring = document.getElementById("packageConfig").value;
  const xml = new window.DOMParser().parseFromString(inputstring,"text/xml");
  if(inputstring.length != 0)
  // Find all elements with tag name package
  const xmlElements = xml.getElementsByTagName('package');
  for(const x of xmlElements){
    // Create obj for each package
    var package = {
      name: x.getAttribute("id"),
      version: x.getAttribute("version")
  return packages;

function getProjectReferenceArray(){
    var projectPaths = [];
  const inputstring = document.getElementById("csproj").value;
    var xml = new window.DOMParser().parseFromString(inputstring,"text/xml");
    if(inputstring.length != 0)
// Find all elements with tag name ProjectReference
  const xmlElements = xml.getElementsByTagName('ProjectReference');
  for(const e of xmlElements){
  return projectPaths;

function checkXmlForErrors(xml, errorOutputFieldId){
  var error = xml.getElementsByTagName("parsererror")[0];
    var errorMsg = error.getElementsByTagName("div")[0].textContent
    document.getElementById(errorOutputFieldId).innerHTML = errorMsg;
        document.getElementById(errorOutputFieldId).innerHTML = "";

function mapStandard(version){
  var versionNumber = version.replace(/[^0-9.]/g, "");
    case 31:
    case 49:
    case 78:
    case 84:
    case 157:
    case 259:
      return "1.0";
    case 7:
    case 111:
      return "1.1";
    case 32:
    case 44:
    case 151:
      return "1.2";
      //When in doubt. Go for 2.0
      return "2.0";

function getDotnetVersion(){
  const inputstring = document.getElementById("csproj").value;
  const xml = new window.DOMParser().parseFromString(inputstring,"text/xml");
  if(inputstring.length != 0)
  // Find all elements with tag name package
  const xmlElements = xml.getElementsByTagName('TargetFrameworkProfile');
  return mapStandard(xmlElements[0].innerHTML);
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.