Failed to restore NuGet package - Microsoft.AspNetCore.SignalR - asp.net-core

I'm getting an error message:
Unable to find package Microsoft.AspNetCore.SignalR with version (>=
1.0.0-preview1-27891)
- Found 3 version(s) in nuget.org [ Nearest version: 1.0.0-alpha2-final ]
- Found 0 version(s) in Microsoft Visual Studio Offline Packages MaiPiuSprechi.Web.Core C:\PROGETTI\MaiPiuSprechi\3.4.1\aspnet-core\src\MaiPiuSprechi.Web.Core\MaiPiuSprechi.Web.Core.csproj
Framework: ABP + .NET Core (version 3.4.1)

Answered in this issue: https://github.com/aspnetboilerplate/aspnetboilerplate/issues/2831
Add this file to the same folder as your .sln file: NuGet.Config
NuGet.Config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="aspnetcore-dev" value="https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json" />
</packageSources>
</configuration>

Related

Missing Nuget packages error in ,NET core 3.1 app

I am using VS code and not Visual Studio to run my .NET core 3.1 web app.
I have a .NET core 3.1 app. As I am using an Client VDI machine ( It is using Win 7 SP1 operating system) which is blocking the Nuget.Org URL currently.
so as a work around, I have copied over all the Nuget package into an folder in my VDI and updated the path in the Nuget.Config.
But still I am getting below
Missing Package" error. My App do not DIRECTLY depends on these packages.
following is my Nuget.Config file,
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!-- add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" / -->
<add key="nuget.org" value="C:\NugetPackageDownloadLocation" / >
</packageSources>
</configuration>
any help will be appriciated.
Have you tried adding a package source via the CLI? Given how .NET Core handles transitive dependencies getting all the packages required for a relatively complex solution might be tricky.
nuget sources Add -Name "MyServer" -Source \\myserver\packages

Manage nuget locally in project.json .Net Core

I don't want to rely on nuget service for downloading dependency. I want to download and use nuget packages locally in my .Net Core app. Is it possible?
Approach is the same as was before: open your NuGet.config file and add your local feed (path to local folder with pacakages. See Hosting your own Nuget feed doc):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="AspNetVNext" value="https://www.myget.org/F/aspnetcidev/api/v3/index.json" />
...
<add key="LocalFeed" value="<path to your local folder>" />
</packageSources>
You can modify default NuGet.config file
The default location for NuGet's configuration file is %APPDATA%\NuGet\NuGet.Config (DOS) or $ENV:APPDATA\NuGet\NuGet.Config (PowerShell).
or create your own file in root folder of your solution.

MobileFirst project upgrade fails on Windows 8 appx

I'm trying to upgrade a 6.3 project to 7.1 in Studio and the upgrade keeps crashing and closing the project.
If I remove the windows8 project files from my apps, the upgrade works successfully. I have attached my appx.manifest file in case this helps debug the issue.
10:49:13 AM: [2016-02-09 10:46:18] Adding WLWin8Native reference and AuthWinRT.targets to the Windows 8 project file
[2016-02-09 10:46:21] FWLST1226I: Added Authorization Manager Cordova plugin to config.xml (C:\Users\IBM_ADMIN\MobileFirst71Prototype\MaximoAnywhere\apps\WorkExecution\iphone\native\config.xml).
[2016-02-09 10:46:21] Unexpected error during upgrade: java.lang.NullPointerException at com.worklight.upgrader.upgraders.windows8.AppXManifestUpgrade.upgrade(AppXManifestUpgrade.java:69)
at com.worklight.upgrader.WLUpgradeEngine.executeUpgrader(WLUpgradeEngine.java:368) at com.worklight.upgrader.WLUpgradeEngine.performUpgrade(WLUpgradeEngine.java:301)
at com.worklight.upgrader.WLUpgradeEngine.upgradeProject(WLUpgradeEngine.java:188) at com.worklight.studio.plugin.upgrader.WLUpgraderWorkspaceJob.runInWorkspace(Unknown
Source) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
[2016-02-09 10:46:21] java.lang.NullPointerException
Here's my package.appxmanifest file
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest">
<Identity Name="a02b50fe-bb55-4be5-8bd9-6c2f93cef175" Version="7.5.2.1" Publisher="CN=application's author"/>
<Properties>
<DisplayName>Work Execution</DisplayName>
<PublisherDisplayName>IBM</PublisherDisplayName>
<Logo>images\storelogo.png</Logo>
</Properties>
<Prerequisites>
<OSMinVersion>6.3.0</OSMinVersion>
<OSMaxVersionTested>6.3.0</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="x-generate"/>
</Resources>
<Applications>
<Application Id="App" StartPage="www\default\index.html">
<m2:VisualElements DisplayName="Work Execution" Description="Work Execution" BackgroundColor="#003f69" ForegroundText="light"
Square150x150Logo="images\logo.png" Square30x30Logo="images\smalllogo.png">
<m2:SplashScreen Image="images\splashscreen.png"/>
</m2:VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="privateNetworkClientServer"/>
<Capability Name="internetClient"/>
<Capability Name="picturesLibrary"/>
<DeviceCapability Name="webcam"/>
<DeviceCapability Name="location"/>
</Capabilities>
</Package>
somehow I had some invalid XML in there for my VisualElements elements. Once I fixed the manifest's VisualElements section to look like this, the upgrade went through.
<VisualElements BackgroundColor="#003f69" Description="Inspection" DisplayName="Inspection" ForegroundText="light" Logo="images\logo.png" SmallLogo="images\smalllogo.png" ToastCapable="true">
<SplashScreen Image="images\splashscreen.png"/>
</VisualElements>

