Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start developing Carmel with VS 2017 #8

Open
adriatic opened this issue Mar 13, 2017 · 3 comments
Open

Start developing Carmel with VS 2017 #8

adriatic opened this issue Mar 13, 2017 · 3 comments

Comments

@adriatic
Copy link
Member

adriatic commented Mar 13, 2017

Introduction

As of 3/13/2017, the application in the dotnet folder is verified as correctly running with the Visual Studio 2017 Community edition

This document describes the details of running and further evolving this application

@adriatic
Copy link
Member Author

adriatic commented Mar 13, 2017

Maintaining all * core version numbers

Carmel uses the dotnet core / ef core / Identity core components that were released as a part of Visual Studio 2017 Community edition as shown on this screenshot:

image
image

This is the dialog where these version numbers will be managed in the future, as needed.

The summary view of this information is obtain via Edit Carmel.csproj invocation:

image

This command yields the information shown below:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
    <PreserveCompilationContext>true</PreserveCompilationContext>
    <AssemblyName>Carmel</AssemblyName>
    <OutputType>Exe</OutputType>
    <PackageId>Carmel</PackageId>
    <RuntimeFrameworkVersion>1.1.0</RuntimeFrameworkVersion>
    <PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>
    <Company>AureliaTools</Company>
  </PropertyGroup>

  <ItemGroup>
    <Compile Remove="wwwroot\images\**" />
    <Content Remove="wwwroot\images\**" />
    <EmbeddedResource Remove="wwwroot\images\**" />
    <None Remove="wwwroot\images\**" />
  </ItemGroup>

  <ItemGroup>
    <Content Update="wwwroot\**\*;Views\**\*;Areas\**\Views;appsettings.json;web.config">
      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
    </Content>
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
    <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.1" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.1" />
    <PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.1" />
    <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
    <PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.1" />
    <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink.Loader" Version="14.1.0" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.1" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="1.1.1" />
  </ItemGroup>

  <Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
    <Exec Command="bower install" />
    <Exec Command="dotnet bundle" />
  </Target>

  <ItemGroup>
    <DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.2.301" />
  </ItemGroup>

</Project>

Note: I have no idea what is the significance and meaning of the ItemGroup shown below

  <ItemGroup>
    <Compile Remove="wwwroot\images\**" />
    <Content Remove="wwwroot\images\**" />
    <EmbeddedResource Remove="wwwroot\images\**" />
    <None Remove="wwwroot\images\**" />
  </ItemGroup>

@adriatic
Copy link
Member Author

adriatic commented Mar 14, 2017

Creating (and recreating) the Carmel database

The database can viewed (both the schema and content) using VS 2017 SQL Server Object Explorer:

image

As an example - here is the content of the Components table:

image

Here is the summary of steps taken to create a new version of this database. In order to avoid any unneeded complications with database migrations, this process assumes that the list of components and its parts comes from this file: 'https://aurelia-ui-toolkits.github.io/aurelia-kendoui-samples/samples.json', meaning that any changes to this file before Carmel can take care of itself without this file, will have to result with the database recreation using the new version of this 'samples.json' file

Step 1

Generate new code file which needs to be used as the replacement for this section of the CatalogContextSeedData.cs (this replacement is done via the editor of course).

This code file is created by

1. running this main.js utility application using Visual Studio Code

image

Note that this app uses a local copy of 'https://aurelia-ui-toolkits.github.io/aurelia-kendoui-samples/samples.json' file.

2. Once you verified that the generated C# code is correct and does what you want, run the command

node main.js > code

in the .../carmel/node folder.

Step 2

Delete the current CarmelDb database (using VS 2017 SQL Server Object Explorer)

Step 3

Run the Carmel app (defined by this Visual Studio solution). Observe that the Carmel app always tries to create the database (this line in Startup.cs class, which does not do anything if the database exists)

@adriatic
Copy link
Member Author

Developing and testing Carmel API

In order to use the current Carmel app without its user interface clock on the Properties menu item of the Carmel project

image

and uncheck the Launch URL box shown below

image

Then run the app (from Visual Studio, at this time) and use Postman to interact with the app (note that the app uses localhost:8000 port)

image

This specific sample was obtained running the Get command with url http://localhost:8000/api/components/

which maps to this method in the ComponentController.cs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant