can't install google map control in ASP with NuGet - asp.net

When I click install in the NuGet packages manager the screen looks like it flashes for a split second and does nothing, if I look in installed packages there are no packages installed. However it does add this line to the web.config file
<add tagPrefix="artem" namespace="Artem.Google.UI" assembly="Artem.Google" />
since the package is not installed properly I can't use the artem map control. I have created a new project and installed it fine so it is something in my current project that I need to change that is not allowing me to get it installed. The things I have done so far:
1. Browsed to the packages file in my project and deleted the GoogleMapControl.6.1 folder.
2. Removed the line from the web.config folder.
3. Removed the reference to Artem.Google in my project.
4. Cleared package cache which had google maps file in it.- Manage Nuget Packages - Settings - PackageManager - General - Clear Package Cache.
Then tried to reinstall from manage Nuget Packages - Google Map Control.
Now I click install and it looks like it installs ok has a green tick next to it, then I try and add a :
<div>
<artem:GoogleMap ID="GoogleMap2" runat="server"></artem:GoogleMap>
</div>
GoogleMap is not a know element, no Artem tools in the toolbox and if I go to the package manager and click on installed packages, there is nothing there. So it is not installing fully somehow. Any ideas?

These are the steps I followed to fix the problem
Browse to the packages file in the project and delete the GoogleMapControl.6.1 folder.
Remove the line from the web.config folder.
Remove the reference to Artem.Google in the project.
Clear package cache which has google maps file in it.- Manage Nuget Packages - Settings - PackageManager - General - Clear Package Cache.
Delete the packages.config file
install with the Package Manager Console run:
PM> Install-Package GoogleMapControl -Version 6.1.0
Add <%# Register assembly="Artem.Google" namespace="Artem.Google.UI" tagprefix="artem" %> to top of asp page where the maps will be used.
Add to body of this page.

Related

Severity Code Description Project File Line Suppression State Error The package Newtonsoft.Json with version 12.0.3 could not be found in

I moved a project from one PC to another and compiling the solution I get the following
Severity Code Description Project File Line Suppression State
Error The package Newtonsoft.Json with version 12.0.3 could not be
found in C:\Users\Usuario.nuget\packages,
C:\Microsoft\Xamarin\NuGet. Run a NuGet package restore to download
the package. BusinessLogic
I have already restored it, deleted it, reinstalled it and it continues to appear, what I see is that the routes that tell me there in the error are not on the pc that I brought the project, in the previous one they are
¿but if this is how I can remove these routes or remove this error?
Please check these two options under Tools-->Options
Please enable them first. Then, click Clear Nuget Caches button.
Also, please make sure that you have enabled nuget.org nuget pakage source https://api.nuget.org/v3/index.json.
If not, please add it:
When you finish them all, close VS, delete .vs hidden folder under the solution folder, bin and obj folder.
After that, restart your project and then click Rebuild button.
copying and renaming the database works for me and connection string also need to be updated to the new database name.

VIsual Studio 2017 NuGet package installs well but is not recognized

I have Solution A which has a .NET Core 1.1 class library project. In the Package properties I filled all NuGet fields and selected to create the NuGet upon successful build. This project builds just fine and the NUPKG is created. BTW How can I automatically copy the generated NUPKG to a local directory (my own repository)?
Then I have Solution B which is an ASP.NET Core 1.1 web application. In it I browse to my local repository (where I have manually copied the NUPKG built by Solution A) and install my SolutionA.MyPackage into the web application. VS.2017 says it was successful at installing it. I see it listed in the project's NuGet dependencies.
However, when I try to use ANY of the objects defined in that NuGet package I get a red highlight saying it is not found as if there was no NuGet or assembly reference to that DLL but there is!
What is causing this Visual Studio generated Nuget package to be installed and yet act as if it has not even been referenced?
UPDATE - CSPROJ TARGET
As for copying to my local repository, I added this to CSPROJ but it was not working (somebody had suggested it as I put it). I finally figured out why it did not work, the ItemGroup must be inside the Task.
<Target Name="CopyPackage" AfterTargets="GenerateNuspec">
<ItemGroup>
<MyPackageFiles Include="bin\Release\PackageId.*.nupkg" />
</ItemGroup>
<Copy SourceFiles="#(MyPackageFiles)" DestinationFolder="D:\My Repository\MyNugget\Publish" />
</Target>
UPDATE NuGet Inspection
I opened the NUPKG with NuGet Package Explorer and it shows this more or less:
content\
Properties\
launchSettings.json
Views\
Shared\
rest of my stuff here
contentFiles\
any\
netcoreapp1.1\
Properties\
launchSettings.json
Views\
Shared\
rest of my stuff here
lib\
netcoreapp1.1 (.NEtCoreApp, Version=v1.1)
MyPackage.dll
UPDATE 3
Since NuGet seems to have stopped working (used to work well earlier) I opted for using an Assembly Reference rather than a NuGet (for now). In this situation something odd happens, when coding I can reference ALL the objects in the referenced assembly (former NuGet) and therefore no compilation errors on the main project BUT when I then run the web application I get an internal error because it says
FileNotFoundException: Could not load file or assembly
'MyPackage, Version=0.0.3.0, Culture=neutral, PublicKeyToken=null'.
The system cannot find the file specified.
Unknown location
Which is strange because in the Solution Explorer I see the assembly reference and when I click on it (main application) I can navigate to all the objects that I have defined in that assembly. Why it cannot find it anymore?
It is working again (as it was before!). Today I could open the solutions but when I tried to download an extension (Tools | Extensions) I got an error message about an Access Denied or something like that. It has happened before since I installed to VS.2017.
Of all the Visual Studios I have used since 2002 this has been the most unstable! (and I have update 15.2).
When I saw this error happening again I knew how to get rid of it and thought, "hey, maybe that is what is keeping the NuGet package to be installed but not found or the problem with a direct assembly reference".
So I went to my C:\Users\AppData\USER\Local\Microsoft\VisualStudio\15.2* folder and removed it completely.
After that I the ACCESS DENIED issue went away with the side effect that I had to reinstall all extensions again. I attempted again to install my own NuGet, it did so successfully and as expected (was not happening during the long glitch) the objects were found and the web application worked again.

