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

ASP.NET Core misconfigured Nuget package dependency - Unexpected package version warnings

$
0
0

I have an asp.net core project, which was working great few day earlier. I have it on github in a private repo. Yesterday it stopped working after installing an update from VS. I have searched all over the net and github, can't find any solution to this. The image of warning i am getting is attached. The warning description is as follows from Microsoft,

NU1603
Issue A package dependency specified a version that could not be found. A higher version was used instead, which differs from what the package was authored against. This means that restore did not find the best match. Each restore will float downwards trying to find a lower version that can be used. This means that restore goes online to check all sources each time instead of using the packages that already exist in the user package folder.
Common causes The package sources do not contain the expected lower bound version. If the package expected has not been released then this may be a package authoring error.
Example message NuGet.Packaging 4.0.0 depends on NuGet.Versioning (>= 4.0.0) but 4.0.0 was not found. An approximate best match of 5.0.0 was resolved.

I don't know how can i solve this ? it seems there is no solution out there, I have even reinstalled VS, cleared nuget cache, deleted packages from global folder but my solution isn't working.

Any help in regard will be highly appreciated.

VS Warning Message


The local source doesn't exist Migrate from packages.config to PackageReference

$
0
0

I am trying to Migrate from packages.config to PackageReference
I do all steps but always i end up with this error:

The local source 'C:\Program Files (x86)\DevExpress 19.1\Components\System\Components\Packages' doesn't exist

I can't find out why this problem is happend because now i am using DevExpress 19.2
Any suggestion,Thanks in advance. enter image description here

Deploying a self contained React application with Nuget

$
0
0

I am trying to deploy my .net React JS application on another server on Visual Studio 2019 as a self contained package and this is almost working, except for the Nuget dlls which, although present in the deployed files, are supposed to be found on $(USERPROFILE)/.nuget/packages. But this folder is not present on the prod server. My web.config contains this line to start the web site on IIS:

<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" />

So the basic VSIISExeLauncher.exe behavior is to get NuGet file from my initial path $(USERPROFILE)/.nuget/packages. Can I change that ? I was thinking about using "additionalProbingPaths": ["~/***/packages"] in the runtimeconfig.json

Is there any solution to avoid that, or if it is impossible, can I tweak the *.csproj file in order to choose the packages folder ?

Any help appreciated !

Need to list all the versions of a package in my private nuget repo

$
0
0

need to get all the versions of a particular package in my private repo.

tried with some of the links https://www.nuget.org/stats/totals

but not able get an api that lists the set of versions of the package. Looking at my private repo that has nuget implementations,pointing me to the nuget implementation would be helpful.

System.Data.DatasetExtensions is not displayed in the Using namespaces list

$
0
0

I installed System.Data.DataSetExtensions NuGet package in my .Net Standard 2.0 Visual Studio 2019 project. However, DataSetExtensions name space is not available in Using System.Data. namespaceslist. I tried to install different versions of System.Data.DataSetExtensions but result was the same.

enter image description here

This is my project file

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup Label="Globals">
    <SccProjectName>%24/MyWebAPI.DataLayer</SccProjectName>
    <SccProvider>{4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}</SccProvider>
    <SccAuxPath>http://tfsServer:8080/tfs/defaultcollection</SccAuxPath>
    <SccLocalPath>.</SccLocalPath>
  </PropertyGroup>

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
    <PackageReference Include="System.Data.Common" Version="4.3.0" />
    <PackageReference Include="System.Data.DataSetExtensions" Version="4.6.0-preview3.19128.7" />
    <PackageReference Include="System.Data.SqlClient" Version="4.4.0" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\MyWebAPI.BusinessLayer.csproj" />
    <ProjectReference Include="..\MyWebAPI.Interfaces.csproj" />
    <ProjectReference Include="..\MyWebAPI.Logging.csproj" />
  </ItemGroup>
</Project>

Am I doing something wrong? Can anyone please help? Thank you.

How to include a JS file in a NuGet package

$
0
0

I need to create a .NET Standard 2.1 NuGet package that contains a JavaScript file which will be added to my consuming application in the following path:

/wwwroot/js/myFileFromNugetPackage.js

(the consuming application happens to be a Blazor Server app)

I followed one example which used a *.targets file, but it didn't work for me.

The closest I got was to set up my NuGet project as follows:

  1. Create a top level folder named "wwwroot"
  2. Add the file "wwwroot/js/myFileFromNugetPackage.js"
  3. In the properties for that JS file, set "Build Action = Content" and "Copy to Output Directory" = "Copy Always"

