Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all 3151 articles
Browse latest View live

Css and js files are not including into target project when I install my custom Nuget pack

$
0
0

I try to create nuget package from my netstandard 2.1.Package was created successfully and my conect files also include in package folder.

enter image description here

But my problem is When i try to install this package into my client web application, content folder and files and files are included into project wwwroot folder, But all css and js are not physically downloaded in to project solution.

enter image description here

My csproj file look like below

<Project Sdk="Microsoft.NET.Sdk">  
  <PropertyGroup>
    <TargetFramework>netstandard2.1</TargetFramework>
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
    <PackageTags>Lsc.Logistics.HtmlHelpers.Core</PackageTags>
    <AssemblyVersion>1.0.0.0</AssemblyVersion>
    <AssemblyFileVersion>1.0.0.0</AssemblyFileVersion>
    <Version>1.0.0.9-preview0102</Version>
    <Company>Company Name</Company>
    <Authors>Company Owner</Authors>
    <Description>COmmonJs and cssr</Description> 
    <FileVersion>1.0.0.0</FileVersion>
    <PackageOutputPath>D:\ThemeRelease\PackageCore</PackageOutputPath>
    <ContentTargetFolders>contentFiles\any\any\</ContentTargetFolders>
  </PropertyGroup>
  <ItemGroup>
    <Content Include="wwwroot\**\*.*" Label="Packaging">
      <Pack>true</Pack>
      <PackageCopyToOutput>true</PackageCopyToOutput>
    </Content>
  </ItemGroup>
</Project>

What I need to do, to download css and js file, When user install my package


Equivalent of maven dependency tree for nuget

$
0
0

How to list all nuget dependencies, in greate tools like Maven or Gradle I can run simple task like gradlew dependencies etc. I know that nuges is not advanced tool like Gradlew, but should support this basic functionality.

How can I use NuGet packages in my Azure Functions?

After uninstalling NuGet Package, the project still refers it

$
0
0

There are two NuGet packages used in several projects in a solution. Say Package A & Package B. The Package B has dependency with Package A

In a project I have uninstalled Package A and Package B is not uninstalled. But still I can build the project successfully. This project has used classes of Package A directly. How this project without it's reference built successfully ?

When F12 is pressed on the class name from Package A in the project, the file path in metadata file is like this format:

%USERPROFILE%\.nuget\packages\A\1.0.1\lib\net47\Package_A.dll

How to stop the project from referring this dll ?

Is there a c# library or Nuget package similar to matplotlib in python? It can achieve these functions: E.g colormap, colorbar, pyplot, get_cmap [closed]

$
0
0

I used python to achieve these functions. The python program is shown in the following picture: python to implement the functions described above

I have tried these: opencvsharp, Aforge. opencvsharp only has the function applycolormap. There are not many parameters that can be modified by this function. My purpose is to make the picture include more colors and high contrast. The applycolormap function cannot achieve my goal. I chose the parameter jet, but the image generated by the function There are not many colors and low contrast. In addition, the applycolormap function cannot draw a colorbar.

Need to open a readme.md file while nuget installation

$
0
0

Need to open the readme file while nuget is getting installated.Able to add the readme file which is added to the project through the dotnet pack. while unpacking the nugpkg file able to view the readme.md file. but readme.md file is getting opened when the nuget is installed. Tried the same with readme.txt which worked perfectly and opened to readme.txt when nuget was installed.

'<PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <PackageReadmeFile>readme.md</PackageReadmeFile>
    <IsPackable>true</IsPackable>
  </PropertyGroup>
  <ItemGroup>
    <None Include="readme.md" pack="true" PackagePath="." />
    <PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
  </ItemGroup>'

the corresponding .csproj is packed and pushed to custom nuget gallery which is used by another project ,when installting the nuget need to open the readme.md file

Setting up a common nuget packages folder for all solutions when some projects are included in multiple solutions

$
0
0

I have been using NuGet to retrieve packages from external and internal package sources, which is very convenient. But I have realized that the packages are by default stored per solution, which is very frustrating when some projects with NuGet references are included in several solutions. Then the references are changed to other solutions package folder which may actually be unavailable to another developer or build machine.

I have seen that there are ways to point out a common package location (perhaps at the project root level, we are using TFS source control) with the release 2.1 of NuGet, see release notes . I am using NuGet v2.7

