GithubHelp home page GithubHelp logo

magicmoux / nugetswitcher Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 0username/nugetswitcher

0.0 0.0 0.0 813 KB

Extension for switching references in projects: PackageReference to ProjectReference.

Home Page: https://marketplace.visualstudio.com/items?itemName=github0UserName.DCB9FB28-5610-4A94-9471-4BF2D0556BC5

C# 100.00%

nugetswitcher's Introduction

Build Status

Build Status Quality Gate Status

Description

For the extension to work, you need to specify a configuration file that essentially only contains paths (one per line) for searching for projects:

ext_options

When you click the Use ProjectReference button, the extension looks through the list of projects included in the solution and begins to process each of them sequentially.

ext_sln_explorer

Project dependency search is based on project.assets.json file, which lists all the dependencies of the project. It is created in the /obj folder when using dotnet restore or dotnet build as it implicitly calls restore before build, or msbuid.exe /t:restore with MSBuild CLI. If project.assets.json is not found in the specified project directory, then the extension stops processing and displays the following message:

ext_error_list

If the file is present, then the extension starts processing explicit and implicit (transitive) dependencies of the project - NuGet packages, framework assemblies. After processing, the Messages tab of the Error List displays information about each changed project and the references included in it.

Conditional references

When working with references, only evaluated items are used. In this example, when using the Debug configuration, reference A will be replaced, while for the Release configuration, reference B.
<Choose>
  <When Condition=" '$(Configuration)' != 'Release' ">
    <ItemGroup>
      <PackageReference Include="LibraryA" Version="0.1.0*" />
    </ItemGroup>
  </When>
  <Otherwise>
    <ItemGroup>
      <ProjectReference Include="LibraryB" Version="0.1.0*" />
    </ItemGroup>
  </Otherwise>
</Choose>

Multitargeting

Multitargeting as such does not have special support, i.e. a project with TFMs defined as follows:
<TargetFrameworks>
  net461;net462;net472;netstandard2.0;netstandard2.1
</TargetFrameworks>
Will be processed as if it had TFMs:
<TargetFrameworkVersion>
  v4.6.1
</TargetFrameworkVersion>

Comments

Separate lines entered in the configuration file can be commented out as follows:
#E:\Project\a\Library
With this configuration, at the moment of switching references, the search for in the commented out directories will be ignored.

Requirements

It is assumed that in the stable version the extension should support Visual Studio 22. The author conducted an initial test in the next version of Visual Studio:
Microsoft Visual Studio Community 2022
Version 17.2.5
.NET Core SDK version >= 3.0 is required since version 0.5.0.

Useful Links

nugetswitcher's People

Contributors

0username 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.