MvcScaffolding doesn't work with EF4.1-Update - asp.net-mvc-3

I recently installed the EF4.1-Update. When I made a new MVC3 Project and tried to add the MvcScaffolding using the PackageManagerConsole in VS2010 it wouldn't install it. Has anyone else
seen this? I removed the EF4.1-Update from my machine and MvcScaffolding installs correctly.
thanks,
Bill44077

You might have to clean out the packages folder in your solution and reinstall the MvcScaffolding. Once you do this everything should sync back up.
Good luck and hope this helps some.

It does work. And it works beautifully
But I had some issues getting it all setup.
What error(s) did you get exactly I had a number of issues, but solved them one by one.
Did you get this sort of thing in PMC when VS started up?
The following error occurred while loading the extended type data file: Microsoft.PowerShell.Core, C:\Windows\SysWOW64\WindowsPowerShell\v1.0\types.ps1xml(2943) : Error in type "System.Security.AccessControl.ObjectSecurity": Exception: Cannot convert the "Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase" value of type "System.String" to type "System.Type".
If so either update .net Refelector (now costs), or go Tools > Add-In Manager and disable the .NEt Reflector add in ! THEN RESTART VS
Or if you try to scaffold something, do you get e.g.
Invoke-Scaffolder : A parameter cannot be found that matches parameter name -ModelType"
?
Do you get errors when you try to add a controller to your MVC 3 project?
Are you running on Windows (pre 7) + without powershell 2.0 installed?
Basically don't worry it does work, I think the order or installations matters, just work through it bit by bit, its worth it.

Did you try reinstalling the update after the scaffolding is installed? I already had the scaffolding installed when I installed Update 1, so i did not see a problem.

I've had this problem before when the scaffolding.config file was either not present, or not filled with the Default Scaffolders -- make sure its populated with the default entries for views, controllers, etc. I think there is 9 by default in version 1.0.9.
Old post I know but this is still relevant in project templates and autogenerated projects -- the scaffolding.config needs to have its defaults.

Related

How do I manually remove a nuget package for .Net MAUI

