Visual Studio - Nuget - Unable to load the service index for source - visual-studio

This is my NuGet.config :
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
<disabledPackageSources>
<add key="Microsoft and .NET" value="true" />
</disabledPackageSources>
</configuration>
Now, in Visual Studio, when I try to install 'geckofx45' package, I get the following error:
install-package geckofx45
install-package : Unable to load the service index for source https://api.nuget.org/v3/index.json.
At line:1 char:1
+ install-package geckofx45
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Do you have any solutions?

Visual Studio - Nuget - Unable to load the service index for source
This is a common error, we could not get much useful info from this error message. We could only provide the troubleshootings for this issue.
The reason for this issue in most cases is because the network issue or the incorrect configuration in the nuget.config.
In order to make sure that whether this issue is related to the VS IDE, the network or others, first, please open the path of the nuget server https://api.nuget.org/v3/index.json in the browser. If you can open it in the browser, this issue probably more related to the VS IDE/nuget.config. You can delete nuget.config in the %appdata%\Nuget, then restart the Visual Studio to generate the new nuget.config.
Second, if you also could not open it in the browser, this issue probably related to the network issue, you should check if you have proxy variable http_proxy in our system variables or in the IE browser, we could test it on another PC with same network. if you have the proxy settings in your PC, you can remove it to test it or you can add proxy settings into Nuget.Config file. Refer to this link for details: Nuget Config Section & Nuget Proxy Settings. After we confirm we do not have any proxy in our PC, then we should to check if our network is limited. We could test it with a different net work.
See the same issue for some more details.

dotnet restore --interactive solved issue for me.

Tested on Windows 7
Step1: Open Command window (run cmd) Step 2: Run the following commands to enable TLS 1.2 support if it is disabled (adding REGISTRY Entries):
"HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" /v DisabledByDefault /t REG_DWORD /d 0 /f /reg:32 reg add
"HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" /v DisabledByDefault /t REG_DWORD /d 0 /f /reg:64 reg add
"HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" /v Enabled /t REG_DWORD /d 1 /f /reg:32 reg add
"HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" /v Enabled /t REG_DWORD /d 1 /f /reg:64

For me the issue was solved moving to another VS version. It did not work on VS 2022 but it did in VS 2019

nuget restore
and
msbuild /t:restore
both didn't work for me. But
dotnet restore
worked perfect. Try that

Related

Azure windows VM extensions are provisioning failed state VM agent is "Ready" but Backup failed at VM running State GuestAgentSnapshotTaskStatusError

Backup is failing for Azure VM with error - GuestAgentSnapshotTaskStatusError
Azure Backup service could not communicate with the VM Agent for triggering a snapshot (to take a backup), because the VM Agent might be in an inconsistent state.
Guest Agent is in a Ready state, however, the backup extension is in a failed state. the issue is that the VM agent is ready but the VM extensions are in provisioning failed state they are as follows
1.AzureDiskEncryption
2.enablevmaccess
3.MicrosoftMonitoringAgent
4.WindowsAgent.AzureSecurityCenter
Solution :
You would need to re-install the Backup extension. Please follow the below action plan:
Take Backup of whole Registry then use below steps :
1.Login to the affected machine.
Open Registry Editor.
Remove VMSnapshot registry keys at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Azure\HandlerState
Remove or rename VMSnapshot Plugin Folders at C:\Packages\Plugins.
Now, open command prompt as admin and run below commands to force the extension installation :
REG ADD "HKLM\SOFTWARE\Microsoft\BcdrAgent" /v IsProviderInstalled /t REG_SZ /d False /f
REG ADD "HKLM\SOFTWARE\Microsoft\BcdrAgentPersistentKeys" /v IsCommonProviderInstalled /t REG_SZ /d False /f
6.Restart the Service "WindowsAzureGuestAgent".
7.Trigger a manual backup. As a part of backup, extension will be re-installed automatically.

What is setting AutoAdminLogon to 0 (MSS-Legacy)

