Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "justinp"

Thank you for answering my question _and_letting me know that the new version is coming soon. I will not work on this and will focus my efforts elsewhere.

Thank you very much!

This post does a decent job of explaining the change: <a class="postlink" href="https://github.com/aspnet/Announcements/issues/209">https://github.com/aspnet/Announcements/issues/209</a>

Some more research led to this post: <a class="postlink" href="http://stackoverflow.com/questions/40858155/ef-core-1-1-to-webapi-core-add-migration-fails/40862092#40862092">http://stackoverflow.com/questions/4085 ... 2#40862092</a>

The issue is related to the builder.AddUserSecrets() call. To fix perform the following steps:

  • Adding the user secret to the assembly (instead of just project.json) by adding attribute [assembly: UserSecretsId("aspnet-TestApp-ce345b64-19cf-4972-b34f-d16f2e7976ed")] to Startup.cs
  • In Startup.cs replace builder.AddUserSecrets() with builder.AddUserSecrets<Startup>(); Reference: InvalidOperationException: Could not find 'UserSecretsIdAttribute' on assembly

The difference being that builder.AddUserSecrets() is being called from the static class AppConfigurations from inside the Web.Core project (as opposed to the EF or Web.Host projects). So I'm not sure what to change the builder.AddUserSecrets() to builder.AdduserSecrets<T>().

I would guess that since it wants an IConfigurationBuilder, that it would be builder.AddUserSecrets<ConfigurationBuilder>(). Ideas?

So is no one aware of where the EF6 Migrator tool documentation is? Am I missing something? #2653@1c71b90c-f27e-4559-9414-854a033a7d91

Continuing with the attempt to get the Entity Framework working since there isn't any documentation on using the Migrator project...

I've installed the following packages on the EF project: a. Microsoft.EntityFrameworkCore b. Microsoft.EntityFrameworkCore.Tools

Now I run:

PM> update-database Both Entity Framework Core and Entity Framework 6 are installed. The Entity Framework Core tools are running. Use 'EntityFramework\Update-Database' for Entity Framework 6. An error occurred while calling method 'ConfigureServices' on startup class 'Startup'. Consider using IDbContextFactory to override the initialization of the DbContext at design-time. Error: This method could not find a user secret ID because the application's entry assembly is not set. Try using the ".AddUserSecrets(string userSecretsId)" or ".AddUserSecrets<TStartup>()" method instead. No DbContext was found in assembly 'Project.EntityFramework'. Ensure that you're using the correct assembly and that the type is neither abstract nor generic.

Thank you for the reply.

Yes, I'm switching to VS2017 and aware that some things are different (project.json vs global.json) and working through that. However your suggestion did not resolve the issue.

The following packages that are prompted to be updated when the solution is opened, which does include the one you mentioned.

xunit -> v2.2.0 xunit.extensibility.execution -> v2.2.0 xunit.runner.visualstudio -> v2.2.0 Microsoft.NET.Test.Sdk -> v15.0.0 Migrator.EF6.Tools -> v1.1.0

After upgrading and restoring the packages, I did the following:

Set Web.Host project as default Built the solution