But I have tried to add nuget.config files without seeing any effect of this. Packages are still stored in the solution folder. Is there anything I have missed? There seems to be different structures of the xml node to add to the nuget.config file, depending on who is answering that question: Schwarzie suggests on another Stackoverflow thread:

<settings>
  <repositoryPath>..\..\[relative or absolute path]</repositoryPath>
</settings>

The release notes for NuGet 2.1 (see link above) suggests this format:

<configuration>
  <config>
    <add key="repositoryPath" value="..\..\[relative or absolute path]" />
  </config>
</configuration>

I don't know which one of these, or any, or both will work in the end. I have tried both at solution level. Can the nuget.config file be placed on TFS project root level, or must it be in the solution directory? It seems that NuGet reads and applies the settings from these files in a certain order, why it would make sense to add them in several levels, where a nuget.config file on solution level would override one on the TFS project root level. Can this be clarified?

Do I need to remove all installed packages before those references will work? I would love if someone could provide a step-by-step instruction for moving from solution-specific nuget usage to a common package folder where projects that belong to several solutions can find their required nuget packages.

.Net Core 2.2 Package Warning

$
0
0

I have a Web API in .net core 2.2 and 2 i've got a warning with 2 of my packages. the warning says that :

" warning NU1701: Package 'Microsoft.AspNet.Razor 3.2.7' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v2.2'. This package may not be fully compatible with your project."

i've tried different versions of this package but the problem isn't solved...do you know what should i do?

UPDATE: I found that this package is compatible with .net framework but my project is .net core now the question is how to use this package on my project?


NuGet Package - Config File is not Copied to Project

$
0
0

I am trying to create a standard logging tool library for multiple projects. I have created a NuGet package which uses the NLog library. However, when I install this NuGet package onto a project, it does not copy the NLog.config file.

I opened the NuGet package and the NLog.config file is in a contentFiles folder. The project that consumes the NuGet package also uses the PackagePreferences style. In Visual Studio IDE, the NLog.config file has Build Action set to None and Copy to Output Directory set to Copy Always.

What is causing it to not copy over to the project?

NLog.config File Properties:

enter image description here

NLog.config is in contentFiles folder (flat file view):enter image description here

.nuspec file:

<?xml version="1.0" encoding="utf-8"?>
<package >
  <metadata>
    <id>$id$</id>
    <version>$version$</version>
    <title>$title$</title>
    <authors>$author$</authors>
    <owners>$author$</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <license type="expression">MIT</license>
    <description>Standardized logger to be used in all applications.</description>
    <releaseNotes>Initial release of BESI Logger</releaseNotes>
    <copyright>Copyright 2019</copyright>
    <tags>BESI Logger</tags>
    <dependencies>
      <group targetFramework="netstandard2.0">
        <dependency id="NLog" version="4.6.8" />
      </group>
    </dependencies>

    <contentFiles>
      <files include="NLog.config" buildAction="None" copyToOutput="true" />
    </contentFiles>
  </metadata>
  <files>
    <file src="NLog.config" target="contentFiles" />
  </files>
</package>

Consuming Project's .csproj file:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="BESILogger" Version="1.0.26" />
    <PackageReference Include="CsvHelper" Version="12.2.2" />
    <PackageReference Include="morelinq" Version="3.3.2" />
    <PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\BESIData\BESIData.csproj" />
    <ProjectReference Include="..\CSVClient\CSVClient.csproj" />
    <ProjectReference Include="..\EmailClient\EmailClient.csproj" />
  </ItemGroup>

</Project>

How to handle public and private dependencies and packaging in Powershell binary module (.Net Standard & Nuget)

$
0
0

I have a sample project https://github.com/hagatorn/LunarSolarDate which is pre-release so please excuse the lack of finish.

If I build the project I can import the module in the bin directory:

Import-Module .\SolarLunarName.PoSH.dll

However, when run the only command I am presented with an error.

Get-Date | Get-SolarLunarName

Get-SolarLunarName : Could not load file or assembly 'RestSharp, Version=106.6.2.0, Culture=neutral, 
PublicKeyToken=598062e77f915f75' or one of its dependencies. The system cannot find the file specified.
 At line:1 char:12
