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

Microsoft.Solver.Foundation .net standard

$
0
0

Does anybody know if a .net standard version of the Microsoft.Solver.Foundation is going to be available or if it is going to be open sourced?

We are using it in our backend service and would like to convert the service to .net core and to do it I guess we need to have a .net standard version of the nuget package.


Temporarily disable git from watching file changes

$
0
0

Context:

We have a Visual Studio project that depends on a nuget package (A Visual Studio thing).

We upgrade our project with that nuget package every time we release a new version of that package.

The project is stored in git and we clone the project to get a local copy so we can start the upgrade from Visual Studio itself through nuget updates.

A colleague complained/noticed that the upgrade would take about 30 or so minutes, and it started off the question of why it was so slow.

After some prodding around, it seemed that when removing git from the root folder and thus essentially untracking all files, the upgrade went 10 minutes faster.

We then all did the same and sure enough it was roughly 10 minutes faster.

As a mitigation we have been copying the project into another folder thus not having git whizzing away in the background, and once the project has finished uploading, we put the project back into the original folder and then git picks up on the changes made in one big hit.

Question:

Is there a way to temporarily disable git from recording changes while the upgrade occurs and then enabling it after the upgrade is done so that it can re-assess the files changed after? My understanding of the situation is that git is probably writing every minor change that occurs while nuget is download and installing the new package to the project.

NB

I write this from an uncertain stand point. Okay, removing git makes it faster, but of course, i am unsure of what really is happening under the hood... so the question may be a bit moot in terms of git. But if we can figure it out, across the company it would save so much time!

Integrate forms into C# WinForms project via NuGet package

$
0
0

I am building a NuGet package for a WinForms control demonstrating how to use it. As such, I need to add some sample forms into the target project when my NuGet package is being installed. If the name of my sample form is Form2 and I integrate it into a default C# WinForms project, I get the following result in the solution explorer:

Problem integrating form into C# WinForms project via NuGet

As you can see, the Form2 is not added to the target project correctly. And really, if we look into the .csproj file, we'll find the following records for the code parts of the Form2:

<Compile Include="Form2.cs">
    <SubType>Form</SubType>
</Compile>
<Compile Include="Form2.Designer.cs" />

, while the correct record for the Form2.Designer.cs file should be

<Compile Include="Form1.Designer.cs">
    <DependentUpon>Form1.cs</DependentUpon>
</Compile>

(the same problem for Form2.resx).

What is interesting, VB forms are integrated into VB projects from a NuGet package without any problems, and this issue looks like a C#-specific NuGet issue.

Is there any way to solve this problem for C#?

error: Unable to find package [packageName] as a dependency

$
0
0

I am trying to add reference to nuget package A which has a dependency to nuget package B. and when I use the command

dotnet add package to add the package reference to package A. I get following error:

error: Unable to find package B. I was not able to find any package called B in at least the same nuget stream. I thought the entire point of nuget packages is that they are self contained and can be referenced individually.

Since I am not able to find the package in the same Nuget server, I have no idea where to look for it. Also, I do have access tot he source code of Package A and the .csproj file there has Project reference to project B. I have no idea where, along the line it because a nuget reference.

Is there anything that I should be doing that I am not doing here? How can I resolve this issue?

How to create Nuget Package of Multi Tier application in C# .Net Core?

$
0
0

I am trying to create Nuget package for a .net core 2.0 project that uses layered architecture. The Visual Studio solution has more than 2 tiers.

I can create Nuget package with dotnet pack. However, when I try to install the Nuget package that I created, I get error and the installation rollback. I guess, the dotnet pack command is not able to pack all the dependencies.

Currently, this is a major blocker for me as I won't be able to proceed without fixing this. Has anyone had similar experience?

Nuget package error in Visual Studio 2017

$
0
0

I'm getting an error in Visual studio 2017 when I build the solution.

"The package ComponentAce.Compression.Libs.zlib with version 1.0.4 could not be found in C:\Users\.nuget\packages. Run a NuGet package restore to download the package.".

