Error while trying to scaffolding identity pages in a Blazor WASM app - identity

When scaffolding adding new identity pages (right click on project > Add > New Scaffold Item > Identity) I get an error after I select the pages and click the add button:
There was an error running the selected code generator: package restore
failed. Rolling Back Package Changes...
I have 3 projects in the solution: client, server and shared. I am trying to scaffold in the server project.
I have cleared nuget cache and rebuilt the solution but that did not work. I have also deleted the bin and obj files and restarted VS.
This is easily reproducible by creating a new Blazor WASM solution, select .NET 5, ASP.NET hosted, individual accounts. Right click on the server project > Add > New Scaffold Item > Identity > select pages > click Add.
Any Ideas?

I assume you have installed the NuGet package Microsoft.VisualStudio.Web.CodeGeneration.Design.
The thing is that every time that you scaffold an item it updates Microsoft.VisualStudio.Web.CodeGeneration.Design and Microsoft.EntityFrameworkCore.SqlServer NuGets to the latest version, so you need to update all related to Entity Framework packages as well (to be compatible).
Also a Data folder with ApplicationDbContext.cs is created inside your Identity folder:
and if you already have this ApplicationDbContext class on another place in your solution, there will be a collision.
For me that was the problem: I had this file on two places - in ProjectName.Areas.Identity.Data.ApplicationDbContext.cs and in ProjectName.Data.ApplicationDbContext.cs and I couldn't scaffold another item, it worked just for the first one.
So when the ProjectName.Areas.Identity.Data.ApplicationDbContext.cs was deleted, the scaffolding worked again as usual.

Related

Why do I have no intellisense in my app.config?

I want to add an appSettings section to my app.config, but I am not getting any intellisense. The IDE also has the configuration node underlined and says The configuration element is not declared when I mouse over it, so I wonder if these two issue are related. It does this when I create a new app.config and even when I create an entirely new project. I only have this issue in VS 2019. VS 2010 has intellisense, so something tells me it's a VS setting that points to a reference file containing all the elements available to intellisense.
Why do I have no intellisense in my app.config?
I think your project is created by the old VS2010 version and then migrate into the new VS2019 and the old project type is quite different from VS2019. So there are some factors in your old project which impact intellisense.
You can try these steps:
1) close VS Instance, delete .vs hidden folder, bin, obj folder, then restart your project to test again.
2) open menu XML-->Schemas-->find the entry for DotNetConfig.xsd,select Use this schema and then click OK.
3) If this does not work, please try to add a new app.config file to replace the old file and then migrate its content into the new file.

Android Studio Gradle error: Missing project_info object

basically opening this question again because the answer is outdated, as the link now redirects to Firebase:
Gradle fails building with "Missing project_info object"
I want to attach the google-services.json file to my Android Studio project, and every time I try to download it from the developers API from Google, it gives me a json file with a large name that does't correspond to the tutorial's simple "google-services" and renaming it won't work because of this error.
Downloading it creating a new project doesn't seem possible for me now as it the page gives me another error when I click Configure a Project (I already did that before but left the project there without downloading the json file directly from there, which seems to be the problem).
Where can I safely get this file, and should I rename it or? Thanks in advance.
Apparently the solution is just following the link and creating the project with Firebase:
Then create or select a project and fill it with your app data that shoul look like this (the SHA-1 key should be found in your console log when clicking the button in the image:
Then add the lines of code that should be in your build.gradle(app level one and project level one), editing them with notepadd. Finally you need to sync these Gradle files, in Android Studio : File->Sync project with Gradle Files
The tutorial is very self explatanory, but for beginners like me, this could help.

AX2012 - How to unlink business logic from report?

I'm creating a new SSRS report in AX2012. At first, I added some Data Methods through Visual Studio, but later I found another way to get what I wanted without using those data methods. Consequently, I deleted the Data Methods and the Business Logic project.
Now, everytime I build the report, I get a warning :
Could not resolve 'projectname' from the AOT. If the reference is required in your code, you may get compilation errors.
How do I delete the reference to the business logic project? My report runs without problems, but I would like to stop getting this warning...
Thanks!
It should just be a project dependency.
See here: https://msdn.microsoft.com/en-us/library/et61xzb3.aspx
To remove:
In Solution Explorer, select a project. On the Project menu, choose
Project Dependencies. The Project Dependencies dialog box opens. On
the Dependencies tab, select a project from the Project drop-down
menu. In the Depends on field, clear the check boxes beside any other
projects that are no longer dependencies of this project.
EDIT: Another option is to export the XPO and edit it in there, and reimport.

Found conflicts between different versions of the same dependent assembly.MVC3 -> MVC4 / EF4 -> EF5

The question is how to resolve conflicts between versions of assemblies in my project that was upgraded to MVC4 and EF5?
The problem is manifest in the fact that my controllers and models can include System.Data.Objects, but now my views.
I am using MVC 4, my project was upgraded from MVC 3.
Entity Framework is version 5.
I have a controller that is able to use objectcontext from System.Data.Objects.
My Usings:
using System.Data.Objects;
using System.Data.Entity;
When I try to include the using in the view form System.Data.Objects, I get :
CS0234: The type or namespace name 'Objects' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
I am targeting .net 4.5
My Build Displays this message:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1561,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly.
You can build your solution in diagnostic mode to get more detailed information about the error.
Open the VS Options dialog (Tools > Options), navigate to the "Projects and Solutions" node and select "Build and Run". Change the MS Build project build output verbosity to Diagnostic.
Have a look here.
If you look at the build message, it states the 4.0 version of the .net framework is referenced... Is there a setting in your project file or web/app.config specifying a conflicting version of the .net framework?
Are you familiar with fuslog? you can set it up to log all assembly bindings that .net is doing while running your application. You should then be able to see detailed information on what is getting bound when. If you still can't figure it out, you can always do a binding redirect on that .dll in the web.config.
http://msdn.microsoft.com/en-us/library/eftw1fys.aspx -- binding redirects
http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.71).aspx -- fusion log viewer
Set up fusion logger and take a look at what the output is. If you don't get an answer from that, try the binding redirect (which would give you at least a temporary solution).
In the directory I was publishing to, there was a folder named aspnet_client. I moved it (instead of deleting it), republished, and it worked. I'm not sure why that folder decided to give me trouble out of the blue.

Adding an external jar library to Intellij IDEA

I'm having a silly problem : I'm trying to add the Jsoup library (which is just an external jar) to my android application developed in Intellij Idea and it seems and don't do it right .
I put the library in the libs folder , then I went in Project Structure -> modules and selected dependencies , select add global library , select attach source and click ok.
When I write code it is able to automatically import classes and to compile , but when running I get " java.lang.NoClassDefFoundError: org.jsoup.Jsoup"
Copy the .jar file into your lib/ directory.
Right click the new .jar in the lefthand file browser in IntelliJ / Android Studio
Choose "Add as Library..."
Voila!
-Open the External Libraries node on the Left hand panel.
-Select Open Library Settings
-Project structure dialogue opens up.
Select the Libraries.
Click the "+" to browse the file.
![add external jar1
In IntelliJ IDEA 15 you can also access the Project Structure menu item from "File" item in the menu bar. Select Libraries from the list on the left. Click the "+" to browse the file, select it and you're done. It will be added to the "External Libraries" directory in your project.
Have a look at the newer artifacts section. Perhaps you don't add the JAR into your deployment properly.
UPDATE:
I'd like to update my answer based on lessons learned over the past six years since I first answered this question.
The best way to manage 3rd party JAR dependencies in Java projects is to learn Maven (my preference) or Gradle. IntelliJ has terrific integration with both.
If you combine those with an enterprise repository like Nexus you'll have no problems. Your dependencies and versions will be completely specified. Conflicts will be identified for you. Updates will be relatively simple.