Installing Microsoft.EntityFrameworkCore.Tools 3.0.0 Prompting "Untrusted Publisher" - asp.net-core-3.0

While performing:
Install-Package Microsoft.EntityFrameworkCore.Tools -Version 3.0.0
To the end of installation, I am getting following prompt:
Executing script file 'C:\Users\phirkabh\.nuget\packages\microsoft.entityframeworkcore.tools\3.0.0\tools\init.ps1'
Do you want to run software from this untrusted publisher?
File C:\Users\phirkabh\.nuget\packages\microsoft.entityframeworkcore.tools\3.0.0\tools\init.ps1 is
published by CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
and is not trusted on your system. Only run scripts from trusted publishers.
[V] Never run [D] Do not run [R] Run once [A] Always run [?] Help (default is "D"):
I chose D (since that is default). but then the Scaffold-DbContext is not working. Reinstalling (after removing) it is not helping. What seems to be going wrong here? Is this a EF Core problem or something else?

Related

after upgrading to .net 5, dotnet cli is unable to load the service index for source https://api.nuget.org/v3/index.json due to SSL connection

I was on Windows 10 working with .net core 3.1. After .net 5 was launched, I upgraded to the new version immediately. I updated my Visual Studio 2019 to version 16.8. Everything worked well in Visual Studio, but when I tried to update dotnet-ef in dotnet cli,
dotnet tool update dotnet-ef -g
I got this error:
C:\Program Files\dotnet\sdk\5.0.100\NuGet.targets(131,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [C:\Users\z\AppData\Local\Temp\eip3wn3x.eys\restore.csproj]
C:\Program Files\dotnet\sdk\5.0.100\NuGet.targets(131,5): error : The SSL connection could not be established, see inner exception. [C:\Users\z\AppData\Local\Temp\eip3wn3x.eys\restore.csproj]
C:\Program Files\dotnet\sdk\5.0.100\NuGet.targets(131,5): error : Received an unexpected EOF or 0 bytes from the transport stream. [C:\Users\z\AppData\Local\Temp\eip3wn3x.eys\restore.csproj]
The tool package could not be restored.
Tool 'dotnetsay' failed to install. This failure may have been caused by:
You are attempting to install a preview release and did not use the --version option to specify the version.
A package by this name was found, but it was not a .NET tool.
The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
You mistyped the name of the tool.
For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool
I also tried to install the dotnetsay but got the same error:
dotnet tool install dotnetsay -g
Before upgrading to .net 5, I was able to install dotnet-ef 3.1 and everything was fine. I guess the issue mighe be caused by an invalid certificate on my local, but not sure, and I don't know which certificate is used for nuget.
Any help is appreciated.
I ran into the same problem with the same setup (win 10, vs 2019 16.8, .net 3.1 -> .net 5.0). For me the solution was to set a registry value as specified by this github comment by wfurt.
The solution copied from that comment:
Set the value Enabled (Dword) to 0 under the key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client
This comment by Gnbrkm41 provides a powershell script to accomplish the same.

How to install Meteor.js on windows 10?

I am trying to install meteor.js on my windows 10 machine.
I have gone through https://www.meteor.com/install for installation. But the site asking me to install chocolatey software https://chocolatey.org/install.
chocolatey is not getting installed since
getExecutionPolicy was returning - restricted.
And on execution of
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
is returning:
The issue is resolved when I tried opening powershell with administrator.
right click on
powershell -> right click -> run as adminstrator
and follow the same procedure as above like setExecutionPolicy.
It will give you now
After installation of chocolatey run command as:
choco install meteor

VSTS build: Packages failed to restore - Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'

I'm getting
Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'.
in VSTS build using Hosted2017 build agent after I upgraded my aspnetcore app to netcoreapp2.0 and my libraries to use netstandard2.0.
Works fine locally.
I've edited my build definition to use .net core build task v2.* preview:
here is the build log:
Current agent version: '2.120.2'
Download all required tasks.
Downloading task: DotNetCoreCLI
Starting: Get Sources
Syncing repository: Liero/vyvojari-sk (GitHub)
...details ommited
HEAD is now at e448a25... Upgraded to .NET Core 2.0
Finishing: Get Sources
Starting: Restore
==============================================================================
Task : .NET Core
Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command. For package commands, supports NuGet.org and authenticated feeds like Package Management and MyGet.
Version : 2.0.5
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?linkid=832194)
==============================================================================
SYSTEMVSSCONNECTION exists true
Downloading: https://dist.nuget.org/win-x86-commandline/v4.0.0/nuget.exe
Caching tool: NuGet 4.0.0 x64
Using version: 4.0.0
Found tool in cache: NuGet 4.0.0 x64
Saving NuGet.config to a temporary config file.
Can\'t find loc string for key: NGCommon_NoSourcesFoundInConfig
NGCommon_NoSourcesFoundInConfig d:\a\1\Nuget\tempNuGet_734.config
"C:\Program Files\dotnet\dotnet.exe" restore d:\a\1\s\src\CommandStack\CommandStack.csproj --configfile d:\a\1\Nuget\tempNuGet_734.config --verbosity Detailed
Restoring packages for d:\a\1\s\src\CommandStack\CommandStack.csproj...
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): error : Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'. [d:\a\1\s\src\CommandStack\CommandStack.csproj]
Generating MSBuild file d:\a\1\s\src\CommandStack\obj\CommandStack.csproj.nuget.g.props.
Generating MSBuild file d:\a\1\s\src\CommandStack\obj\CommandStack.csproj.nuget.g.targets.
Writing lock file to disk. Path: d:\a\1\s\src\CommandStack\obj\project.assets.json
Restore failed in 115.64 ms for d:\a\1\s\src\CommandStack\CommandStack.csproj.
Errors in d:\a\1\s\src\CommandStack\CommandStack.csproj
Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'.
NuGet Config files used:
d:\a\1\Nuget\tempNuGet_734.config
Error: C:\Program Files\dotnet\dotnet.exe failed with return code: 1
Packages failed to restore
******************************************************************************
Finishing: Restore
******************************************************************************
and here is the source code: https://github.com/Liero/vyvojari-sk/tree/e448a25fb8c481704e9102aaaeb8b84b9aee7b02
Update 18/09/2017
Step 2 is no longer needed. I've left it in the solution though as it may still help some people. Thanks, #Liero for point this out.
Original Answer
I've just experienced this problem too and solved it by doing three things:
Use the .NET Core SDK(! - not runtime!) version 2.0.0:
Use the latest NuGet feed (4.3.0):
Restore your packages:
Update
It's worth mentioning here that you should specify where you get your NuGet packages from. Most applications will probably just use the NuGet.org feed, as per the screenshot (see small checkbox), but you may have your custom feeds specified in a NuGet.config file. In that case, tick 'Feeds in my NuGet.config' and then specify the path to that file.
To illustrate the order, this is my working queue:
I hope this helps you and anyone else who has come up against this problem. If you have any questions, let me know. :)
You should select Feed(s) I select here for Feeds to use option. If you leave Use packages from this VSTS/TFS feed empty, packages will be downloaded from https://dist.nuget.org/.
Else, if you want to use Feeds in my NuGet.config as Feeds to use, you should specify the path for your NuGet.config file.
I have received a similar error after generating a project using dotnet new angular which created a project relying on netcoreapp2.0. Inspection of project properties revealed that version 2.0 was not properly recognized (did not appear in the installed framework list).
Solution was to update Visual Studio 2017, as the minimum version required to support netcoreapp2.0 projects seems to be 15.3.1.
What worked for me was installing .NET Core SDK 2.0 and making the following changes:
in .csproj:
change
<TargetFramework>netcoreapp1.1.0</TargetFramework>
to
<TargetFramework>netcoreapp2.0</TargetFramework>
and in global.json:
"sdk": { "version": "1.1.0" }
to
"sdk": { "version": "2.0.0" }
I didn't know how to use Chris Paton' solution
Updating the Visual Studio 2017 to latest 15.4.1 version resolved the problem for me.

