Code Monkey home page Code Monkey logo

csprojtovs2017's Introduction

Convert your old project files to the new 2017 format

With the introduction of Visual Studio 2017, Microsoft added some optimizations to how a project file can be set up. However, no tooling was made available that performed this conversion as it was not necessary to do since Visual Studio 2017 would work with the old format too.

This project converts an existing csproj to the new format, shortening the project file and using all the nice new features that are part of Visual Studio 2017.

What does it fix?

There are a number of things that new project system handles differently that are performed by this tool:

  1. Include files using a wildcard as opposed to specifying every single file
  2. A more succinct way of defining project references
  3. A more succinct way of handling NuGet package references
  4. Moving some of the attributes that used to be defined in AssemblyInfo.cs into the project file
  5. Defining the NuGet package definition as part of the project file
  6. Some packages and assemblies don't need to be included since they are now a part of SDK.
  7. nodes no longer have to be specified
  8. Optionally migrate to netstandard 2.0 (see switches below)

How does it work

Using the tool is simple, it is a simple command line utility that has a single argument (as well as some optional switches see below) being the project file you would like to convert. You can also give a directory path and the tool will discover all csproj files nested in it.

For example Project2015To2017.exe "D:\Path\To\My\TestProject.csproj" Or Project2015To2017.exe "D:\Path\To\Solution\Directory"

After confirming this is an old style project file, it will start performing the conversion. When it has gathered all the data it needs it first creates a backup of the old project file (suffixed with .old) and then generates a new project file in the new format.

Some deafult behaviors

  • If the .vspscc file is found near the .csproj file then the following property group gets generated
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>

Command line optional switches

All switches could be specified in long (prefixed with --) or short (prefixed with -) form.

  • --netstandard (-n) - replace target platform moniker with netstandard2.0

  • --assemblyinfo (-a) - use the AssemblyInfo.cs file instead of embeding its contents into .csproj file. This results in generating set of GenerateAssembly_Attribute with false values to prevent build system form generating assembly info nodes and complaining about duplicates.

  • --versions (-v) - generate Version and FileVersion nodes with values from AssemblyInfo file. These nodes are not generated by default.

  • --del_old (-d) - deletes AssemblyInfo.cs.old (and Properties directory if it is empty) and packages.config.old files. This option does not delete .csproj.old file though.

  • --del_tfs_settings (-t) - deletes tfs settings file .vspscc from directory with .csproj.

  • --compile_items (-c) - includes Compile items definitions from old project file in a new one as-is. Since Compile nodes are no longer required (see Default compilation includes in .NET Core projects) this option is off by default. If the switch is specified a following node gets generated in main property group

    <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
  • --content_items (-o) - includes Content items definitions from old project file in a new one as-is. Since Content nodes are no longer required (see Default compilation includes in .NET Core projects) this option is off by default. If the switch is specified a following node gets generated in main property group

    <EnableDefaultContentItems>false</EnableDefaultContentItems>

csprojtovs2017's People

Contributors

hvanbakel avatar mbp avatar ozziepeeps avatar jetersen avatar tonyskorik avatar ablanchet avatar tom-englert avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.