How to publish a Asp.net 5 MVC6 website on IIS containing two web apps

I have got a project with two web apps. One of them is only for reference in the base app. The project runs okay in visual studio. I am trying to publish it in local file system and then copy it across to the windows server 2008. Below is the web.config generated by visual studio.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="bootstrapper-version" value="1.0.0-beta4" />
<add key="runtime-path" value="..\approot\packages" />
<add key="dnx-version" value="1.0.0-beta4" />
<add key="dnx-clr" value="clr" />
<add key="dnx-app-base" value="..\approot\src\MySite" />
</appSettings>
</configuration>
When I run this website in Server using dnx . web, it runs okay. But when I try to run it under IIS by pointing IIS to wwwroot then all of the packages go missing. The website is unable to find packages.
Failed to resolve the following dependencies for target framework 'DNX,Version=v4.5.1':
Base32 1.0.0.13
BouncyCastle 1.7.0
CsQuery 1.3.4
EcmaScript.Net 1.0.1.0
EntityFramework 7.0.0-beta4
EntityFramework.Commands 7.0.0-beta4
EntityFramework.Core 7.0.0-beta4
EntityFramework.Relational 7.0.0-beta4
EntityFramework.Relational.Design 7.0.0-beta4
EntityFramework.SqlServer 7.0.0-beta4
EntityFramework.SqlServer.Design 7.0.0-beta4
.........
.........
How did you deploy?
Here are the steps that you can follow to get that running:
Make sure that you the app pool is a .NET 4 app pool
Run, in your web app's project folder dnu publish --runtime <name of runtime> (the name is the name of the runtime folder under %userprofile%\.dnx\runtimes
Step 2 generates a folder that contains the application, its dependencies and the runtime under the bin\debug folder.
Copy that folder to the IIS website folder
Run

NuGet Package Restore does not fetch Build Target Assemblies (Tools)

I added Fody ProperyChanged to two projects in my solution. Package Restore is enabled on the solution. However, the TFS Build Service fails building with the following error:
WindowsUI.csproj (443): The imported project
"SolutionDir\Tools\Fody\Fody.targets" was not found. Confirm that the
path in the declaration is correct, and that the file exists
on disk.
The folder is indeed not there. I could check it into source control, obviously. However, should it not be populated by the NuGet Package Restore? Or am I misunderstanding what NuGet Package Restore does?
I ran into a similar problem trying to get a solution to build on Visual Studio Online.
Problem is that packages are restored before a project build, but before that the project
files and target inclusions from packages (still to be restored) have already been interpreted.
Use the before build hook as described here:
http://sedodream.com/2010/10/22/MSBuildExtendingTheSolutionBuild.aspx
In your before.solutionname.sln.targets file put something like this to force all packages to be restored before even the first project is built:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0"
DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="BeforeBuild" BeforeTargets="Build">
<Message Text="Restoring all nuget packages before build" Importance="high">
</Message>
<Exec Command=".\.nuget\NuGet.exe restore YourSolution.sln" />
</Target>
</Project>
If you have external package sources configure them in your nuget.config file which should
also be in the .nuget folder. For example:
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageSources>
<add key="NuGet official package source" value="https://nuget.org/api/v2/" />
<add key="YourSource" value="http://yoursource.somewhere.net/nuget" />
</packageSources>
<packageRestore>
<!-- Allow NuGet to download missing packages -->
<add key="enabled" value="True" />
<!-- Automatically check for missing packages during build in Visual Studio -->
<add key="automatic" value="True" />
</packageRestore>
</configuration>
As of version 1.13.0.0 (released March 23, 2013) Fody is a 100% nuget deployed tool and as such it will work with package restore.
https://nuget.org/packages/Fody/
This will appear when you install the Fody Nuget
https://github.com/Fody/Fody/blob/master/NuGet/readme.txt
UPDATE: This answer now only applies to versions prior to 1.13.0.0.
The files in SolutionDir\Tools\Fody cannot be deployed through nuget and needs to be checked into source control
You are running into the same issue that I did when I tried to ship a build update in NuGet package. The issue is that NuGet package restore is invoked during the build process. Because of this if NuGet package restore restores a .targets file that is imported, it is restored too late. By the time the file is written to disk the <Import element has already been evaluated and skipped due to the file not being on disk.
The best thing that I have found is to build another project to invoke the package restore for you. In order to smooth this out for my own SlowCheetah NuGet package when the NuGet package is installed I create a packageRestore.proj file in the same director as the .csproj/.vbproj. Then users can build this project file and then the .sln/.csproj/.vbproj. By doing this the NuGet packages are restored and then the build process is kicked off.
If you are interested in using my packageRestore.proj I can re-factor that part of SlowCheetah NuGet package into its own and your NuGet package can depend on that one. Let me know if you are interested in that.