I publish this to my private NuGet library.

I then add that package to my Blazor (.Net Core 3.1) application.

When I look in Visual Studio's Solution Explorer, what I see looks promising:

/wwwroot/js/myFileFromNugetPackage.js

However...

If I manually create a new file in the same directory, so I now have:

/wwwroot/js/manuallyAddedFile.js /wwwroot/js/myFileFromNugetPackage.js

When I go to the properties of the two files, I see different paths:

C:{some path}\MyApplication\wwwroot\js\manuallyAddedFile.js

and

C:\Users\{me}\.nuget\packages\{myNuGetPackage}\{version}\contentFiles\any\netstandard2.1\wwwroot\js\myFileFromNugetPackage.js

And unsurprisingly, when I attempt to use either of those JS file using Blazor's JS Interop, I can use the one I manually entered, but it can't find the one from my NuGet package. The F12 developer tools show only the manually created one present on the Client.

So, my question is: How do I set up my NuGet project to write a JS file so that it ends up in the correct directory?

Should I modify my nuget package with a WinForms control for use in a .NET Core 3 application?

$
0
0

I have a nuget package targeting net462 and I want to use it in netcoreapp3.0. It works fine if the package has no dependencies (or has netstandard/netcoreapp dependencies), otherwise dependencies are not resolved at all.

Let's say we have package A targeting net462, which depends on package B, which also targeting net462. I want to use package A in project C, which is netcoreapp3.0. If project C uses package A only, everything works fine. But if it uses something from package B, FileNotFoundException is thrown.

If I understand correctly, I need to add an additional netcoreapp3.0 target to the 'dependencies' and 'files' nodes in both packages A and B. But if I wrong, is there a more appropriate way to make this work?

Anyway what assemblies do I need to add to the 'files' node when targeting netcoreapp3.0?

Same as for net462? Or should I add netcoreapp3.0 to TargetFrameworks in projects A and B and use the resulting ones?

is package.config file really necessary for loading the dll in projects?

$
0
0

is package.config file still really necessary for loading the dll in projects, although the dll references are also there in project file ?

Also is it necessary the nuget dll reference should also needs to be updated in web.config file ? is the project will not work if the web.config nuget dll reference is not done

please clarify ?


Is this NuGet really needed in solution?

$
0
0

how can i tell which NuGet packages are required and which are not?

I got project in asp.net after someone else and there is tun of packages whit i assume is not needed. It there a better way than just deleting it and then checking if the web is working corectly?

Now there is 70 packages installed in the sollution. I am trying to delete all that are not necessary.

Thanks

Copy unmanaged DLL from NuGet package to ASP.NET API

$
0
0

My problem is that I have an unmanaged library in a nuget package that I want to copy in the publish folder of the API that embed it.

Here is a StackoverFlow post that I thought it could work as the final goal seems to be the same as me : Include Unmanaged DLL from Nuget package to web Deploy package And here is how I tried to adapt it to my project :

<Target Name="AfterBuild" DependsOnTargets="CopyFilesToOutputDirectory">
    <ItemGroup>
      <MyPackageSourceFile Include="$(SolutionDir)Assemblies\libwkhtmltox\64 bits\libwkhtmltox.dll" />
    </ItemGroup>
    <Copy SourceFiles="@(MyPackageSourceFile)" DestinationFolder="$(OutputPath)" />
    <Copy SourceFiles="@(MyPackageSourceFile)" DestinationFolder="$(ProjectDir)UnmanagedDll" />
  </Target>

  <Target Name="AddUnmanagedDll" AfterTargets="AfterBuild">
    <ItemGroup>
      <Content Include="UnmanagedDll\*.dll" />
    </ItemGroup>
  </Target>

But it doesn't do anything .

In a more common way I also tried something kind of this :

<ItemGroup>
    <None Remove="Assemblies\libwkhtmltox\32 bits\libwkhtmltox.dll" />
    <None Remove="Assemblies\libwkhtmltox\64 bits\libwkhtmltox.dll" />
  </ItemGroup>
