dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.66k stars 1.06k forks source link

dotnet add package String reference error #8822

Closed dsplaisted closed 4 years ago

dsplaisted commented 6 years ago

From @gregdegruy on October 10, 2017 21:12

String reference error

Notice how there is no proper string replacement done below.

Error while adding package '{0}' to project '{1}'

Would like to help fix, but not sure where the repo or if it is open source for the ERROR handling in the dotnet CLI.

Error

C:\GitHub\_mr.robot\DYN.Gamification\DYN.Gamification [master ≡ +2 ~2 -0 !]> dotnet add package Microsoft.CrmSdk.CoreAssemblies --version 8.2.0.2
  Writing C:\Users\grdegr\AppData\Local\Temp\tmp399F.tmp
info : Adding PackageReference for package 'Microsoft.CrmSdk.CoreAssemblies' into project 'C:\GitHub\_mr.robot\DYN.Gamification\DYN.Gamification\DYN.Gamification.csproj'.
error: Error while adding package '{0}' to project '{1}'. dotnet add package command supports adding package to one project at a time. But no project was found at the project path '{0}'.
C:\GitHub\_mr.robot\DYN.Gamification\DYN.Gamification [master ≡ +2 ~2 -0 !]>

Copied from original issue: dotnet/docs#3368

dsplaisted commented 6 years ago

From @mairaw on October 10, 2017 22:47

Thanks @gregdegruy. Can you provide the info you get when you run dotnet --info? The CLI repo is open source too. You can find it at https://github.com/dotnet/cli/.

I have 2.0.0 SDK installed and the message I get is different. So it would be good to know which version you're running.

C:\Temp\projects\DYN.Gamification [master ≡ +2 ~2 -0 !]>dotnet add package Microsoft.CrmSdk.CoreAssemblies --version 8.2.0.2
Could not find any project in `C:\Temp\projects\DYN.Gamification [master ≡ +2 ~2 -0 !]\`.
Usage: dotnet add <PROJECT> package [options] <PACKAGE_NAME>

Arguments:
  <PROJECT>        The project file to operate on. If a file is not specified, the command will search the current directory for one.
  <PACKAGE_NAME>   The package reference to add.

Options:
  -h, --help                                Show help information.
  -v, --version <VERSION>                   Version for the package to be added.
  -f, --framework <FRAMEWORK>               Adds reference only when targeting a specific framework.
  -n, --no-restore                          Adds reference without performing restore preview and compatibility check.
  -s, --source <SOURCE>                     Specifies NuGet package sources to use during the restore.
  --package-directory <PACKAGE_DIRECTORY>   Restores the packages to the specified directory.

/cc @livarcocc @dsplaisted

dsplaisted commented 6 years ago

From @gregdegruy on October 10, 2017 23:16

I'm also on 2.0.0

.NET Command Line Tools (2.0.0)

Product Information:
 Version:            2.0.0
 Commit SHA-1 hash:  cdcd1928c9

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.15063
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.0.0\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d
dsplaisted commented 6 years ago

From @mairaw on October 10, 2017 23:32

Interesting. And so do you have a project on that path or not? If so, what's the name of the csproj file? I'm wondering if the engine is getting lost with all those special characters in the file path, given this output without the full folder name:

Adding PackageReference for package 'Microsoft.CrmSdk.CoreAssemblies' into project 'C:\GitHub\_mr.robot\DYN.Gamification\DYN.Gamification\DYN.Gamification.csproj'.

dsplaisted commented 6 years ago

From @gregdegruy on October 11, 2017 16:47

I do and there's one extra period in the name (I've removed the name between the period so I'll just the word Customer in there for now) it's called DYN.Customer.Gamification.csproj

peterhuene commented 6 years ago

Hi @dsplaisted. Thanks for reporting this issue!

This particular error message appears to be coming from NuGet and has been fixed with https://github.com/NuGet/NuGet.Client/commit/012941024a48a22bdcaf9fa3171276e7c075630e in PR https://github.com/NuGet/NuGet.Client/pull/1706.

@livarcocc I believe this issue can be closed.

mairaw commented 6 years ago

@gregdegruy FYI, in case you wanna test if the issue you originally reported has been fixed.

peterhuene commented 6 years ago

Whoops, thanks for the mention fix 😁