Cannot upgrade App to .net Core 1.0.1 on Linux

After upgrading my app to version 1.0.1 like this in project.json:
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
},
This works under Windows but not under Linux.
Under Linux I get this error:
Project BackendGems (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation.
Project test (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation.
The specified framework 'Microsoft.NETCore.App', version '1.0.1' was not found.
- Check application dependencies and target a framework version installed at:
/opt/dotnet_cli/shared/Microsoft.NETCore.App
- The following versions are installed:
1.0.0
- Alternatively, install the framework version '1.0.1'.
SUMMARY: Total: 1 targets, Passed: 0, Failed: 1.
I tried to delete the nuget cache and made sure I have the same SDK version 1.0.0-preview2-003121.
What can possible be wrong?
The change that you have done on the project.json forces your app to run on a runtime version >=v1.0.1 or else fail.
dotnet restore updates the dependencies but not the runtime.
So, you just have to install the 1.0.1 runtime in /opt/dotnet_cli/shared/Microsoft.NETCore.App as the error message states.
Each linux distro has different installation instruction on .NET site, so it may be your case that you can do something like 'apt-get install dotnet-dev-1.0.1'
But for Debian, I had to do it manually:
Get the link and download .NET Core binaries only (v1.0.1) from https://www.microsoft.com/net/download#core
$ wget https://go.microsoft.com/fwlink/?LinkID=825887 -O dotnet-1.0.1.tar.gz
Restore it on /opt/dotnet_cli/shared/Microsoft.NETCore.App
tar zxvf dotnet-1.0.1.tar.gz -C /opt/dotnet_cli/
And now dotnet run works as expected.
EDIT: Looks like MS is updating the download page right now, so you will find the file to download labeled as .NET Core binaries only now (no mention to 1.0.1). But the file is still the same one.

ASP.NET 5 project packages clenaup

I am using latest nightly build during developmant of my ASP.NET 5 project and faced following issue.
During publishing I have all previous versions of packages published instead of just latest (that are specified in project.json).
So if I previously used "Microsoft.AspNet.Mvc": "6.0.0-beta1", "Microsoft.AspNet.Mvc": "6.0.0-beta2", "Microsoft.AspNet.Mvc": "6.0.0-rc1" I'll get all of them published to publish_folder\approot\packages\Microsoft.AspNet.Mvc.
How can I avoid publishing packages that are not used in the project anymore?
There is no issues anymore, I believe this bug fixed by Microsoft already. I've upgraded KVM to latest RC version as well as all packages in the project. To install and upgrade KVM and KRE do the following:
Open PowerShell as Administrator
Run command: "Set-ExecutionPolicy RemoteSigned" and confirm changes, this will allow execution of PowerShell scripts
Clone https://github.com/aspnet/Home repository (in my case it's D:\GitHub\Home)
in PowerShell console navigate to D:\GitHub\Home and run "kvminstall.ps1"
Change default feed URL to dev branch to use latest packages
a. Open "kvm.ps1" for editing
b. Go to line 41 and set feed url: $feed = "https://www.myget.org/F/aspnetvnext/api/v2";
If you skip previous step, you will get beta1 version of packages (on time of writing this post) instead of release candidate
Open command promt (Windows -> Run -> cmd)
Navigate to D:\GitHub\Home
Run "kvm upgrade" (it will download latest version of KRE x86 and set it as default
Run "kvm up upgrade -amd64" to do the same for x64 packages version

Resources