<ItemGroup>
    <ContentWithTargetPath Include="Assemblies\libwkhtmltox\32 bits\libwkhtmltox.dll">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      <TargetPath>Assemblies\libwkhtmltox\32 bits\libwkhtmltox.dll</TargetPath>
    </ContentWithTargetPath>

    <ContentWithTargetPath Include="Assemblies\libwkhtmltox\64 bits\libwkhtmltox.dll">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      <TargetPath>Assemblies\libwkhtmltox\64 bits\libwkhtmltox.dll</TargetPath>
    </ContentWithTargetPath>
  </ItemGroup>

Maybe it could be important to specify that all the projects are in C# .NET CORE 2.1

Please tell me if you want any further information.

Error NU5012 - nuget pack unable to find path (/bin/release/MyProject/bin/release)

$
0
0

I'm trying to update my nuget package by running the command nuget pack -properties Configuration=Release but this gives me the following error:

Unable to find 'bin/Release/{project-name}/bin/Release'. Mae sure the project has been built

I'm not quite sure why it goes to my Release folder and then continues to go down to another Release folder as this doesn't exist? I'm quite lost here, and I'm not sure what to do.

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

How to solve: Nuget Visual Studio 2019 message Project 'Default' not found

$
0
0

I have an SSDT project and I open the Package Manager Console to use nuget to get a dacpac (in the repo already) and I get these errors:

PM> get-Package -ListAvailable -AllVersions -IncludePrerelease 
get-Package : Project 'Default' is not found.
At line:1 char:1
+ get-Package -ListAvailable -AllVersions -IncludePrerelease
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Default:String) [Get-Package], ItemNotFoundException
    + FullyQualifiedErrorId : NuGetProjectNotFound,NuGet.PackageManagement.PowerShellCmdlets.GetPackageCommand

I do not have a project called "default" (the projects are named after the databases they contain) and I cannot see a way to mark a project as Default. OTOH I can and do have a project marked as the startup project.

What is causing this error message and how can I solve it?

OfficeDevPnP.Core.AuthenticationManager.GetAzureADNativeApplicationAuthenticatedContext Only Working for Old SharePointPnPCoreOnline NuGet Package

$
0
0

The code below is based on https://blogs.msdn.microsoft.com/vesku/2016/02/15/connecting-to-sharepoint-online-from-console-application-with-adal-and-pnp-core-component/ and works correctly when used with the NuGet SharePointPnPCoreOnline version 2.19.1710 package.

This would appear to be the last version of the package that works because anything later causes a problem. ctx.ExecuteQuery() throws a “The remote server returned an error: (403) Forbidden.” Exception. A login dialog will appear (post exception) if the console is awaiting input during Console.ReadKey(True). If the Console.ReadKey(True) statement is commented out, no prompt for credentials occurs at all.

Searching the internet, there is no mention of recent usage of GetAzureADNativeApplicationAuthenticatedContext. Anything I've found is going back to the early days. This functionality hasn't been deprecated as far as I can tell. Does anybody know if it is possible to get this working post 2.19.1710?

Sub SharepointOnlineWithAzureADNativeApplicationAuthenticatedContext()
    Try
        Dim clientId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
        Dim url = "https://MySite.sharepoint.com/S/ICT"
        Dim redirectUrl = "https://MyTenant.onmicrosoft.com/Test"

        Dim auth = New AuthenticationManager()
        Using ctx = auth.GetAzureADNativeApplicationAuthenticatedContext(url, clientId, redirectUrl)
            Dim Web = ctx.Web
            ctx.Load(Web)
            ctx.ExecuteQuery()
            Dim title = Web.Title
            Console.WriteLine("Title is {0}", title)
        End Using
    Catch ex As Exception
        Console.WriteLine("Fail: {0}", ex.Message)
    End Try

    Console.WriteLine("Press a key...")
    Console.ReadKey(True)
End Sub

Deploy WPF Application with squirrel.windows and no windows 10 entry in Program & Features

$
0
0

The goal is to deploy with squirrel.windows, to can install, update, uninstall and to see it in Program & Features in Windows 10. To have add the end also a MyApp.msi file would be a plus.

Case 1: I created a NugetPackage with the Nuget Package Explorer. Than releasify it over the Package Manager Console "squirrel --releasify myNuget.1.0.0.nupkg", get the release files, click setup.exe to install and the icon of the app appears in the windows menu.

In the Windows Program & Features it doesn't appear in the list of installed Applications.

The update is working when I deploy a next nugetPackage of my app. It creates a myApp.msi file which is nice.

Case 2: When I use the Squirrel App on GitHub "https://github.com/Squirrel/Squirrel.Windows" it shows it. - Super.