You mentioned using the Migrate tool. As I mentioned in this post the documentation referenced is missing: [http://forum.aspnetboilerplate.com/viewtopic.php?f=5&t=5370])

Running console from inside folder: No executable found matching command "dotnet-ef"

Running from Package Manager Console: PM> update-database The EntityFramework package is not installed on project 'ApolloEHR.EntityFramework'.

So I checked, and just like the error says EntityFramework wasn't installed! Installed it, then get the errors about the project.json missing.

There should be either both clear documentation on the workaround using Migrator, and updated documentation on using EF CLI. There are neither that I can find, but if you can point me to it, I'd be grateful.

Solution:

  1. Went to NuGet package manager. (Right-click solution, and go to Manage NuGet Packages for solution)
  2. You should see updates above and an update for xunit.
  3. Install the udpate.
  4. Re-run Restore NuGet Packages.
Answer

If the UI project can't find the back-end (API Project), then you'll get the forever spinning. Try to run both projects at the same time.

I got it all working and deployed to Azure. Just to be super-clear to anyone getting started with ASP.NET Zero v3.1, and the latest version of Angular CLI, here are the steps. All the previous steps for deploying the API are still valid, so this just applies to getting the angular portion deployed and working in Azure.

  1. Make sure you have the latest version of Angular CLI (@angular/[email protected]) by running 'npm list -g.' If you are having trouble, use the commands in my previous post to ensure you uninstall globally and that the cache is clear before installing the latest.

  2. Download your project files from ASP.NET Zero and extract them to wherever you will be working with them.

  3. From within 'angular' folder, run 'npm install' from a command prompt. This will create the 'node_modules' folder in side the angular folder with all the dependency files for the project.

  4. Open and modify the "environments" section of the angular-cli.json file according to this error message (you will get this error message if you run 'ng build --prod,' so if you forget, it will remind you):

To migrate angular-cli.json follow the example below:

Before:

"environments": {
  "source": "environments/environment.ts",
  "dev": "environments/environment.ts",
  "prod": "environments/environment.prod.ts"
}


After:

"environmentSource": "environments/environment.ts",
"environments": {
  "dev": "environments/environment.ts",
  "prod": "environments/environment.prod.ts"
}
  1. Run 'ng build --prod.'

You should now have a folder inside the 'angular' folder called 'dist' with 22 files and an assets folder, and can continue with the previous posts steps 9-11. The web.config file mentioned is now part of the files in the package, but doesn't get moved into the dist folder.

  1. Connect to your azure website's ftp and transfer files under dist folder to "/site/wwwroot/" of your azure website.
  2. Configure appconfig.json under "/site/wwwroot/assets" on your azure website.
  3. Add a web.config file under "/site/wwwroot/" which has below content. This will be included in our next release as well.

To configure the appconfig.json metioned in step 10, open it and change it to:

{
    "remoteServiceBaseUrl": "http://your-api-url.azurewebsites.net",
    "appBaseUrl": "http://your-angular-ui-url.azurewebsites.net"
}

You should now have a working instance deployed to Azure.

Enjoy.

I may have solved the issue. I want to post what I did in case someone else is getting started with ASP.NET Zero and Angular-Cli.

I realized (see post above) that 'ng' commands weren't working since going to the suggested @angular/[email protected]. However, prior to trying all this, I had managed to get a better result on my first attempt, when I didn't use Yarn or beta.31 of Angular CLI, but instead used npm install and the latest version of angular-cli. So I upgraded from beta31 back to the latest version, but was getting this error when running 'ng' commands:

ERROR in ./src/main.ts
Module build failed: TypeError: Cannot read property 'newLine' of undefined
at Object.getNewLineCharacter (C:\Users\Justin\angular\node_modules\typescript\lib\typescript.js:8062:20)
at Object.createCompilerHost (C:\Users\Justin\angular\node_modules\typescript\lib\typescript.js:44978:26)
at Object.ngcLoader (C:\Users\Justin\angular\node_modules@ngtools\webpack\src\loader.js:350:33)
@ multi webpack-dev-server/client?http://localhost:4200/ ./src/main.ts

So I did some searching and found this thread: <a class="postlink" href="https://github.com/angular/angular-cli/issues/5179">https://github.com/angular/angular-cli/issues/5179</a> and this thread: <a class="postlink" href="https://github.com/angular/angular-cli/issues/4895">https://github.com/angular/angular-cli/issues/4895</a>

So I ran these commands just to be sure that there wasn't some version confusion.

npm uninstall -g angular-cli
npm uninstall --save-dev angular-cli
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest

Now I have the following version of angular-cli when I run npm list -g

C:\Users\Justin\angular>npm list -g
C:\Users\Justin\AppData\Roaming\npm
+-- @angular/[email protected]

I made a fresh copy of the angular folder downloaded from ASPNET Zero, like I always do, and ran 'npm install,' because I found in that same thread from earlier someone mentioned that yarn install' might not be resolving dependencies, which confirmed my previous experiences.

Following that, ng commands gave me a different error, but one that was easily solvable:

C:\Users\Justin\angular>ng build --prod
Environment configuration does not contain "environmentSource" entry.

A new environmentSource entry replaces the previous source entry inside environments.

To migrate angular-cli.json follow the example below:

Before:

"environments": {
  "source": "environments/environment.ts",
  "dev": "environments/environment.ts",
  "prod": "environments/environment.prod.ts"
}


After:

"environmentSource": "environments/environment.ts",
"environments": {
  "dev": "environments/environment.ts",
  "prod": "environments/environment.prod.ts"
}

The error asks me to modify a section of angular-cli.json and even tells me what to change it to. After making the changes, ng commands worked again and I was able to execute 'ng build --prod,' which gave me the expected 'dist' folder and the following files inside:

Directory of C:\Users\Justin\angular\dist

03/04/2017  10:33 AM    <DIR>          .
03/04/2017  10:33 AM    <DIR>          ..
03/04/2017  10:33 AM         1,073,855 0.4e462baadfe61fa18041.chunk.js
03/04/2017  10:33 AM           304,427 1.05de1ea02987159b9eeb.chunk.js
03/04/2017  10:33 AM            89,863 2.f9ca5eca298a01e55870.chunk.js
03/04/2017  10:33 AM    <DIR>          assets
03/04/2017  10:33 AM            78,508 famfamfam-flags.d4a4d7b033f5ad8d7261.png
03/04/2017  10:33 AM           165,742 fontawesome-webfont.674f50d287a8c48dc19b.eot
03/04/2017  10:33 AM           444,379 fontawesome-webfont.912ec66d7572ff821749.svg
03/04/2017  10:33 AM            77,160 fontawesome-webfont.af7ae505a9eed503f8b8.woff2
03/04/2017  10:33 AM           165,548 fontawesome-webfont.b06871f281fee6b241d6.ttf
03/04/2017  10:33 AM            98,024 fontawesome-webfont.fee66e712a8a08eef580.woff
03/04/2017  10:33 AM               952 index.html
03/04/2017  10:33 AM             1,560 inline.8e8e16f4cb5e2d56d862.bundle.js
03/04/2017  10:33 AM           752,227 main.1b5ebc8a29e8ac7465e7.bundle.js
03/04/2017  10:33 AM            90,219 polyfills.6a520f9204459c96cb8b.bundle.js
03/04/2017  10:33 AM         1,637,023 scripts.dde78ae3c2579cbca7d4.bundle.js
03/04/2017  10:33 AM            30,064 Simple-Line-Icons.0cb0b9c589c0624c9c78.woff2
03/04/2017  10:33 AM           239,045 Simple-Line-Icons.2fe2efe63441d830b1ac.svg
03/04/2017  10:33 AM            81,332 Simple-Line-Icons.78f07e2c2a535c26ef21.woff
03/04/2017  10:33 AM            54,056 Simple-Line-Icons.d2285965fe34b0546504.ttf
03/04/2017  10:33 AM            54,266 Simple-Line-Icons.f33df365d6d0255b586f.eot
03/04/2017  10:33 AM            34,770 sprite.976b3b4f9512611cc0c3.png
03/04/2017  10:33 AM           257,312 styles.3559ec6f191a029a299f.bundle.css
03/04/2017  10:33 AM         1,483,095 vendor.bde8a4fca4fa837f64b6.bundle.js

I hope this helps someone that is facing similar issues and getting started with the latest versions of both ASP.NET Zero and Angular-CLI. I still need to get everything working across the Angular and API projects within Azure, but I'll come back and post when I have that done.

Showing 41 to 50 of 59 entries