I'm in the process of migration a XamarinForms 5 app to MAUI and the latest error I get is
The Java type `mono.android.support.v4.media.session.MediaSessionCompat_OnActiveChangeListenerImplementor` is generated by more than one managed type
Searching online, so far I think it is because the app is using Android.Support.V4 when it should only be using AndroidX, causing the duplicate to be generated as AndroidX replaces Support.V4.
However I cannot figure out how to remove the Support.v4 package because the only reference to it is an implicit reference by an SDK which I cannot remove ( see screenshot below)
The project file (MAUI) only has these package references
Any help greatly appreciated.
Thanks
I'll answer my own question as I managed to figure out the issue after a solid several hours long session.
No packages needed to be removed. Somehow I had managed to install a version of
Birdie.Plugin.FirebasePushNotification from 2020 , instead of `Plugin.FirebasePushNotification', the current version.
The solution was to remove that old package and install the correct once which made the error go away.

Method not found: 'Void EntityFrameworkCore.Design.Internal.DbContextOperations

I am trying to scaffold and getting following error:
There was an error running the selected code generator Method not found: 'Void EntityFrameworkCore.Design.Internal.DbContextOperations
https://learn.microsoft.com/en-us/ef/core/get-started/aspnetcore/existing-db?view=aspnetcore-2.0#install-entity-framework
I suspect you are missing the assemblies that are necessary for scaffolding? I also assume you are trying to reverse engineer an existing db?
example
Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
if it fails like i can't find it might be a pmc issue, try closing down VS try again. After that its probably a configuration with missing assemblies.
It may be the Microsoft.EntityFrameworkCore.Design version issue. Update it to version 2.0.3. It worked for me.
I got this error too when trying to add a new controller. The day before I had upgraded both Microsoft.EntityFrameworkCore.SqlServer and Microsoft.EntityFrameworkCore.Tools Nuget Packages from version 2.0.2 to 2.1.3.
Downgrading both packages to 2.0.2 allowed me to scaffold a new controller again.
Saeef's error is from trying to create CRUD razor pages, not creating the domain classes from an existing database
I had the same problem. I had two instances of VS2017 (enterprise & developer edition) for some reason I updated only one of them. The shourtcut on my desk was the 'out of date version' so I didnt figure it out until now.
I uninstalled the older, updated the other to 15.8+ and it works fine now.

Visual studio complains about spatial types

I have these CLR types installed on my local https://puu.sh/yEWG5/b4f77fba7b.png
Also, I have SQL server 2016 installed on my local system but when I try to run the project I get error as below
https://puu.sh/yEWQm/78a4220830.png
Can someone help? I tried installing latest nugget package from https://www.nuget.org/packages/Microsoft.SqlServer.Types/ but it did not help.
Though I am able to add a column of type geography in a table in my local database. It fails at runtime when I run my project and error comes as below
https://puu.sh/yEWQm/78a4220830.png
According to the docs if you have installed the CLR Types it should load from the GAC so I'm not sure why that didn't work for you. (I would check that you have the correct version as your dependency)
However, we do use the SQLServerTypes in our app without installing the CLR types by using the following method (this method is described in the readme.htm that comes with SqlServerTypes).
Grab the SqlServerTypes.nupkg and extract it to a folder lets call this folder SST from now on.
(Locations of the files I talk about in the following steps may differ from version to version but, the principle is the same)
Create a SqlServerTypes folder in your project
Copy the SST/nativebinaries/x86 and x64 folders into your new SqlServerTypes folder
Also copy the files from SST/content (you should see Loader.cs and readme.htm) into the SqlServerTypes folder.
Now all you need to do is call the Loader when your app boots up.
We do this during our autofac setup by making this call.
Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory)
You may need to adjust the param passed into this method to work with your application. If the correct path is used you should have access to the spatial types in your code.
edit: It may be possible to just call the LoadNativeAssemblies straight away (and avoid all the work I posted above) if you have installed the nuget package in your app but, I have not tested this as we are stuck on an old version of SqlServerTypes.
Because i cannot put a comment i have to put a answer, you can check that, that article and this, this, this and this answers, i hope they guide you to someting usefull.

Visual Studio 2015 RC1 - Manage Nuget packages for solution

When opening the Nuget Package Manager in VS2015RC1 on the solution level and filtering on installed/update available I get a list of all available packages within my solution.
But when I try to upgrade a package it has ALL projected within the solution selected by default which is not what I want since we have a large solution with many projects and I obviously don't want to add say JQuery to all of them.
And due to the large number of projects I cannot go through each and update the projects individually.
Anybody else having the same problem? Or am I missing something.
EDIT:
There were no error, the ACTION dropdown need to be changed to Update instead of Install. Sorry about this guys.
Change the Action combobox value from install to Update/Upgrade
Switch to filter Update Available
I reported such issue which was fixed
https://github.com/NuGet/Home/issues/806
What happens if you try the console? Type on the search "console" and open package manager console at the bottom and then click restore.
This is a bug - We fixed this for RTM

500 Internal Server Error after installing VS10sp1-KB983509

When I tried to use an Ajax control toolkit, I get a grey out error and searching around they said installing VS10 Service pack could help to solve the problem. So I did install it and now I got a serious problem:
I can no longer load the website that I can load normally before, it shows this error:
Server Error. 500 - Internal server error.
I tried many ways and finally found this one looks quite close to what happened to me:
http://support.microsoft.com/kb/842329
And I tried what it suggested:
go to C:\Windows\system32\mcfc42.dll-> properties\security\Edit\Add
Added:
Iwam_computername or computername\Iwam_computername
Also added:
Everyone
Allow Full control to all.
Restart server. But still the same problem. Please help me to fix this problem, unfortunately my server did not install backup option before I install VS SP1 so I could not recover to the previous point. Any solution ? If I cannot access it, no way I can code and test my website...
I found the solution for this. At first, to narrow down the problem I load the website at server side (not at client side) then I see this error lines in my web.config file, I think when I click at property at project in VS and choose .net 4.0 then back to 3.5 it add some duplicate to my web.config file. I just add all the first lines related to .net 3.5 and keep the xml format correct then it works fine now! Many thanks !!

Resources