+ get-date | Get-SolarLunarName
+            ~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Get-SolarLunarName], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,SolarLunarName.PoSH.GetSolarLunarName 

This was relatively easily resolved to pop the missing dll in the bin directory. A less useful message then appeared but adding Newtonsoft.Json.dll and Newtonsoft.Json.pdb to the bin directory moved me onto a problem I will deal with in a separate question.

Manually copying dependencies around worried me a bit so I began to experiment trying to build and deploy with nuget and hope dependencies may be dealt with completely in this model.

Having published the module and its private dependency as a published nuget package I can form the dependencies with the following command.

nuget.exe install SolarLunarName.PoSH 

However, in their initial state the dependencies are logically separated in a directory structure that renders them inaccessible to the binary module.

Is there a better way of doing this as an integrated part of the build or package installation? Can powershell do some package management and use the .deps.json to install the public dependencies?

I have seen another thread discussing forcing msbuild to include extra binaries in the bin directory output by making dummy calls to nested dependencies. Despite the convenience of this solution it seemed a little wrong-headed and contrary to the logic of package management. Dependent DLL is not getting copied to the build output folder in Visual Studio

Also there is the following thread which I which I admit could be the same issue if package management is indeed working correctly and I have misunderstood the problem. PowerShell Binary Module assembly dependency error.

Finally there was another lead regarding tagging your package as "PSModule" I believe I've done this in the visual studio project properties package page. But perhaps this isn't how to achieve that?

Could not load file or assembly 'StackExchange.Redis, Version=1.0.316.0

$
0
0

We are using the latest version of Owin Security RedisTokenProviders but we have problem:

Could not load file or assembly 'StackExchange.Redis, Version=1.0.316.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. .net 4.8

ASP.NET Core - 2.1 to 2.2 Issue

$
0
0

Visual Studio 2017 15.9.18 on Windows 10

I have an ASP.NET Core Project that I need to update the Target Framework from 2.1 to 2.2 After changing the Target Framework, I cleaned an re-built the project.

I now get a compile error saying that says one of the assemblies in my project uses 'Microsoft.AspNetCore.Http.Abstractions, Version=2.1.1.0 which has a higher version than referenced assembly 'Microsoft.AspNetCore.Http.Abstractions' with identity 'Microsoft.AspNetCore.Http.Abstractions, Version=2.0.1.0

In my project dependencies I have Microsoft.NETCore.App 2.2.0 installed. I was going to update this but in package manager the Update button is disabled, saying "Implicitly referenced by an SDK. To update the package, update the SDK to which it belongs." The versions available show they go up to 2.2.8

Using Nuget Package Manager I installed Microsoft.AspNetCore.Http.Abstractions 2.1.1.0 and that seemed to work in debug, but after publishing, my site fails to load.

Should I be manually updating the version of Microsoft.NETCore.App, or is it fine to just update the Microsoft.AspNetCore.Http.Abstractions?

I added the following to my project file:

<PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <RuntimeFrameworkVersion>2.2.0</RuntimeFrameworkVersion>
</PropertyGroup>

I also noticed some invalid sections in my publish profile:

PublishProfile

I also read somewhere that I should add: services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); but SetCompatibilityVersion does not appear as a method.

ildasm on Linux via nuget installation: ildasm executable not found

$
0
0

I installed ildasm on my Ubuntu 18.04 via

nuget install Microsoft.NETCore.ILDAsm

I somehow ended up with two directories:

/home/vagrant/.nuget/packages/microsoft.netcore.ildasm/2.0.8/
/home/vagrant/Microsoft.NETCore.ILDAsm.2.0.8/

but none of them contained any dll or exe:

vagrant@ubuntu1804:~/Microsoft.NETCore.ILDAsm.2.0.8$ ls
LICENSE.TXT  Microsoft.NETCore.ILDAsm.2.0.8.nupkg
Microsoft.NETCore.ILDAsm.nuspec  _rels  runtime.json  THIRD-PARTY-NOTICES.TXT  
version.txt

Where did nuget put the main application, i.e. the equivalent to the ildasm.exe on Windows?

Or am I doing something wrong to install ildasm on Linux?

Azure DevOps pipeline variables in .nuspec files

$
0
0

