Skip to content

Commit

Permalink
Convert to new .csproj format for VS2017 (#216)
Browse files Browse the repository at this point in the history
- Migrate to .csproj for Visual Studio 2017
- Update initial developer documentation
- Add .editorconfig
  • Loading branch information
Harald Nagel committed Mar 9, 2017
1 parent 971f635 commit 1730692
Show file tree
Hide file tree
Showing 45 changed files with 455 additions and 587 deletions.
74 changes: 74 additions & 0 deletions .editorconfig
@@ -0,0 +1,74 @@
# top-most EditorConfig file
root = true

# Don't use tabs for indentation.
[*]
indent_style = space
# (Please don't specify an indent_size here; that has too many unintended consequences.)

# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4

# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2

# Xml config files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2

# JSON files
[*.json]
indent_size = 2

# Dotnet code style settings:
[*.{cs,vb}]
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true
# Avoid "this." and "Me." if not necessary
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion

# Use language keywords instead of framework type names for type references
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion

# Suggest more modern language features when available
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion

# CSharp code style settings:
[*.cs]
# Prefer `var` where obvious
csharp_style_var_when_type_is_apparent = true:suggestion

# Prefer method-like constructs to have a block body
csharp_style_expression_bodied_methods = false:none
csharp_style_expression_bodied_constructors = false:none
csharp_style_expression_bodied_operators = false:none

# Prefer property-like constructs to have an expression-body
csharp_style_expression_bodied_properties = true:none
csharp_style_expression_bodied_indexers = true:none
csharp_style_expression_bodied_accessors = true:none

# Suggest more modern language features when available
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion

# Newline settings
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -5,9 +5,9 @@ matrix:
dist: trusty
sudo: required
mono: none
dotnet: 1.0.0-preview2-003131
dotnet: 1.0.1
before_script:
- dotnet --info
- dotnet restore
script:
- dotnet --verbose build src/GRA.Web
- dotnet build
26 changes: 13 additions & 13 deletions GreatReadingAdventure.sln
@@ -1,42 +1,42 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.26228.4
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{0324DE44-14C1-4203-A624-5BE8BD75153E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E31857E8-98F8-4579-B9C2-7C6079EF234F}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
CREDITS.md = CREDITS.md
global.json = global.json
README.md = README.md
THANKS.md = THANKS.md
EndProjectSection
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GRA.Web", "src\GRA.Web\GRA.Web.xproj", "{62E47447-A4E5-40FC-8CA7-12A0FBE46915}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GRA.Web", "src\GRA.Web\GRA.Web.csproj", "{62E47447-A4E5-40FC-8CA7-12A0FBE46915}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GRA.Domain.Model", "src\GRA.Domain.Model\GRA.Domain.Model.xproj", "{293BC215-8191-4DC8-8906-557F93FC1605}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GRA.Domain.Model", "src\GRA.Domain.Model\GRA.Domain.Model.csproj", "{293BC215-8191-4DC8-8906-557F93FC1605}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GRA.Controllers", "src\GRA.Controllers\GRA.Controllers.xproj", "{8B78E9A9-0F87-4775-9859-F627851A2545}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GRA.Controllers", "src\GRA.Controllers\GRA.Controllers.csproj", "{8B78E9A9-0F87-4775-9859-F627851A2545}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GRA.Data", "src\GRA.Data\GRA.Data.xproj", "{E6F2731C-50A5-49DB-8E8B-7990B9ECB901}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GRA.Data", "src\GRA.Data\GRA.Data.csproj", "{E6F2731C-50A5-49DB-8E8B-7990B9ECB901}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GRA.Data.SqlServer", "src\GRA.Data.SqlServer\GRA.Data.SqlServer.xproj", "{F428384E-D728-4026-9EFB-097C5EE09792}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GRA.Data.SqlServer", "src\GRA.Data.SqlServer\GRA.Data.SqlServer.csproj", "{F428384E-D728-4026-9EFB-097C5EE09792}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GRA.Data.SQLite", "src\GRA.Data.SQLite\GRA.Data.SQLite.xproj", "{EC468258-8B51-4CB2-9077-9CA9ACC6C330}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GRA.Data.SQLite", "src\GRA.Data.SQLite\GRA.Data.SQLite.csproj", "{EC468258-8B51-4CB2-9077-9CA9ACC6C330}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Domain", "Domain", "{6BA5FF75-C5CE-45BC-8836-B2E689A571A1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{D9635F58-2DE0-478F-A675-FE0760C82B33}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GRA.Domain.Repository", "src\GRA.Domain.Repository\GRA.Domain.Repository.xproj", "{94881B74-B873-49C5-93EB-0A4E1DA8F821}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GRA.Domain.Repository", "src\GRA.Domain.Repository\GRA.Domain.Repository.csproj", "{94881B74-B873-49C5-93EB-0A4E1DA8F821}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GRA.Domain.Service", "src\GRA.Domain.Service\GRA.Domain.Service.xproj", "{1CA195AD-0045-4FE8-839B-E32166C318F4}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GRA.Domain.Service", "src\GRA.Domain.Service\GRA.Domain.Service.csproj", "{1CA195AD-0045-4FE8-839B-E32166C318F4}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GRA.Security", "src\GRA.Security\GRA.Security.xproj", "{74C2C606-EED9-45BB-85C4-5A2316E54103}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GRA.Security", "src\GRA.Security\GRA.Security.csproj", "{74C2C606-EED9-45BB-85C4-5A2316E54103}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GRA", "src\GRA\GRA.xproj", "{E8041040-29F4-43F7-A9DF-EFCED64B22F0}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GRA", "src\GRA\GRA.csproj", "{E8041040-29F4-43F7-A9DF-EFCED64B22F0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
6 changes: 3 additions & 3 deletions appveyor.yml
@@ -1,9 +1,9 @@
os: Visual Studio 2015
os: Visual Studio 2017
before_build:
- ps: dotnet --info
- ps: dotnet restore
build_script:
- ps: dotnet --verbose build src/GRA.Web
- ps: dotnet build

test: off
version: 0.0.1.{build}
version: 4.0.0-alpha2.{build}
16 changes: 8 additions & 8 deletions dev/initial-developer-setup.md
Expand Up @@ -2,11 +2,11 @@

## Development environment

- Windows: [Visual Studio 2015](https://www.visualstudio.com/vs/)
- Windows: [Visual Studio 2017](https://www.visualstudio.com/vs/)
- Linux, macOS, Windows: [Visual Studio Code](https://code.visualstudio.com/)
- Ensure you [install the C# extension](https://code.visualstudio.com/docs/runtimes/dotnet)

*Currently version 4 of the GRA uses .NET Core 1.1. The project infrastructure is still set up to use `project.json` files and not `.csproj` files so Visual Studio 2017 RC cannot be used without performing a `dotnet migrate` from the root directory of the project. For now, the suggestion is to continue using Visual Studio 2015 or Visual Studio Code.*
*The project has been migrated to use Visual Studio 2017 `.csproj` files and no longer uses the `project.json` project files as in Visual Studio 2015.*

## Initial developer setup

Expand All @@ -16,27 +16,27 @@ The project ships with the Microsoft SQL Server data provider configured. If you

### Database migration

Initial database setup and configuration can be done utilizing the `dotnet` command line tool.
Initial database setup and configuration can be done utilizing the [`dotnet ef`](https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/dotnet) command line tool or the [Package Manager Console](https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/powershell). Here are steps for using `dotnet ef`:

1. Navigate to the appropriate project directory for your database provider (e.g. `src/GRA.Data.SqlServer` or `src/GRA.Data.SQLite`).
2. Check if a database migration exists:

`dotnet ef --startup-project ../GRA.Web migrations list`
`dotnet ef -s ../GRA.Web migrations list`

3. If no migrations exist, create one:

`dotnet ef --startup-project ../GRA.Web migrations add initial`
`dotnet ef -s ../GRA.Web migrations add initial`

4. Create or update the database to the migration:
4. Create or update the database to the migration (necessary for SQLite, possibly not for SQL Server but won't hurt):

`dotnet ef --startup-project ../GRA.Web database update`
`dotnet ef -s ../GRA.Web database update`

### Configuration

The `GRA.Web` project has the [Secret Manager](https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets#secret-manager) enabled. You may want to issue a command such as:

```c#
dotnet user-secrets set GraEmailOverride your@email.address
dotnet user-secrets set GraEmailOverride your@email.address
```

To ensure that no errant emails are sent out during development. There are other settings you may want to configure through this manner such as `GraDefaultOutgoingMailHost` and `GraDefaultOutgoingMailPort`. Review `Startup.cs` for more configuration settings.
Expand Down
7 changes: 1 addition & 6 deletions global.json
@@ -1,6 +1 @@
{
"projects": [ "src", "test", "." ],
"sdk": {
"version": "1.0.0-preview2-1-003177"
}
}
{"projects":["src","test","."]}
35 changes: 35 additions & 0 deletions src/GRA.Controllers/GRA.Controllers.csproj
@@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard1.6</TargetFramework>
<AssemblyName>GRA.Controllers</AssemblyName>
<PackageId>GRA.Controllers</PackageId>
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<Version>4.0.0-alpha2</Version>
<Copyright>Copyright 2017 Maricopa County Library District</Copyright>
<PackageLicenseUrl>https://github.com/mcld/greatreadingadventure/blob/master/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>http://www.greatreadingadventure.com/</PackageProjectUrl>
<RepositoryUrl>https://github.com/mcld/greatreadingadventure/</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\GRA\GRA.csproj" />
<ProjectReference Include="..\GRA.Domain.Model\GRA.Domain.Model.csproj" />
<ProjectReference Include="..\GRA.Domain.Repository\GRA.Domain.Repository.csproj" />
<ProjectReference Include="..\GRA.Domain.Service\GRA.Domain.Service.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="1.2.0" />
<PackageReference Include="CommonMark.NET" Version="0.15.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
<PackageReference Include="SmartFormat.NET" Version="2.0.0" />
</ItemGroup>

</Project>
21 changes: 0 additions & 21 deletions src/GRA.Controllers/GRA.Controllers.xproj

This file was deleted.

9 changes: 0 additions & 9 deletions src/GRA.Controllers/Properties/AssemblyInfo.cs
Expand Up @@ -2,15 +2,6 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyCompany("Maricopa County Library District")]
[assembly: AssemblyCopyright("Copyright 2017 Maricopa County Library District")]
[assembly: AssemblyDescription("The Great Reading Adventure Controller Module")]
[assembly: AssemblyProduct("The Great Reading Adventure Controller Module")]
[assembly: AssemblyInformationalVersion("4.0.0-alpha2")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
Expand Down
23 changes: 0 additions & 23 deletions src/GRA.Controllers/project.json

This file was deleted.

35 changes: 35 additions & 0 deletions src/GRA.Data.SQLite/GRA.Data.SQLite.csproj
@@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<AssemblyName>GRA.Data.SQLite</AssemblyName>
<PackageId>GRA.Data.SQLite</PackageId>
<RuntimeFrameworkVersion>1.1.0</RuntimeFrameworkVersion>
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<Version>4.0.0-alpha2</Version>
<Copyright>Copyright 2017 Maricopa County Library District</Copyright>
<PackageLicenseUrl>https://github.com/mcld/greatreadingadventure/blob/master/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>http://www.greatreadingadventure.com/</PackageProjectUrl>
<RepositoryUrl>https://github.com/mcld/greatreadingadventure/</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\GRA\GRA.csproj" />
<ProjectReference Include="..\GRA.Data\GRA.Data.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0" />
</ItemGroup>

<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
</ItemGroup>

</Project>
21 changes: 0 additions & 21 deletions src/GRA.Data.SQLite/GRA.Data.SQLite.xproj

This file was deleted.

9 changes: 0 additions & 9 deletions src/GRA.Data.SQLite/Properties/AssemblyInfo.cs
Expand Up @@ -2,15 +2,6 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyCompany("Maricopa County Library District")]
[assembly: AssemblyCopyright("Copyright 2017 Maricopa County Library District")]
[assembly: AssemblyDescription("The Great Reading Adventure SQLite Module")]
[assembly: AssemblyProduct("The Great Reading Adventure SQLite Module")]
[assembly: AssemblyInformationalVersion("4.0.0-alpha2")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
Expand Down

0 comments on commit 1730692

Please sign in to comment.