The update is not working when I deploy a next nugetPackage of my app. It creates not a myApp.msi file.

With the small testApp it is working with absolutely the same code, but also no myApp.msi file. The difference is that it uses DevExpress Dll's and it has 54 Dll's in the production app. There are 13 Dll's in myTestApp.

Install & Update Code

public static async Task CheckForUpdates()
{
    using (var mgr = new UpdateManager(DEPLOYMENT_PATH))
    {
        // Note, in most of these scenarios, the app exits after this method
        // completes!
        SquirrelAwareApp.HandleEvents(
            onInitialInstall: v => mgr.CreateShortcutForThisExe(),
            onAppUpdate: v => mgr.CreateShortcutForThisExe(),
            onAppUninstall: v => mgr.RemoveShortcutForThisExe(),
            onFirstRun: () => ShowTheWelcomeWizard = true);
    }
}

public static bool ShowTheWelcomeWizard { get; set; }

Please help me to reach my goal.

Greetings Fredy


Suppress Console.Write in referenced package

$
0
0

In one project, I reference a NuGet package which outputs text to the Console when some of its methods are called.

I would prefer it didn't, as I am writing things to the Console in my own code.

Is there a way to suppress the Console writing happening in that package, but still be able to write to Console myself?

How does msbuild resolve assembly from a multi-framework nuget package?

$
0
0

I have a solution with a console app ConsoleApp-net461 that references a library ClassLibrary-net452.

Both projects reference a multi-framework nuget package NuGetPackage-net452-net461.

When I build, I end up with the nuget package's net461 dll in the output folder. At runtime, I am getting errors like:

System.TypeLoadException: Inheritance security rules violated by type: 'ClassA'. 
Derived types must either match the security accessibility of the base type or be less accessible.

I am suspecting this is because my ClassLibrary-net452 ends up having a dependency on the nuget package dll with the net461 framework.

Is this normal behavior? What are the best ways to ensure the net452 dll is resolved from the nuget package? BindingRedirects don't seem to let you choose a target framework.

How to convert a UIPath Workflow into a Activity or create a Custom Activity?

$
0
0

I have a workflow which have two parameter as input. One is Log File Path and the Other is message in UI Path. I can use this workflow as by 'Invoke Workflow' activity but i want a custom activity where can i directly use the workflow by giving the dependency to the project.

I have seen that we can convert it into a nuget package and use it but not sure how can i do that.

There is not code involved.

I expect the an activity should be coming up in the activity panel instead of using the invoke workflow activity.

Error code -532462766 when using FunctionMonkey

$
0
0

I'm trying to follow the "Build elegent REST APIs" for a project.

When I get to the section where you build and run it, I get the error:

Severity Code Description Project File Line Suppression State Error MSB3073 The command "dotnet "C:\Users\ext-patrik.ek.nuget\packages\functionmonkey.compiler\3.0.17\build\netstandard1.0....\tools\netcoreapp2.1/FunctionMonkey.Compiler.dll""C:\Users\ext-patrik.ek\source\repos\ServerlessHSAzureFunctions\ServerlessHSAzureFunctions\bin\Debug\netcoreapp2.1\bin\ServerlessHSAzureFunctions.dll" --netcore21" exited with code -532462766. ServerlessHSAzureFunctions C:\Users\ext-patrik.ek.nuget\packages\functionmonkey.compiler\3.0.17\build\netstandard1.0\FunctionMonkey.Compiler.targets 21

Now, I've been trying to find out what the issue is and when I open it up, it goes to the Function Monkey.Compiler.targets and highlight this set of code in an XML file:

<!-- we ensure the functions post build has run first -->
      <!--<Target Name="_FunctionMonkeyCompiler" AfterTargets="Build">-->
      <Target Name="_FunctionMonkeyCompiler" AfterTargets="_GenerateFunctionsPostBuild">
        <Exec Command="$(FunctionCompilerExe) $(FunctionCompilerParams)" />
      </Target>

So, My question is: What could be the issue here?

ASP.NET CORE GIVES A WARNING This package may not be fully compatible with your project

$
0
0

I am working on an asp.net core project and i have installed a nuget package which is in .net framework. but on rebuild it gives the following error:

warning NU1701: Package 'Microsoft.AspNet.WebApi.Core 5.2.3' 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=v3.0'. This package may not be fully compatible with your project.

should i converted the package into dot net standard ? or is there anything else

Viewing all 3154 articles
Browse latest View live


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