Is it possible to use Azure DevOps pipeline variables in .nuspec files, which are used for packages creation?

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
  <metadata>
    <id>MyTemplate</id>
    <version>$(var1).$(var2).$(var3)</version>
    <description>
      Some template
    </description>
    <authors>Test Test</authors>
    <packageTypes>
      <packageType name="Template" />
    </packageTypes>
  </metadata>
</package>

Or is it a way to ovveride version specified in .nuspec file(it is required element) by those one in .yaml task?

task: NuGetCommand@2
  displayName: Pack template
  inputs:
    command: pack
    packagesToPack: '**/Template/*.nuspec'
    packDestination: $(Build.ArtifactStagingDirectory)
    versioningScheme: byPrereleaseNumber
    majorVersion: '$(var1)'
    minorVersion: '$(var2)'
    patchVersion: '$(var3)'

But with versioningScheme: byPrereleaseNumber we will get timestamp added to our numbers.

Preparing an agent for the job. Agent not running on Devops

$
0
0

I have a dev ops pipeline that used to work, so that when I push my source code the project builds.

I am using the hosted agents.

However at the moment I get a message

Preparing an agent for the job

An agent is ready for the job Connecting...

An agent is ready for the job

and nothing further happens. If I click Summary I can see that the Build pipeline has not started.

I think that it may have to do with a 3rd party custom nuget package source being offline and am wondering steps to troubleshoot.

Here is the azure-pipelines.yml

    pool:
  vmImage: 'VS2017-Win2016'

variables:
  buildConfiguration: 'Debug'

steps:
- task: DotNetCoreInstaller@0
  displayName: 'Use .NET Core sdk 2.1.5'
  inputs:
    version: 2.1.403


- task: NuGetToolInstaller@0

- task: NuGetCommand@2
  inputs:
    restoreSolution: '**\*.sln'
    feedsToUse: config

    nugetConfigPath: 'MyApi/mynuget.config'


- task: DotNetCoreCLI@2
  displayName: Restore
  inputs:
    command: restore

    projects: '**/Api*.csproj'




#Your build pipeline references an undefined variable named ‘Parameters.projects’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references the ‘BuildConfiguration’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971
- task: DotNetCoreCLI@2
  displayName: Build
  inputs:
    projects: '$(Parameters.projects)'

    arguments: '--configuration $(BuildConfiguration)'


#Your build pipeline references an undefined variable named ‘Parameters.projects’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references the ‘BuildConfiguration’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971

- task: DotNetCoreCLI@2
  displayName: Publish
  inputs:
    command: publish

    publishWebProjects: false

    projects: '$(Parameters.projects)'

    arguments: '--configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory)'

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact'
  inputs:
    PathtoPublish: '$(build.artifactstagingdirectory)'

Here is mynuget.config ( obfuscated)

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <activePackageSource>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
  </activePackageSource>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="3rdparty" value="http://nuget.devweb.3rdparty/nuget" />
    <add key="SBDCommonFeed@Local" value="https://pkgs.dev.azure.com/myproject/_packaging/myfeedFeed@Local/nuget/v3/index.json" />
    <!-- Others -->
  </packageSources>
  <packageSourceCredentials>
    <!-- secret stuff -->
  </packageSourceCredentials>
</configuration> 

I tried commenting out the 3rd party package source in mynuget.config but it did not help.


Package requires NuGet client version '2.12'

$
0
0

I am trying to install 'WindowsAzure.Storage 8.0.1' in visual studio 2012, but getting the error

package requires NuGet client version '2.12' or above, but the current NuGet version is '2.8.60318.667'.

on running command "Install-Package NuGet.Client"

Attempting to resolve dependency 'NuGet.Versioning (≥ 3.5.0)'.
Attempting to resolve dependency 'NuGet.Packaging (≥ 3.5.0)'.
Attempting to resolve dependency 'NuGet.Common (≥ 3.5.0)'.
Attempting to resolve dependency 'NuGet.Packaging.Core (≥ 3.5.0)'.
Attempting to resolve dependency 'NuGet.Packaging.Core.Types (≥ 3.5.0)'.
Attempting to resolve dependency 'NuGet.Frameworks (≥ 3.5.0)'.
Attempting to resolve dependency 'NuGet.Repositories (≥ 3.5.0)'.
Attempting to resolve dependency 'NuGet.RuntimeModel (≥ 3.5.0)'.
Attempting to resolve dependency 'Newtonsoft.Json (≥ 6.0.4)'.
Attempting to resolve dependency 'NuGet.ContentModel (≥ 3.5.0)'.
'NuGet.Client 3.5.0' already installed.

