GithubHelp home page GithubHelp logo

0username / nugetswitcher Goto Github PK

View Code? Open in Web Editor NEW
16.0 16.0 5.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%
nuget package-reference project-references visual-studio vsix

nugetswitcher's People

Contributors

0username avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nugetswitcher's Issues

Unable to access NuGet Switcher options

Hello,

I installed your extension in VS2022 successfully, but when I tried to enter its options after restarting VS I get the following error:

image

Here are the logs:

  <entry>
    <record>831</record>
    <time>2022/10/14 02:15:37.703</time>
    <type>Warning</type>
    <source>VisualStudio</source>
    <description>Performance warning: String load failed. Pkg:{FDB266B8-B91A-4BFD-B391-A4E013C176E2} (Main) LANG:0409 ID:0&#x000D;&#x000A;</description>
  </entry>
  <entry>
    <record>832</record>
    <time>2022/10/14 02:15:37.704</time>
    <type>Warning</type>
    <source>VisualStudio</source>
    <description>Performance warning: String load failed. Pkg:{FDB266B8-B91A-4BFD-B391-A4E013C176E2} (Main) LANG:0409 ID:0&#x000D;&#x000A;</description>
  </entry>
...
  <entry>
    <record>847</record>
    <time>2022/10/14 02:15:45.168</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Begin package load [Main]</description>
    <guid>{FDB266B8-B91A-4BFD-B391-A4E013C176E2}</guid>
  </entry>
  <entry>
    <record>848</record>
    <time>2022/10/14 02:15:45.174</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>SetSite failed for package [Main]Source: &apos;NuGetSwitcher.VSIX&apos; Description: Could not load file or assembly &apos;Microsoft.VisualStudio.Threading, Version=17.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos; or one of its dependencies. The system cannot find the file specified.&#x000D;&#x000A;System.IO.FileNotFoundException: Could not load file or assembly &apos;Microsoft.VisualStudio.Threading, Version=17.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos; or one of its dependencies. The system cannot find the file specified.&#x000D;&#x000A;File name: &apos;Microsoft.VisualStudio.Threading, Version=17.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos;&#x000D;&#x000A;   at NuGetSwitcher.VSIX.Main.InitializeAsync(CancellationToken cancellationToken, IProgress`1 progress)&#x000D;&#x000A;   at Microsoft.VisualStudio.Shell.AsyncPackage.&lt;&gt;c__DisplayClass20_0.&lt;&lt;Microsoft-VisualStudio-Shell-Interop-IAsyncLoadablePackageInitialize-Initialize&gt;b__1&gt;d.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()&#x000D;&#x000A;   at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e)&#x000D;&#x000A;   at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck)&#x000D;&#x000A;&#x000D;&#x000A;WRN: Assembly binding logging is turned OFF.&#x000D;&#x000A;To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.&#x000D;&#x000A;Note: There is some performance penalty associated with assembly bind failure logging.&#x000D;&#x000A;To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].&#x000D;&#x000A;</description>
    <guid>{FDB266B8-B91A-4BFD-B391-A4E013C176E2}</guid>
    <hr>80070002</hr>
    <errorinfo></errorinfo>
  </entry>

The same messages also occurs when I try using the extension's buttons.

I'm at version 0.8.0 o the extension.

Best,

Adds a duplicate project reference in any project that already contains a project reference to a project that exists in a configuration path

We use a microservice style architecture. So, we have a lot of small solutions that mostly contain a project, then a test project for testing the other project in the solution. The problem we have run into is that we have a CoreProject which becomes a NuGet Package and is referenced by everything else. Therefore, the path to the CoreProject is configured in the configuration file.

The problem appears when I load the CoreProject solution which contains 2 projects: CoreProject and CoreProjectTests. Now, the CoreProjectsTests project contains a Project Reference to the CoreProject. It also contains a Package Reference to our BastTesting project.

I would like to be able to use the NuGetSwitcher on this solution to replace the PackageReference to our BaseTesting Project with a Project Reference. When I do so, it also adds a duplicate reference to the CoreProject in the CoreProjectTests project.

Let me try to illustrate:

We have 2 Projects that get built as NuGet packages that everything else uses:

  • CoreProject
  • BaseTesting

The path for each of these is in the configuration file. I then have the following solution:

Solution:

  • Project: CoreProject
  • Project: CoreProjectTests

The CoreProjectTests project file has:

  • Project Reference: CoreProject
  • Package Reference: BaseTesting

When I use the NuGetSwitcher, it updates the CoreProjectTests project file to use a project reference for the BaseTesting as expected, but also adds a duplicate project reference to CoreProject.

I looked into fixing it myself, but didn't have much luck. One very important caveat that I should point out is that my existing Project Reference to CoreProject uses a relative path rather than an absolute path, and must continue to do so because of our CI pipeline and build environment. In looking at the code for this extension, I see absolute path comparisons, and I suspect that may have something to do with the issue.

Any help you could provide would be GREATLY appreciated.

I have attached a sample project structure for testing purposes.

SampleProjectStructure.zip

Use PackageReference and SaveAll comand

Reproduced in Microsoft Visual Studio Community 2019 Version 16.4.2.

Steps to reproduce:

  1. Use ProjectReference - References are successfully switched to the projects
  2. Use PackageReference - References are successfully switched to the nuget\packages
  3. Choose File->SaveAll in the VS menu or Ctrl+Shift+S - some project files lose references

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.