obfuscar / example

Example repo of Obfuscar.
54 stars 26 forks source link

The project does not support adding package references through the add package command. #1

Closed ghost closed 6 years ago

ghost commented 6 years ago

Hi, when i try to add package to my protect using command dotnet add package Obfuscar --version 2.2.11 it says "The project does not support adding package references through the add package command." but msdn do not tell about this error so how do i do?

Actual output:

Writing C:\Users\username\AppData\Local\Temp\tmp17C4.tmp
info : Adding PackageReference for package 'Obfuscar' into project '[path censored]\My project.csproj'.
error: Error while adding package 'Obfuscar' to project '[path censored]\My project.csproj'. The project does not support adding package references through the add package command.
lextm commented 6 years ago

I cannot reproduce it.

What is the output of dotnet --version on your machine?

ghost commented 6 years ago

My version is 2.1.2

ghost commented 6 years ago

I tried Package Installer but got errors

PS [censored path]> Install-Package Obfuscar -Version 2.2.11
Install-Package : A parameter cannot be found that matches parameter name 'Version'.
At line:1 char:26
+ Install-Package Obfuscar -Version 2.2.11
+                          ~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Install-Package], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

PS [censored path]> Install-Package Obfuscar
Install-Package : No match was found for the specified search criteria and package name 'Obfuscar'. Try Get-PackageSour
ce to see all available registered package sources.
At line:1 char:1
+ Install-Package Obfuscar
+ ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Ex
   ception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

Problem for me is your documentation is suck and unclear so i tried to do things by myself with no luck

lextm commented 6 years ago

Cannot reproduce that either.

You probably should review your machine to dig further, such as Visual Studio version, NuGet Package Manager version.

ghost commented 6 years ago

Well nvm, i found other way to install the package via Visual Studio. Now how do i get started setting up obfuscator? can i have clear documentation about it?

lextm commented 6 years ago

http://docs.obfuscar.com/en/latest/

bunmalik commented 6 years ago

Please I got the same error: I am using ubuntu 16.04, dotnet version is 2.1.400. When I typed this in the terminal, $ dotnet add package System.Threading.Tasks.Dataflow --version 4.9.0

Writing /tmp/tmpNmBeM9.tmp info : Adding PackageReference for package 'System.Threading.Tasks.Dataflow' into project '/home/bunmalik/Desktop/thesis/codes/cs/PALNS-master (2)/Palns/Palns.csproj'. error: Error while adding package 'System.Threading.Tasks.Dataflow' to project '/home/bunmalik/Desktop/thesis/codes/cs/PALNS-master (2)/Palns/Palns.csproj'. The project does not support adding package references through the add package command.

i got this error... Please I need help on this, I am new to csharp!

chrisp196 commented 6 years ago

I also got this error. My dotnet version is 2.1.400. dotnet add package RestSharp --version 106.3.1

Writing D:\local\Temp\tmpB520.tmp info : Adding PackageReference for package 'RestSharp' into project 'D:\home\site\wwwroot\Microsoft.Bot.Sample.LuisBot.csproj'. error: Error while adding package 'RestSharp' to project 'D:\home\site\wwwroot\Microsoft.Bot.Sample.LuisBot.csproj'. The project does not support adding package references through the add package command.

federico22285 commented 6 years ago

I got as well the same error ... version 2.1.401

ahadGitHub commented 5 years ago

install-package "package name" is a work around.

v-kravets commented 2 years ago

Found this is reproducible using dotnet version 6.0.100 for the project that is .Net Framework v.4.8. When this project is in the state without any package references and you try to add some using dotnet command from command line - it fails with "The project does not support adding package references through the add package command." error. For .Net Standard project command works as expected.

sitting-duck commented 2 years ago

Found this is reproducible using dotnet version 6.0.100 for the project that is .Net Framework v.4.8. When this project is in the state without any package references and you try to add some using dotnet command from command line - it fails with "The project does not support adding package references through the add package command." error. For .Net Standard project command works as expected.

Can confirm, was able to reproduce this on Windows 11, VStudio 2019, .NET Target Framework in the .csproj file was 4.7.2, searched for TargetFrameworkVersion node in the .csproj file to detect this,

<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>

and

> dotnet --version
6.0.201

reveals I am using .NET 6.

Hopefully this will help others check for this condition as well.

nhat3eo22 commented 1 year ago

In Visual Studio, in your project, in References->Manage NuGet Packages->Update your package that make error, and your package will add to references

eaengler commented 1 year ago

I had the same error when using 'await' within an async function when calling an IAsyncOperation method. It was saying my method did not have a definition for 'GetAwaiter'. Could not install the package via the command line dotnet messsage. This fixed all my errors: I went to References > Manage NuGet Packages > Browse "System.Runtime.WindowsRuntime" and make sure it is installed.

image