Couldn't install any packages .Net Framework NuGet - asp.net

I have a solution with a lot of projects targeting .net framework but not any with .core NuGet. The case is that, quite occasionally I started getting the following error while trying to set up any package from manage NuGet packages
HRESULT E_FAIL has been returned from a call to a COM component
Did someone run into the same issue and how you managed to resolve it

Go to your C:\Users\{USER}\AppData\Roaming\Microsoft\VisualStudio folder, and you should find a folder in there called 15_{id}. Open it, and have a look at the ActivityLog.xml. If you have a look in it you should find the error in there and the library that's causing it. In my case it was caused by Microsoft.visualstudio.shell.interop.IVsReferenceManager2 within the Microsoft.VisualStudio.Shell.Interop.11.0.dll library.
This post helped me solve the issue then: Msdn forum
1.Open "Developer Command Prompt for VS 2017" as Admin
2.CD into "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\PublicAssemblies"
3.Run "gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll"
After a restart, it all worked well.
Please Follow the Source
referencemanagerpackage-fails-to-install-vs-2017-community-edition

Related

WinUI - Unable to load DLL 'Microsoft.ui.xaml.dll'

used uno-check to install all the needed prerequisites.
after this i have installed the Uno Platform dotnet templates :
dotnet new -i Uno.ProjectTemplates.Dotnet
and created a new project with this command :
dotnet new unoapp-winui -o MyUnoApp
who give me some errors about failed restoration (MSBUILD : error MSB1009 - project file not exist -)
After that i load the solution in visual studio (2019/2022), select MyUnoApp.Windows.Desktop as starting project (x86) and start the debug session but i got this error:
An unhandled exception of type 'System.DllNotFoundException' occurred in UNO.Windows.Desktop.dll
Unable to load DLL 'Microsoft.ui.xaml.dll' or one of its dependencies
Any hint?
I had the exact same problem, but after fiddling around a bit I found a solution.
Set the '.Windows.Package' project as startup instead of '.Windows.Desktop'
Also make sure you are have the same Platform selected for both Package and Desktop project.
It's my understanding that MyUnoApp.Windows.Desktop is the building target for the Windows desktop, whereas MyUnoApp.Windows.Package is the building target for the UWP app (pls correct me if I'm wrong). Hence, the original poster still would not have the problem of being unable to build the desktop app - which is the same problem I'm facing right now.

How to use aspnet-codegenerator tool for scaffolding in vscode

I'm building an asp.net application using VScode, scaffolding areas using "aspnet-codegenerator" command always fail because of missing files.
I tried to uninstall the tool and reinstall it again, but still the same error
Firstly, please try to check if MvcControllerWithContext.cshtml file does exist under that folder mentioned in error.
Templates file path on my computer
C:\Users\user_name_here\.nuget\packages\microsoft.visualstudio.web.codegenerators.mvc\verison_here(such as 3.1.4)\Templates\ControllerGenerator
Besides, if you indeed installed the dotnet-aspnet-codegenerator tool, but error still occurs, you can try this workaround:
copy Templates/ControllerGenerator and Templetes/ViewGenerator to the project folder
then rebuild the project and run your dotnet aspnet-codegenerator command to generate controller and view etc.

How do I install dotnet framework help files for VS Code