But still I am getting the error.

The 'WindowsAzure.Storage 8.0.1' package requires NuGet client version '2.12' or above, but the current NuGet version is '2.8.60318.667'.

Nuget error while searching NuGet Package

$
0
0

[nuget.org] Unable to load the service index for source https://api.nuget.org/v3/index.json. An error occurred while sending the request. Unable to connect to the remote server A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 152.199.4.184:443

I am able to access the NuGet url through browser. Above error coming only when using it from VS 2017. I am behind the proxy.

I am getting above error message while browsing the NuGet Package. Could anyone help on this?

How to pack a referenced project into a nuget package?

$
0
0

I have a C# solution which contains 3 projects; Application.Server, Application.Client, and Application.Common. Both server and client have a project reference to common.

I want to pack server and client up so that they can be used by other teams in my organisation. I have some automated build pipeline set up that do so, and they publish the nuget packages for server and client. They do not package or publish common. When I inspect the nuget packages, I can see that they reference the common package.

Is there a way that I can get them to build that project into them self? Ideally I don't want to publish the common package as it's pretty specific to my application, and it doesn't really make sense that it's something that's independently consumable by other departments. I also don't want to have to worry about wrangling extra nuget packages if I can help it (as in reality, Common is actually several projects).

NuGet restore fore solution to get wix getting failed in Azure Devops

$
0
0

While running the wpf UI tests the following task 'NuGet restore fore solution to get wix' getting failed in Azure Devops with below errors. Could someone please advise on how to resolve the errors ?