I am having an issue getting AutoAdminLogon working with my Windows Server 2008 R2 Image. It is an Amazon Windows Server 2008 R2 CIS Level 2 Benchmark AMI from the Amazon Marketplace.
The issue I am having is when I set the AutoAdminLogin to 1 and do a gpupdate or reboot it reverts back to 0.
I am using Packer to provision my AMI so the steps I am going through are Remove PowerShell 3.0 then reboot. The AutoAdminLogon is set before the reboot but gpupdate runs when the system restarts gpupdate reverts the setting back to 0.
The AutoAdminLogon is needed because the server needs to reboot several times during the provisioning.
Steps are
1. Remove PowerShell 3.0
2. Reboot
3. AutoAdminLogon
4. Install .Net 4.5.2
5. Install Windows Management Framework 5.1
6. Reboot.
At this point, Packer will try to connect using WINRM to finish provisioning the instance to capture as an AMI.
I know it has something to do with the MSS-Legacy settings applied to the AMI. But how do I un-apply them? Or just the AutoAdminLogin set to Disabled?
I have tried using secedit:
secedit /export /cfg c:\temp\secpol.cfg
(gc C:\temp\secpol.cfg).replace('AutoAdminLogon=1,"0"','AutoAdminLogon=1,"1"') | Out-File C:\temp\secpol.cfg
secedit /configure /db c:\windows\security\secedit.sdb /cfg c:\temp\secpol.cfg
Reference: Modify Local Security Policy using Powershell
I have tried the steps listed here: https://docs.bmc.com/docs/tssa89/rollback-of-cis-and-pciv2-templates-after-remediation-does-not-work-808908846.html
Here is also a link to the Script I have modified to do the PowerShell Upgrade:
https://github.com/jborean93/ansible-windows/blob/master/scripts/Upgrade-PowerShell.ps1
Now if I download the MSS-Legacy GPO templates and use the GUI to set the MSS: (AutoAdminLogon) Enable Automatic Logon (not recommended) to Enabled,
It will work and the setting will stick after reboots or gpudpate. But I need a way to do this in a scripted manner because there is no interaction with the Instance during the Bakery process.
I cannot do the steps using a GUI as this is part of our AMI bakery process.
Thanks so much I look forward to seeing peoples thoughts.
I've just come across this "fun"!
I used the PolicyFileEditor PowerShell module and a lot of trial and error, coupled with the information in your question (thanks for that!) to get this working.
My OS is Windows Server 2016, so hopefully it also works for Windows Server 2008 R2 (not that anyone should be using that anymore).
Here's the PowerShell code that I'm using in my Packer build:
Install-Module PolicyFileEditor
Import-Module PolicyFileEditor
# Change the Autologon GPO setting
Set-PolicyFileEntry -Path "$env:windir\system32\GroupPolicy\Machine\registry.pol" -Key "Software\Microsoft\Windows NT\CurrentVersion\Winlogon" -ValueName "AutoAdminLogon" -Data "1"
# Force the policy update to occur
gpupdate /force
# Configure the auto login user and password so that the next restart has autologin
$loginPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
Set-ItemProperty -Path $loginPath -Name "DefaultUserName " -Value "<your_admin_user>" -Type String
Set-ItemProperty -Path $loginPath -Name "DefaultPassword" -Value "<your_admin_password>" -Type String
There's also another registry value that you need to specify which is the AutoLogonCount. AutoAdminLogon is directly correlated to the logon count for how many times the system will automatically logon after a reboot.
If your logon count is not set, this may be the reason why it's resetting to 0.
If you want this to be set infinitely, just set it 999999 or something ridiculously high.
You can refer to this MSDN for more information:
MSGina.dll
Note that the Type for AutoLogonCount should be REG_DWORD
Instead of having to restart the computer, you can try the following command:
# Force the policy update to occur w/o restart
echo N | gpupdate.exe /target:Computer /force

VS2010 : Unable to start debugging Cannot locate Microsoft Internet Explorer