I'm using VS Code to write a dotnet core application. Everything works fine but when intellisense kicks in (or I hover over a system API) I don't get any documentation for those methods. I assume that there is an extension for this? Event the node.js system for VS Code includes documentation.
I must be searching for the wrong terms because I can't even find one discussion about this topic.
UPDATE: July 23, 2020 Thanks omajid. I was actually using some apis from System.IO
While I have the xml docs for many dlls, not that assembly:
System.IO.MemoryMappedFiles.xml
System.IO.Pipes.dll
System.IO.Pipes.xml
System.IO.UnmanagedMemoryStream.dll
System.IO.dll
System.Linq.Expressions.dll
System.Linq.Expressions.xml
System.Linq.Parallel.dll
System.Linq.Parallel.xml
System.Linq.Queryable.dll
System.Linq.Queryable.xml
I guess I'll try to reinstall dotnet.
Also missing the core dll documentation files:
mscorlib.dll
netstandard.dll
After an install I still have the problem. I can find System.IO.xml in other directories for other languages like here:
.//dotnet/sdk/NuGetFallbackFolder/system.io/4.1.0/ref/netstandard1.5/fr/System.IO.xml
.//dotnet/sdk/NuGetFallbackFolder/system.io/4.1.0/ref/netstandard1.5/System.IO.xml
.//dotnet/sdk/NuGetFallbackFolder/system.io/4.1.0/ref/netstandard1.5/es/System.IO.xml
UPDATE July 26: I found part of the issue. One of my libs was netstandard2.0, another was netstandard 2.1. The newer project had help. See the issue https://github.com/dotnet/runtime/issues/39927
UPDATE August 19, 2020: The issue was marked as a duplicate of this issue: https://github.com/dotnet/standard/issues/1527
The documentation is looked up the .xml files that are included in the .NET Core installation.
For each namespace, there's a .xml file as well as a .dll file. For exmaple, in my .NET Core installation, these are the files for System.IO.Pipes:
$ find /usr/lib64/dotnet -iname 'System.IO.Pipes*' | grep 'NETCore.App' | grep -v Access
/usr/lib64/dotnet/packs/Microsoft.NETCore.App.Ref/3.1.0/ref/netcoreapp3.1/System.IO.Pipes.dll
/usr/lib64/dotnet/packs/Microsoft.NETCore.App.Ref/3.1.0/ref/netcoreapp3.1/System.IO.Pipes.xml
/usr/lib64/dotnet/shared/Microsoft.NETCore.App/3.1.5/System.IO.Pipes.ni.{742a0de4-c892-41d7-a15d-0ecd8de52518}.map
/usr/lib64/dotnet/shared/Microsoft.NETCore.App/3.1.5/System.IO.Pipes.dll
/usr/lib64/dotnet/shared/Microsoft.NETCore.App/3.1.5/System.IO.Pipes.pdb
The targetting pack directory (packs/Microsoft.NETCore.App.Ref) contains both the reference assembly (System.IO.Pipes.dll) and also the XML documentation (System.IO.Pipes.xml). It sounds like your distribution of .NET Core is broken if it's missing the XML documentation files.
How did you install .NET Core? Can you re-install it? If the problem still persists, can you share more information about how we can reproduce your environment?
We hit this bug in .NET Core on Fedora Linux a little while ago: https://bugzilla.redhat.com/show_bug.cgi?id=1831310

Publish: Could not find a part of the path … \obj\DEV\AspnetCompileMerge\Source\bin\roslyn\csc.exe'

I recently added the new .NET compiler NuGet packages (Microsoft.CodeDom.Providers.DotNetCompilerPlatfor) to an existing older MVC.NET website. Now when trying to publish the website I get the following exception:
Could not find a part of the path …
\obj\DEV\AspnetCompileMerge\Source\bin\roslyn\csc.exe'
I have tried everything mentioned in this question, but nothing worked. It is, after all, a slightly different problem. The problem mentioned in that post is build exceptions, my solution builds fine locally. Uninstalling the NuGet packages works, but that's not really a solution.
The issue is basically the same as this one, but that also has no solution.
Publish output:
4>------ Publish started: Project: Jdn.ArticleCatalogue.Web, Configuration: DEV Any CPU ------
4>Connecting to \\vm-arcawebdev01\WEBSITES\ArticleCatalogue...
4>Transformed Web.config using D:\DOTNET\Local\Logistics.Web\Portal\DEV\Application Projects\Article Catalogue\Jdn.ArticleCatalogue.Web\Web.DEV.config into obj\DEV\TransformWebConfig\transformed\Web.config.
4>Copying all files to temporary location below for package/publish:
4>obj\DEV\AspnetCompileMerge\Source.
4>C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v / -p "D:\DOTNET\Local\Logistics.Web\Portal\DEV\Application Projects\Article Catalogue\Jdn.ArticleCatalogue.Web\obj\DEV\AspnetCompileMerge\Source" "D:\DOTNET\Local\Logistics.Web\Portal\DEV\Application Projects\Article Catalogue\Jdn.ArticleCatalogue.Web\obj\DEV\AspnetCompileMerge\TempBuildDir" -keyfile "..\..\..\Solution Items\Jdn.LogisticsPortal.snk"
4>ASPNETCOMPILER(0,0): Error ASPRUNTIME: Could not find a part of the path 'D:\DOTNET\Local\Logistics.Web\Portal\DEV\Application Projects\Article Catalogue\Jdn.ArticleCatalogue.Web\obj\DEV\AspnetCompileMerge\Source\bin\roslyn\csc.exe'.
Any ideas on how to solve this one?
This was a known issue whereby the Roslyn binary wasn't being copied correctly to the publish directory. It should be fixed if you install Microsoft.CodeDom.Providers.DotNetCompilerPlatform 1.0.7.
There seem to be some residual issues which are being tracked here.
Same problem accourred to me while publish MVC .NET application to my local path. I solved the problem delete Microsoft.CodeDom.Providers.DotNetCompilerPlatform by nuget package.