enter image description here

  Installed:
        1 package(s) to packages.config projects
    ##[error]The nuget command failed with exit code(1) and error(Errors in c:\agent\_work\9\s\tests\MediaApp.Wpf.UiTests\MediaApp.Wpf.UiTests.csproj
        Package Appium.WebDriver 3.0.0.2 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package Appium.WebDriver 3.0.0.2 supports: net45 (.NETFramework,Version=v4.5)
        Package Selenium.WebDriver 3.0.1 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package Selenium.WebDriver 3.0.1 supports:
          - net35 (.NETFramework,Version=v3.5)
          - net40 (.NETFramework,Version=v4.0)
        Package Selenium.Support 3.0.1 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package Selenium.Support 3.0.1 supports:
          - net35 (.NETFramework,Version=v3.5)
          - net40 (.NETFramework,Version=v4.0)
        Package Castle.Core 3.3.3 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package Castle.Core 3.3.3 supports:
          - net35 (.NETFramework,Version=v3.5)
          - net40-client (.NETFramework,Version=v4.0,Profile=Client)
          - net45 (.NETFramework,Version=v4.5)
          - sl4 (Silverlight,Version=v4.0)
          - sl5 (Silverlight,Version=v5.0)
        Package Microsoft.Extensions.FileSystemGlobbing 3.0.0 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package Microsoft.Extensions.FileSystemGlobbing 3.0.0 supports: netstandard2.0 (.NETStandard,Version=v2.0)
        Package Microsoft.Win32.SystemEvents 4.6.0-preview8.19405.3 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package Microsoft.Win32.SystemEvents 4.6.0-preview8.19405.3 supports:
          - net461 (.NETFramework,Version=v4.6.1)
          - net472 (.NETFramework,Version=v4.7.2)
          - netstandard2.0 (.NETStandard,Version=v2.0)
        One or more packages are incompatible with .NETCoreApp,Version=v3.0.

    Errors in c:\agent\_work\9\s\src\MediaApp.Wpf\MediaApp.Wpf.csproj
        Package AutoMapper 8.1.0 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package AutoMapper 8.1.0 supports:
          - net461 (.NETFramework,Version=v4.6.1)
          - netstandard2.0 (.NETStandard,Version=v2.0)
        Package Serilog.Settings.Configuration 3.0.1 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package Serilog.Settings.Configuration 3.0.1 supports:
          - net451 (.NETFramework,Version=v4.5.1)
          - net461 (.NETFramework,Version=v4.6.1)
          - netstandard2.0 (.NETStandard,Version=v2.0)
        Package System.Windows.Interactivity.WPF 2.0.20525 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package System.Windows.Interactivity.WPF 2.0.20525 supports: net40 (.NETFramework,Version=v4.0)
        Package Microsoft.Extensions.Configuration 2.2.0 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package Microsoft.Extensions.Configuration 2.2.0 supports: netstandard2.0 (.NETStandard,Version=v2.0)
        Package Microsoft.Extensions.Configuration.Json 2.2.0 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package Microsoft.Extensions.Configuration.Json 2.2.0 supports: netstandard2.0 (.NETStandard,Version=v2.0)
        Package System.Diagnostics.PerformanceCounter 4.5.0 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package System.Diagnostics.PerformanceCounter 4.5.0 supports:
          - monoandroid10 (MonoAndroid,Version=v1.0)
          - monotouch10 (MonoTouch,Version=v1.0)
          - net461 (.NETFramework,Version=v4.6.1)
          - netstandard2.0 (.NETStandard,Version=v2.0)
          - xamarinios10 (Xamarin.iOS,Version=v1.0)
          - xamarinmac20 (Xamarin.Mac,Version=v2.0)
          - xamarintvos10 (Xamarin.TVOS,Version=v1.0)
          - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0)
        Package System.Drawing.Common 4.5.1 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package System.Drawing.Common 4.5.1 supports:
          - monoandroid10 (MonoAndroid,Version=v1.0)
          - monotouch10 (MonoTouch,Version=v1.0)
          - net461 (.NETFramework,Version=v4.6.1)
          - netstandard2.0 (.NETStandard,Version=v2.0)
          - xamarinios10 (Xamarin.iOS,Version=v1.0)
          - xamarinmac20 (Xamarin.Mac,Version=v2.0)
          - xamarintvos10 (Xamarin.TVOS,Version=v1.0)
          - xamarinwatchos10 (Xamarin.WatchOS,Version=v1.0)
        Package System.Management 4.5.0 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package System.Management 4.5.0 supports:
          - net45 (.NETFramework,Version=v4.5)
          - netstandard2.0 (.NETStandard,Version=v2.0)
        Package System.Configuration.ConfigurationManager 4.5.0 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package System.Configuration.ConfigurationManager 4.5.0 supports:
          - net461 (.NETFramework,Version=v4.6.1)
          - netstandard2.0 (.NETStandard,Version=v2.0)
        Package Microsoft.Win32.SystemEvents 4.5.0 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package Microsoft.Win32.SystemEvents 4.5.0 supports:
          - net461 (.NETFramework,Version=v4.6.1)
          - netstandard2.0 (.NETStandard,Version=v2.0)
        Package System.CodeDom 4.5.0 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package System.CodeDom 4.5.0 supports:
          - net461 (.NETFramework,Version=v4.6.1)
          - netstandard2.0 (.NETStandard,Version=v2.0)
        One or more packages are incompatible with .NETCoreApp,Version=v3.0.

    Errors in c:\agent\_work\9\s\tests\MediaApp.Wpf.Tests\MediaApp.Wpf.Tests.csproj
        Package AutoMapper 8.1.0 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package AutoMapper 8.1.0 supports:
          - net461 (.NETFramework,Version=v4.6.1)
          - netstandard2.0 (.NETStandard,Version=v2.0)

NuGet add within Powershell

$
0
0

I'm trying to execute the following NuGet add command via a PowerShell script:

Invoke-Expression "'C:\Program Files\NuGet\nuget.exe' add '\packageName.1.1.0.nupkg' -Source '\\file-server\My Nuget Packages'"

However, I keep running into the following errors:

Invoke-Expression : At line:1 char:36
+ 'C:\Program Files\NuGet\nuget.exe' add '\packageName.1.1.0.nupkg' -Source '\\fil ...
+                                    ~~~
Unexpected token 'add' in expression or statement.
At line:3 char:1
+ Invoke-Expression "'C:\Program Files\NuGet\nuget.exe' add '\packageName.1.1.0.nu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ParserError: (:) [Invoke-Expression], ParseException
    + FullyQualifiedErrorId : UnexpectedToken,Microsoft.PowerShell.Commands.InvokeExpressionCommand

Is there a way to call the Nuget add script from within Powershell? If so, how would I do so?

Viewing all 3151 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>