My code is in .net 4.7.2 (C#,WPF)

I tried to install/uninstall/rebuild/clean and I also completely removed any references to that package in my code. Nothing's working. Any idea what's the issue here?

Installed nuget package is missing files

$
0
0

I'm using a nuget in my project which is supposed to have a namespace called ChartJs.Blazor.ChartJS.Common.Time in the version 0.10.4. For some reason, it tells me the namespace doesn't exist. I'm 100% certain that it does, here's why:

  • I published that nuget myself and tested it.
  • When downloading the nuget from nuget.org and inspecting the nupkg-file by opening it with 7-zip, I can find the dll used for the nuget in the folder lib. If I copy that dll outside the nupkg and reference it directly (instead of the nuget), it all works perfectly fine and the code compiles.
  • I also looked at the dll (extracted mentioned above) with ILSpy and could confirm that the namespace and its files do in fact exist.

There is absolutely no sign of the absence of these files anywhere.

Since I did some manual testing with the same package version but the package contents were actually different, I suspect caching issues. However, I already tried a few things which helped me previously with a similar issue but none of them worked this time:

  • Delete the corresponding folder in %userprofile%\.nuget\packages
  • Delete all bin and obj (and .vs) folders.
  • Delete all temporary files (using the built-in windows tool)

FYI, there's nothing of interest at %appdata%/NuGet.

Does anyone know what the issue could be and how it can be resolved? The current workaround is to directly include the dll but that isn't great.

Ps. The installed NuGet version is 5.1.0.6013 but I'm usually just working with Visual Studio 2019 where nuget is integrated.

EDIT:
The library which is consumed via nuget is targetting netstandard2.0 (standard library). The consuming project is targetting netcoreapp3.0 (asp.net core ss-blazor). This alone should not be an issue.

dotnet restore not using PackageReference condition

$
0
0

my project has multiple target frameworks, 2 of the package reference need to use a different version for .net461

enter image description here

when building in VS 2017 everything works and the dependency shows using the right versions.

enter image description here

but when build using dotnet cli, the dependency shows the wrong version is being use for .net461. is this a bug in dotnet cli?

enter image description here

I also try putting those 2 pkg in another ItemGroup tag with condition but still the same

update: for anyone else running in to this issue, I ended up using <Choose> with <when> condition to fix this.. so look something like this.

  <Choose>
<When Condition=" '$(TargetFramework)' == 'net461' ">
  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" Version="7.0.1" />
    <PackageReference Include="RestSharp" Version="105.2.3" />
  </ItemGroup>
</When>
<When Condition=" '$(TargetFramework)' == 'net451' ">
  <ItemGroup>
    <PackageReference Include="RestSharp" Version="105.0.0" />
    <PackageReference Include="Newtonsoft.Json" Version="7.0.1" />
  </ItemGroup>
</When>
<Otherwise>
  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
    <PackageReference Include="RestSharp" Version="106.2.1" />
  </ItemGroup>
</Otherwise>


I have successfully installed an AspNetCore.Reporting nuget package for report generation but it’s not providing with report generation option

$
0
0

I want to generate reports in my project created using asp.net core.

I have tried installing AspNetCore.ReportViewer package as well.

I expected the installed package to provide me with a "RDLC" (report generation) option under new item creation, instead it's not giving any option like this. No change is observed in the environment even after the installation of these packages.

How to use hangfire in .net core with mongodb?

$
0
0

I want to use Hangfire for background jobs in registration form process,But I am unable to find Startup.cs file code for Hangfire.mongo.

Including PSGallery nuget dependency in Visual studio solution

$
0
0

Problem

How to share postbuild Powershell Script in multiple solution so that each solution can invoke the script in post build event?

Solution Approach

  • Created a local PSGallary

  • Pushed my script into the gallery

  • In the VS, added the new PSGallary as a nuget Source
  • Pulled the postbuild script as the nuget package in the solution

Now i am stuck. The script is saved outside the solution in a nuget folder like this. enter image description here

I don't want to hardcode the path of the script since, the versions changes and so does the path. How can i get the path of the actual nuget package content in post build event without hard coding it? is there other better approaches ?

Prevent embedding interop types in nuspec package file

$
0
0

I've created a nuget package for an interop library. When using this package, Nuget automatically sets "Embed Interop Types" to "True".

However, in my project this should be "False".

Is there a way in Nuget to specify that interop types should not be embedded?

CascadingAuthenticationState and NotFoundContent tags not working in Blazor

$
0
0

So I've been following this tutorial for implementing authorization/authentication on my blazor client app (asp.net core hosted). Everything worked ok until I started working on client side ("Configuring client-side Blazor" subtitle in the tutorial). I've successfully installed Blazored.LocalStorage nuget package. But I'm failing at adding "CascadingAuthenticationState" and "NotFoundContent" components to my App.razor file. The compiler can't see these componnents and asks to add using directives.

Here's the _Imports.razor:

@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.JSInterop
@using Musical_WebStore_BlazorApp.Client
@using Musical_WebStore_BlazorApp.Client.Shared
@using Microsoft.AspNetCore.Authorization
@using Blazored.LocalStorage

Here's the App.razor that's not working (and I'm asking to help me to get it working):

<CascadingAuthenticationState>
    <Router AppAssembly="typeof(Program).Assembly">
        <NotFoundContent>
            <p>Sorry, there's nothing at this address.</p>
        </NotFoundContent>
    </Router>
</CascadingAuthenticationState>

Here's the App.razor that was working (I had it by default):

<Router AppAssembly="@typeof(Program).Assembly">
    <Found Context="routeData">
        <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
    </Found>
    <NotFound>
        <LayoutView Layout="@typeof(MainLayout)">
            <p>Sorry, there's nothing at this address.</p>
        </LayoutView>
    </NotFound>
</Router>

Here are the versions of the projects:

Blazor.Client (Microsoft.AspNetCore.Blazor nuget package): 3.0.0-preview9.19465.2

ASP.NET Core (Microsoft.AspNetCore.Blazor.Server nuget package): 3.0.0-preview9.19465.2

Shared: .NET Standard 2.0 library

How do I solve this problem? It looks like these components should be available by default. And even if not, I couldnt find the namespace for these components on the internets.

How do I publish NuGet packages to GitHub Package Registry using dotnet on Mac?

$
0
0

The documentation is not complete and currently I cannot consume or publish package to GPR using dotnet on Mac. Any help would be useful

How to publish .Net code as Nuget Package

$
0
0

I have created a class library project using VS 2019. I need to publish it as nugget package so the user can access it. Need guidance to achieve it. Thanks in Advance!!


.Net Standard 2.0 Generate NuGet package including projects in the same solution and NuGet packages

$
0
0

I've read some questions similar to mine here, but they were answered about a year ago, the idea is to check if is there any news regarding this.

Assuming that i have a solution with the following structure:

  • DotNetSolution

    • DotNetProjectReferencingSubProjects (this project is the one for generating nuget package)
    • ProjectA
    • ProjectB
    • ProjectC

      -NugetPackageInsideProjectC

Structure Explanation

The idea of this project is to retrive documents from public/private clouds, but i wanted to make the call transparent to the caller, so i architeture the solution like this:

  • CloudHandler.Library.csproj
  • CloudHandler.Services.Factory.csproj
  • CloudHandler.Plugin.Aws.csproj
  • CloudHandler.Plugin.PrivateCloud1.csproj
  • CloudHandler.Plugin.Gcp.csproj
  • CloudHandler.Plugin.PrivateCloud2.csproj

CloudHandler.Library.csproj references CloudHandler.Services.Factory.csproj

CloudHandler.Services.Factory.csproj references

  • CloudHandler.Plugin.Aws.csproj
  • CloudHandler.Plugin.PrivateCloud1.csproj
  • CloudHandler.Plugin.Gcp.csproj
  • CloudHandler.Plugin.PrivateCloud2.csproj

CloudHandler.Plugin.Aws.csproj references AWSSDK.S3

When I pack CloudHandler.Library or even CloudHandler.Services.Factory, the project that use this references throws an exception, because it can't find AWSSDK.S3 reference.

How do I pack DotNetProjectReferencingSubProjects including all references? (projects and NuGet packages that those projects reference to?)

Thanks in advance.

I've read some ideas that sugest to add csproj files and it's referenced on nuspec. Thinking about maintaining the project in the future, it will be hard for someone with no knowledge to figure it out.

What if two nuget package point to the same Dll

$
0
0

Ok. So I have one solution with three projects

  1. Project-A.csproj(turned into A.nupkg)
  2. Project B.csproj(turned into B.nupkg)
  3. Utils.csproj

Since utils.csproj has a lot of central functions both A and B have reference to utils.dll as a project reference. So basically when I go to /bin folder of either A or B I can see utils.dll. So far so good.

Now, I have another project. LEt's call it consumer.csproj which does reference both A.nupkg and B.nupkg in the same order mentioned. Also, Utils.dll has some functions which expects certain .json files which it does expect to be at certain location.

Now, when I reference A.nupkg first, it does bring in utils.dll with it and then my consumer project knows that it needs to go to /A/lib when running code does ask for utils.dll. which was OK until when my consumer project did call some B.nupkg functionality which in turn called, utils.csproj functionality which was looking for some json files in a.nupkg/lib folder because now everytime utils.csproj is called, compiler just goes to A.nupkg folder looking for it.

Is there anything I am doing wrong here? If not, what can I do to resolve this issue

Now I

NuGet is returning 503 Server Unavailable

$
0
0

Is there a way to load a package from an alternative server when Visual Studio Package Manager (NuGet) is responding with a "The remote server returned an error: (503) Server Unavailable" message?

Microsoft.NETCore.Platforms could not be installed because it is not compatible with any of your project

$
0
0

I am trying to install Microsoft.NETCore.Platform package from NuGet packages which is needed for system.text.encoding.codepages but I am getting an error as:

Microsoft.NETCore.Platforms could not be installed because it is not compatible with any of your project

Conditional reference in Visual Studio Community 2017

$
0
0

I am creating a multi-platform application. I have a multi-targeted shared library (targeting .netstandard 2.0 and .net 4.5)...See project file:

  <PropertyGroup>
    <TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
  </PropertyGroup>

When I build the project in visual studio 2017 on windows, I get two directories in the output (netstandard2.0, net45) and the corresponding dlls. The build is a success.

When I build the exact same project (same code) in visual studio 2017 on a mac, I get errors of this nature:

The type 'OptionAttribute' exists in both 'CommandLine.DotNetStandard, Version=1.0.30' and 'CommandLine, Version=1.9.71.2'

I conditionally referenced a command line parser library in the following way:

  <!-- CommandLineParser library -->
  <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
    <PackageReference Include="CommandLine.DotNetStandard">
      <Version>1.0.3</Version>
    </PackageReference>
  </ItemGroup>

  <ItemGroup Condition="'$(TargetFramework)' == 'net45'">
    <PackageReference Include="CommandLineParser">
      <Version>1.9.71</Version>
    </PackageReference>
  </ItemGroup>

This works great for windows, but on the mac it appears it is not observing the condition. Is this a known bug for visual studio on mac? Am I doing something wrong?

Viewing all 3194 articles
Browse latest View live


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