Giter Site home page Giter Site logo

msbuildduplicateprojectguid's Introduction

MsBuildDuplicateProjectGuid

CI - Master

Utility to find duplicated MsBuild Project GUIDs

Background

In the MSBuild Project System, the ProjectGuid is expected to exist in each MSBuild Style Project. It is used in several places; most importantly:

As the name suggests (ProjectGuid) this is expected to be a Globally Unique IDentifier.

The tooling is so dependent upon this fact that if you attempt to import two projects which have identical ProjectGuid into a Visual Studio Solution File one will be chosen as the loser and its Guid Regenerated.

Duplication most often happens because a developer was attempting to use an existing project as a "template" for a new project.

There is nothing wrong with making a copy of an existing project, but when you do so you need to take special care to generate a new ProjectGuid tag.

When To Use This Tool

This tool will help you identify projects (within a subfolder) that are not "Globally Unique".

However, this tool does not attempt to make corrections. In order to do so look at https://github.com/aolszowka/MsBuildSetProjectGuid

Usage

There are now two ways to run this tool:

  1. (Compiled Executable) Invoke the tool via MsBuildDuplicateProjectGuid.exe and pass the arguments.
  2. (Dotnet Tool) Install this tool using the following command dotnet tool install MsBuildDuplicateProjectGuid (assuming that you have the nuget package in your feed) then invoke it via dotnet duplicate-projectguid

In both cases the flags are identical to the tooling.

Usage: C:\DirectoryWithProjects

Scans given directory for MsBuild Projects; reporting any duplicate ProjectGuids
it finds.

Arguments:

              <>             The directory to scan for MSBuild Projects
      --xml                  Produce Output in XML Format
  -?, -h, --help             Show this message and exit

Hacking

The most likely change you will want to make is changing the supported project files. In theory this tool should support any MSBuild Project Format that utilizes a ProjectGuid. This means that .NET Core Projects will not work out of the box.

See MsBuildDuplicateProjectGuid.GetProjectsInDirectory(string) for the place to modify this.

To assist in testing the dotnet tool version of this tool there is a batch file in build\Update-Package.bat that will attempt to clean up your NuGet Package Cache (in Windows) and re-install the tool as a local tool.

Contributing

Pull requests and bug reports are welcomed so long as they are MIT Licensed.

License

This tool is MIT Licensed.

Third Party Licenses

This project uses other open source contributions see LICENSES.md for a comprehensive listing.

msbuildduplicateprojectguid's People

Contributors

aolszowka avatar

Stargazers

 avatar Justin Hachemeister avatar

Watchers

James Cloos avatar  avatar

msbuildduplicateprojectguid's Issues

Request: Utilize NDesk.Options For Options Parsing

tl;dr; Use http://www.ndesk.org/Options to perform our options parsing. Its MIT Licensed which is compatible with the license of this project and is extremely lightweight.

Currently we do a bunch of manual options parsing, however this makes it difficult to extend this program by forcing us to deal with command line parsing which isn't our goal. Rather we should spin this out into a library.

There are lots of options parsing libraries available to us, for example Microsoft provides https://github.com/dotnet/command-line-api. However if you look at the number of dependencies that has to carry around you nope out of that pretty quickly.

Rather I am going to suggest we use NDesk.Options for parsing, its a super lightweight dependency (just a single CS file), the usage is very straight forward, and is MIT Licensed.

The only downsides I can see is that it is not actively maintained (last updated back in 2008) and has some pretty gnarly LINQ in it to perform its magic. This probably means that there are some corner cases but at this point its better than rolling our own.

Request: Enable GitHub Actions

It would be nice if we had a CI Process around this that built the project as well as packaged it for distribution via dotnet tool

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.