jmrog / vscode-nuget-package-manager

An extension for Visual Studio Code that lets you easily add or remove .NET Core 1.1+ package references to/from your project's .csproj file using Code's Command Palette.
MIT License
34 stars 17 forks source link

It doesn't work if the csproj file isn't in the root directory #12

Closed pechovic closed 7 years ago

pechovic commented 7 years ago

VS Code Version 1.10.2 (1.10.2) OS: MacOS Sierra 10.12.3

If you have a vscode workspace with multiple projects separated in additional subdirectories than this plugin fails to load the csproj file. It says, it can't find the csproj file and it looks for the csproj file in the root directory.

jmrog commented 7 years ago

Right. This is one of the known issues listed in the README and is a duplicate of #10. A fix is in the works and should be released soon. Thanks!

Closing as a duplicate.

pechovic commented 7 years ago

Hi, sorry but it is not listed in the README file.

jmrog commented 7 years ago

Under "Known Issues": The extension assumes that your project's .csproj file has the same name as the directory name in which your project resides.

In other words, the extension only works if the root directory for the project has a .csproj file in that directory with the same name as that directory -- that's the only one it looks for. I suppose this could be clearer, so I'll work on that. Sorry for any confusion.

pechovic commented 7 years ago

Hi, I appreciate your work and the fact that you are doing this for free. I know you know what the issue is. This is just to be clear that I am reading readme files.

Given the following file system structure:

/- |-MyProject (vscode workspace root dir) | - MyProject (dir) | | - MyProject.csproj (file) | - MyProject.Test (dir)

Now, the csproj file has the same name as the directory name in which the project resides. This is basically quotation of your note. The file system follows the rule but the extension will still not work.

jmrog commented 7 years ago

Hi, I appreciate your work and the fact that you are doing this for free. I know you know what the issue is. This is just to be clear that I am reading readme files.

Sure, no problem. I didn't mean anything by it (I was replying from my cell phone and just wanted to note that I'm aware of the issue); sorry if it came across as implying something more!

What the extension currently works with is a file system structure like this (the documentation is probably not very clear on this; it should say "workspace" rather than "project"):

/- |-MyProject | -MyProject.csproj | -SomeOtherDir | -SomeOtherFile.cs

I now have a working version that seems to handle nested .csproj files just fine, so it should resolve your issue. I want to run more tests and such before I release it, though. Would you be interested in installing it and testing it before I release it?

pechovic commented 7 years ago

Thank you! I will get and test the new version once you release it ;) Looking forward to it!

jmrog commented 7 years ago

@pechovic I now have the version of this extension ready that should support multiple .csproj files. It should find any .csproj files anywhere inside of your workspace's root directory; if it finds only one, it will just use that one, but if it finds multiple, it will ask you which one to use. If you are interested in trying this version out and letting me know how it works for you before I release it through the extensions marketplace, that would be awesome! There are some big changes, so I'd love for people to test it before the extension is fully released.

If you're interested, you can find it packaged here: https://github.com/jmrog/vscode-nuget-package-manager/blob/jr/v1.0.0/dist/vscode-nuget-package-manager-1.0.0.vsix

If you're not sure how to install an extension from a distributed package, check out the instructions here: https://code.visualstudio.com/docs/extensions/install-extension#_install-from-a-vsix

If you'd rather just wait for the actual extension release, that's fine too. :) Just let me know, if you have a chance! I will probably release later today, but will wait a few hours to see.

pechovic commented 7 years ago

@jmrog I just tested it. It works ok for me. Thank you!

jmrog commented 7 years ago

Awesome, thanks for checking it out. Looking good here, too, so I'll do the formal release shortly.