i have created a simple silverligth project and when i tried to start debugging i had this errror :
"Unable to start debugging.
Cannot locate Microsoft Internet Explorer."
i have searched on the internet and i have found two solutions:
The first one :
"Navigating to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths I found that theiexplore.exe key was missing. So here's what I did:
Added the iexplore.exe key to the registry.
Changed the (Default) REG_SZ value to C:\Program Files\Internet Explorer\iexplore.exe
Added a new REG_SZ value called Path and set it to C:\Program Files\Internet Explorer
Restarted my Visual Studio.
"
This doesn't work, the iexplore.exe key is here.
(default) REG_SZ C:\Program Files (x86)\Internet Explorer\IEXPLORE.EXE
Path C:\Program Files( x86)\Internet Explorer;
the second is to right click into the aspx file and select "Browse With ..", and set internet explorer as default.
Is already that ...
I have launched older project in silverlight, and i have the same problem ...
i think i got this bug because i have installed IE9 ...
anyone can help me ?
Thanks
Found the answer:
Navigating to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\App Paths I found that the iexplore.exe key was missing.
So here's what I did:
Added the iexplore.exe key to the registry.
Changed the (Default) REG_SZ value to C:\Program Files\Internet Explorer\iexplore.exe
Added a new REG_SZ value called Path and set it to C:\Program Files\Internet Explorer
Restarted my Visual Studio.