Package tried to add reference to System.Runtime which was not found in the GAC

ASP.NET 4.5.1 or 4.5.2
Updating Nuget package MicrosoftAspNet.Identity.EntityFramework from version 2.2.1 to version 3.0.0-rc1-final
I get the following error:
Failed to add reference. The package 'Microsoft.AspNet.Identity.EntityFramework' tried to add a framework reference to 'System.Runtime' which was not found in the GAC. This is possibly a bug in the package. Please contact the package
owners for assistance.
I had a similar issue with another package.
I "solved" it adding a manually reference to missed library, updating the package and then removing the reference added manually:
On your project go to References -> Add Reference... and then click on Browse...
On my installation (Windows 10), your file is located on: C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll
Add, update and then remove.
I know, it is not a solution, but it will allow you continue working until get a real solution.
I had the same issue, but adding the MySQL package to my project.
The way that i solved was just very closely to the answer given by Sebastián Guerrero.
So i will be adding a manually reference to that missed library (system.runtime) and than installed the MySQL package and it works perfectly.
ATTENTION: I only unnistall the system.runtime package after installing the MySQL.
References -> Add Reference... and then click on Browse...
On my installation (Windows 10), your file is located on:
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll
I had the same issue when running Install-Package Microsoft.Azure.Management.Fluent on .NET framework 4.5.2
Solved the issue with the following steps:
Installed Microsoft.Rest.ClientRuntime latest version from Nuget.
After that, installed latest version of Microsoft.Azure.Management.Fluent from Nuget.
I had this problem when I opened the project after a while.
The problem was it was originally built with Microsoft.Net.Compilers.2.4.0 and I was on 3.3.1.
The project strangely added two required Imports to the .csproj file, one for the 2.4.0 compiler,and a duplicate for the 3.3.1 version. I just needed to:
Right click on the project file
Unload the project
Edit the csproj file
Remove the 2.4.0 references (was also a reference in an Error element)
Close file
Right click on project, reload file.
Rebuild All

Cannot install web grease via nuget because of permission access

I want to configure bundling to my new project. I have configured my project with TFS online but I cannot add any packages via nuget and always get this error.
The item F:\Project\MOC\packages\WebGrease.1.5.2\lib\WebGrease.dll could not be found in your workspace, or you do not have permission to access it.
The item F:\Project\MOC\packages\WebGrease.1.5.2\tools\install.ps1 could not be found in your workspace, or you do not have permission to access it.
The item F:\Project\MOC\packages\WebGrease.1.5.2\tools\uninstall.ps1 could not be found in your workspace, or you do not have permission to access it.
This maybe a nuget bug with older version. More details ,please refer the thread from GitHub: Install package fails when solution/project is bound to TFS source control
The bug is during uninstalling packages, nuget will delete package
files from TFS, but if user set disableSourceControllntegration to
true, package files are not added to TFS workplace during installing,
so TFS can't find those files during uninstalling,
The fix is to check disableSourceControlIntegration before deleting
package files from TFS.
Source Link: TFS Error "[file]not be found in your
workspace...."
Also suggest you to update your nuget version to latest and try again.

Why can't I delete a package using NuGet?

I installed twitter bootstrap from NuGet, then I figured out I didn't need it anymore. Just for the sake of file size I want to delete this package files from my project folders.
How can I achieve this without deleting important files?
Use Uninstall-Package command:
PM> Uninstall-Package Bootstrap [-ProjectName [Uninstall from this project]]
If ProjectName parameter is omitted, the default project is chosen. Use the -Force
flag to uninstall the package, even if there are dependencies on it.
Hope this helps.
Try the below
Uninstall-Package PackageName
From Nuget Page
The following package elements are removed:
References in the project. In Solution Explorer, you no longer see the library in the References folder or the bin folder. (You might have to build the project to see it removed from the bin folder.)
Files in the solution folder. The folder for the package you removed is deleted from the packages folder. If it is the only package you had installed, the packages folder is also deleted.)
Any changes that were made to your app.config or web.config file are undone.
Another alternative to the command-line via the visual studio interface you can do the following:
Right-click the references folder
Select 'manage nuget packages'
Select 'installed packages'
Select the package you want to uninstall
Press the 'Uninstall button'.

Resources