sqllite3.dll issues with UWP app development for Mobile

I am trying to learn how to develop apps for UWP for both Desktop and Mobile. I have been currently working on getting the Entity Framework working in my app to store application state and followed the following link:
https://learn.microsoft.com/en-us/ef/core/get-started/uwp/getting-started
It worked well for Desktop, the issue however is that when I try to run it on the Windows Mobile emulator I get the following error in debug mode when the code reaches the db.Database.Migrate() step:
Unable to load DLL 'sqlite3': The specified module could not be found
In the link I pasted above, someone else had the same issue and in the comments they recommended to try the following:
Step 1: Install SQLite VSIX pacakge for Universal Windows Platform development using Visual Studio 2015
https://www.sqlite.org/2016/sqlite-uwp-3130000.vsix
Step 2: Install NuGet package SQLite.NET-PCL
Install-Package SQLite.NET-PCL
Step 3: Add references
Add Reference -> Universal Windows ->Extensions -> Make sure the following packages have been checked: "SQLite for Universal Windows Platform" "Visual C++ 2015 Runtime for Universal Windows Platform Apps"
After that, if you get the error "Payload contains two or more files with the same destination path 'sqlite3.dll', do the following:
copy sqlite3.dll from
C:\Program Files (x86)\Microsoft SDKs\UAP\v0.8.0.0\ExtensionSDKs\SQLite.UAP.2015\3.8.11.1\Redist\Debug\ARM\sqlite3.dll
past to (override it)
C:\Users\%USERNAME%\.nuget\packages\SQLitePCL.raw_basic\0.7.1\build\native\sqlite3_dynamic\winrt81\arm\sqlite3.dll
The problem after doing those steps is that I am now seeing the issue when doing a build for "Payload contains two or more files" however not in the SQLitePCL.raw_basic directory (I don't even seem that have that). Instead my error is the following:
Payload contains two or more files with the same destination path 'sqlite3.dll'. Source files:
C:\Users\admin\.nuget\packages\SQLite\3.13.0\runtimes\win7-x86\native\sqlite3.dll
C:\Program Files (x86)\Microsoft SDKs\UAP\v0.8.0.0\ExtensionSDKs\SQLite.UWP.2015\3.13.0\Redist\Debug\x86\sqlite3.dll
I have been searching everywhere and am truly stumped as to how to get my UWP program working on Mobile. Thanks a lot for your help!
It seems like you got the solution for resolving the exception The specified module could not be found from #Leandro_Medeiros_Machado 's comment on this document. If you got the Payload contains two or more files with the same destination path 'sqlite3.dll' exception after you done the above three steps you may be also found the next solution from the comment.
After that, if you get the error "Payload contains two or more files with the same destination path 'sqlite3.dll', do the following:copy sqlite3.dll from
C:\Program Files (x86)\Microsoft SDKs\UAP\v0.8.0.0\ExtensionSDKs\SQLite.UAP.2015\3.8.11.1\Redist\Debug\ARM\sqlite3.dll
past to (override it)
C:\Users\%USERNAME%\.nuget\packages\SQLitePCL.raw_basic\0.7.1\build\native\sqlite3_dynamic\winrt81\arm\sqlite3.dll
For you, you may need to copy from
C:\Program Files (x86)\Microsoft SDKs\UAP\v0.8.0.0\ExtensionSDKs\SQLite.UWP.2015\3.13.0\Redist\Debug\x86\sqlite3.dll to(override) C:\Users\admin\.nuget\packages\SQLite\3.13.0\runtimes\win7-x86\native\sqlite3.dll.
But actually, for using EF core you don't need the above steps and I recommend you check your environment instead of using the above workaround. I created a simple EF project by following the document and without install the VSIX I can run successfully on the emulator (build 10586). My VS build is 2015 update 3, my OS version is build 14393 and the EF core version is Microsoft.EntityFrameworkCore.Sqlite 1.1.0. So please firstly check if your environment met the following requirements:
Windows 10
Visual Studio 2015 Update 3
The latest version of Windows 10 Developer Tools
And if your EF core and EF core tools versions are right.

Resources