How to uninstall / completely remove Oracle 11g (client)? [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 months ago.
Improve this question
How to uninstall / completely remove Oracle 11g (client)?
deinstall.bat doesn't work.
Edit: Further discussion related to why this question was closed and deleted: https://meta.stackexchange.com/questions/190441/why-was-this-question-related-to-uninstalling-the-oracle-database-client-deleted
Assuming a Windows installation, do please refer to this:
http://www.oracle-base.com/articles/misc/ManualOracleUninstall.php
Uninstall all Oracle components using the Oracle Universal Installer (OUI).
Run regedit.exe and delete the HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE key. This contains registry entires for all Oracle products.
Delete any references to Oracle services left behind in the following part of the registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Ora* It should
be pretty obvious which ones relate to Oracle.
Reboot your machine.
Delete the "C:\Oracle" directory, or whatever directory is your ORACLE_BASE.
Delete the "C:\Program Files\Oracle" directory.
Empty the contents of your "C:\temp" directory.
Empty your recycle bin.
Calling additional attention to some great comments that were left here:
Be careful when following anything listed here (above or below), as doing so may remove or damage any other Oracle-installed products.
For 64-bit Windows (x64), you need also to delete the HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ORACLE key from the registry.
Clean-up by removing any related shortcuts that were installed to the Start Menu.
Clean-up environment variables:
Consider removing %ORACLE_HOME%.
Remove any paths no longer needed from %PATH%.
This set of instructions happens to match an almost identical process that I had reverse-engineered myself over the years after a few messed-up Oracle installs, and has almost always met the need.
Note that even if the OUI is no longer available or doesn't work, simply following the remaining steps should still be sufficient.
(Revision #7 reverted as to not misquote the original source, and to not remove credit to the other comments that contributed to the answer. Further edits are appreciated (and then please remove this comment), if a way can be found to maintain these considerations.)
There are some more actions you should consider:
Remove Registry Entries for MS Distributed Transaction Coordinator (MSDTC)
Note: on the Internet I found this step only at a single (private) page. I don't know if it is required/working or if it breaks anything on your PC.
Open Regedit
Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\MSDTC\MTxOCI
Add an x before each string for OracleOciLib, OracleSqlLib, and OracleXaLib
Navigate to HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\MSDTC\MTxOCI
Add an x before each string for OracleOciLib, OracleSqlLib, and OracleXaLib
Otherwise these files, if they exist, will still be in use next time you reboot, and unable to be deleted.
Remove environment variable ORACLE_HOME, ORACLE_BASE, TNS_ADMIN, NLS_LANG if exist
Check also Oracle doc to find all Oracle related environment variables, however apart from variables listed above they are very rarely used on Windows Client: Oracle Environment Variables
Unregister oci.dll
Open a command line window (Start Menu -> Run... -> cmd)
Enter regsvr32 /u oci.dll, resp. %windir%\SysWOW64\regsvr32 /u oci.dll
In some cases the file %ORACLE_HOME%\bin\oci.dll is locked and you cannot delete it. In such case rename the file (e.g. to oci.dll.x) and reboot the PC, afterwards you can delete it.
Remove Oracle .NET assemblies from Global Assembly Cache (GAC). You do this typically with the gacutil utility, if available on your system. Would be like this:
gacutil /u Policy.10.1.Oracle.DataAccess
gacutil /u Policy.10.2.Oracle.DataAccess
gacutil /u Policy.1.102.Oracle.DataAccess
gacutil /u Policy.1.111.Oracle.DataAccess
gacutil /u Policy.2.102.Oracle.DataAccess
gacutil /u Policy.2.111.Oracle.DataAccess
gacutil /u Policy.2.112.Oracle.DataAccess
gacutil /u Policy.2.121.Oracle.DataAccess
gacutil /u Policy.2.122.Oracle.DataAccess
gacutil /u Policy.4.112.Oracle.DataAccess
gacutil /u Policy.4.121.Oracle.DataAccess
gacutil /u Policy.4.122.Oracle.DataAccess
gacutil /u Oracle.DataAccess
gacutil /u Oracle.DataAccess.resources
gacutil /u Policy.4.121.Oracle.ManagedDataAccess
gacutil /u Policy.4.122.Oracle.ManagedDataAccess
gacutil /u Oracle.ManagedDataAccess
gacutil /u Oracle.ManagedDataAccess.resources
gacutil /u Oracle.ManagedDataAccessDTC
gacutil /u Oracle.ManagedDataAccessIOP
gacutil /u Oracle.ManagedDataAccess.EntityFramework
Entry System.Data.OracleClient should not be removed, this one is installed by Microsoft - not an Oracle component!
Instead of gacutil /u ... you can also use OraProvCfg /action:ungac /providerpath:... if OraProvCfg is still available on your system. You may find it at %ORACLE_HOME%\odp.net\managed\x64\OraProvCfg.exe.
With a text editor, open XML Config file %SYSTEMROOT%\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config and delete branch <oracle.manageddataaccess.client>, if existing.
Do the same with:
%SYSTEMROOT%\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config
%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319\Config\machine.config
%SYSTEMROOT%\Microsoft.NET\Framework64\v4.0.30319\Config\web.config
%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319\Config\web.config
Instead of editing the XML Config file manually you can also run (if OraProvCfg.exe is still available on your system):
%ORACLE_HOME%\odp.net\managed\x64\OraProvCfg.exe /action:unconfig /product:odpm /frameworkversion:v4.0.30319
%ORACLE_HOME%\odp.net\managed\x86\OraProvCfg.exe /action:unconfig /product:odpm /frameworkversion:v4.0.30319
%ORACLE_HOME%\odp.net\managed\x64\OraProvCfg.exe /action:unconfig /product:odp /frameworkversion:v4.0.30319
%ORACLE_HOME%\odp.net\managed\x86\OraProvCfg.exe /action:unconfig /product:odp /frameworkversion:v4.0.30319
Check following Registry Keys and delete them if existing
HKLM\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\ODP.Net
HKLM\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\ODP.Net
HKLM\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\Oracle.ManagedDataAccess
HKLM\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\Oracle.ManagedDataAccess.EntityFramework6
HKLM\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\odp.net.managed
HKLM\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\Oracle.DataAccess.EntityFramework6\
HKLM\SOFTWARE\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\ODP.Net
HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\ODP.Net
HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\Oracle.ManagedDataAccess
HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\Oracle.ManagedDataAccess.EntityFramework6
HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\odp.net.managed
HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\Oracle.DataAccess.EntityFramework6\
HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Application\Oracle Data Provider for .NET, Managed Driver
HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Application\Oracle Data Provider for .NET, Unmanaged Driver
HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Application\Oracle Provider for OLE DB
Delete the Inventory folder, typically C:\Program Files\Oracle\Inventory and C:\Program Files (x86)\Oracle\Inventory
Delete temp folders %TEMP%\deinstall\, %TEMP%\OraInstall\ and %TEMP%\CVU* (e.g %TEMP%\CVU_11.1.0.2.0_domscheit) if existing.
Do everything suggested by ziesemer.
You may also want to remove from the registry:
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\<any Ora* drivers> keys
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers<any Ora* driver> values
So they no longer appear in the "ODBC Drivers that are installed on your system" in ODBC Data Source Administrator
Do everything suggested by ziesemer.
You may also want to :
Stop the Oracle-related services (before deleting them from the
registry).
In the registry, look not only for entries named "Oracle"
but also e.g. for "ODP".

error MSB3216 when registering assembly

Here are the error details:
In the Error List:
Error 1 Cannot register assembly "C:\Users\cboardman\Documents\Visual Studio 2008\Projects\ExcelAddIn1\ExcelAddIn1\bin\Debug\ExcelAddIn1.dll" - access denied. Please make sure you're running the application as administrator. Access to the registry key 'HKEY_CLASSES_ROOT\ExcelAddIn1...' is denied. C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets 3019 9 ExcelAddIn1
In the Build Output:
Target UnmanagedRegistration:
C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(3019,9): error MSB3216: Cannot register assembly "C:\Users\cboardman\Documents\Visual Studio 2008\Projects\ExcelAddIn1\ExcelAddIn1\bin\Debug\ExcelAddIn1.dll" - access denied. Please make sure you're running the application as administrator. Access to the registry key 'HKEY_CLASSES_ROOT\ExcelAddIn1...' is denied.
Done building target "UnmanagedRegistration" in project "ExcelAddIn1.csproj" -- FAILED.
From what I have found online, I need to be running Visual Studio as administrator. This seems like a big hammer for a small nail. Is there a way around this (like a way to run just the registration as administrator)?
Unfortunately there is not an easy way to do this. By default registering the components adds entries to protected keys in the registry (under HKLM in particular). This cannot be done without administrative rights.
It is technically possible to register COM components as a non-admin by using the equivalent keys under HKCU. However it is not a trivial change and I do not believe the .Net tools which register the assemblies can be configured to do this.
I think your best option is to disable registration during build. Then have a separate Admin window open where you can hand register the DLL From for debugging purposes. The re-registration is only really necessary if you change the COM related interfaces or location of the DLL so it doesn't have to be done for every F5.
Closing Visual Studio and re-opening right-clicking on it -> Run as Administrator solved the problem for me.
I had this same problem with Visual Studio 2017.
JaredPar's answer led me to this implementation:
Goto the project's properties
Select Build
Untick Register for COM interop screenshot
Select Build Events
add a Post-build event command line:
for /f %%a in ('dir %windir%\Microsoft.Net\Framework\regasm.exe /s /b') do set current_regasm="%%a"
set command=%current_regasm% $(TargetPath) /tlb:$(TargetDir)\$(TargetName).tlb /codebase ^; sleep 2
set elevated_command="Start-Process PowerShell.exe -Wait -ArgumentList \"-ExecutionPolicy Bypass -Command %command%\"
powershell -noprofile -ExecutionPolicy Bypass -Command %elevated_command% -Verb RunAs"
In the drop-down run the post-build event: select: On successful build screenshot
Run a build
At the end of the build you will see a powershell window run as administrator (depending on your settings you may have a User Account Control (UAC) popup asking you to confirm before it will run).
Note:
This will find the latest .NET framework version and use regasm from there (credit: Scott C).
Increase the ; sleep 2 if you want longer to look at the output to confirm the registration (or use ; pause instead).

Resources