Skip to content

Commit 38785d0

Browse files
dotnet-maestro-botJunTaoLuo
authored andcommitted
[automated] Merge branch 'release/2.1' => 'release/2.2' (#4577)
* Workaround problems when opening solution files in Visual Studio (#4569) Changes: * Condense Routing.sln into HttpAbstractions.sln * Workaround NU1105 by adding all ProjectReferences to the .sln * Workaround exceptions in the ReferencesHostBridge by moving Reference items to a temporary item group * Add a 'startvs.cmd' script for launching VS with the right env variables * Remove RangeHelper test project * Move RangeHelper tests into StaticFiles.Tests and add target for NPM restore * Convert Session to use Reference and move to Middleware folder (#4576) * Add RoutingSample.Web to HttpAbstractions.sln
1 parent 21488b2 commit 38785d0

File tree

89 files changed

+668
-601
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+668
-601
lines changed

build/buildorder.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
<RepositoryBuildOrder Include="Razor" Order="6" RootPath="$(RepositoryRoot)src\Razor\" />
1111
<RepositoryBuildOrder Include="EntityFrameworkCore" Order="8" />
1212
<RepositoryBuildOrder Include="IISIntegration" Order="10" RootPath="$(RepositoryRoot)src\IISIntegration\" />
13-
<RepositoryBuildOrder Include="Session" Order="11" RootPath="$(RepositoryRoot)src\Session\" />
1413
<RepositoryBuildOrder Include="ServerTests" Order="11" RootPath="$(RepositoryRoot)src\ServerTests\" />
1514
<RepositoryBuildOrder Include="Security" Order="13" RootPath="$(RepositoryRoot)src\Security\" />
1615
<RepositoryBuildOrder Include="MetaPackages" Order="13" RootPath="$(RepositoryRoot)src\MetaPackages\" />

build/repo.props

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@
5656

5757
<ProjectToExclude Include="@(SamplesProject)" Condition="'$(BuildSamples)' == 'false' "/>
5858

59+
<!-- These projects use 'legacy' csproj, which is not supported by dotnet-msbuild. -->
60+
<ProjectToExclude Include="
61+
$(RepositoryRoot)src\Servers\HttpSys\samples\TestClient\TestClient.csproj;
62+
$(RepositoryRoot)src\Middleware\WebSockets\samples\TestServer\TestServer.csproj;
63+
"
64+
Condition=" '$(MSBuildRuntimeType)' == 'Core' " />
65+
5966
<!-- Exclude the websockets samples for now because they use classic .csproj, which is not yet supported in our build. -->
6067
<ProjectToExclude Include="
6168
$(RepositoryRoot)src\Middleware\WebSockets\samples\**\*.csproj;

build/submodules.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
<ShippedRepository Include="MvcPrecompilation" RootPath="$(RepositoryRoot)src\MvcPrecompilation\" />
5858
<ShippedRepository Include="Razor" RootPath="$(RepositoryRoot)src\Razor\" />
5959
<ShippedRepository Include="Security" RootPath="$(RepositoryRoot)src\Security\" />
60-
<ShippedRepository Include="Session" RootPath="$(RepositoryRoot)src\Session\" />
6160
<ShippedRepository Include="SignalR" RootPath="$(RepositoryRoot)src\SignalR\" />
6261
</ItemGroup>
6362
</Project>

docs/BuildFromSource.md

Lines changed: 69 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
Build ASP.NET Core from Source
22
==============================
33

4-
Building ASP.NET Core from source allows you tweak and customize ASP.NET Core, and
5-
to contribute your improvements back to the project.
4+
Building ASP.NET Core from source allows you tweak and customize ASP.NET Core, and to contribute your improvements back to the project.
65

7-
## :warning: Temporary instructions
6+
:warning: We are currently in the middle of restructing our source code. These instructions will likely change rapidly during November and December 2018.
87

9-
We are currently in the middle of restructing our repositories. While this work is being done, the following instructions will help you be more productive while working on this repo.
10-
11-
1. Before opening a solution, run `build.cmd /p:_ProjectsOnly=true /p:SkipTests=true`. This will only build the projects which have merged into this repo, not the git submodules.
12-
2. Use (or create) a solution which is scoped to your project file. The build system does not use .sln files. These only exist for developer productivity in Visual Studio, so feel free to adjust the projects in .sln files to match your workload.
13-
3. Questions? Contact @aspnet for help.
8+
See https://github.com/aspnet/AspNetCore/labels/area-infrastructure for known issues and to track ongoing work.
149

1510
## Install pre-requistes
1611

@@ -58,22 +53,66 @@ git submodule update --init --recursive
5853

5954
## Building in Visual Studio / Code
6055

61-
Before opening our .sln files in Visual Studio or VS Code, executing the following on command-line:
62-
```
63-
.\build.cmd /t:Restore
64-
```
65-
This will download required tools.
56+
Before opening our .sln files in Visual Studio or VS Code, you need to perform the following actions.
57+
58+
1. Executing the following on command-line:
59+
```
60+
.\build.cmd /p:SkipTests=true /p:_ProjectsOnly=true
61+
```
62+
This will download required tools and build the entire repository once. At that point, you should be able to open .sln files to work on the projects you care about.
63+
64+
2. Use the `startvs.cmd` script to open Visual Studio .sln files. This script first sets required environment variables.
65+
66+
> :bulb: Pro tip: you will also want to run this command after pulling large sets of changes. Visual Studio will only build projects in a solution file, and makes a best effort to use other files on disk. If you pull many changes, the files on disk may be stale and will need to re-build.
67+
68+
### Solution files
69+
70+
We don't have a single .sln file for all of ASP.NET Core because Visual Studio doesn't currently handle projects of this scale.
71+
Instead, we have many .sln files which include a sub-set of projects. These principles guide how we create and manage .slns:
72+
73+
1. Solution files are not used by CI or command line build scripts. They are for meant for use by developers only.
74+
2. Solution files group together projects which are frequently edited at the same time.
75+
3. Can't find a solution that has the projects you care about? Feel free to make a PR to add a new .sln file.
76+
77+
> :bulb: Pro tip: `dotnet new sln` and `dotnet sln` are one of the easiest ways to create and modify solutions.
78+
79+
### Known issue: NU1105
80+
81+
Opening solution files may produce an error code NU1105 with a message such
82+
83+
> Unable to find project information for 'C:\src\AspNetCore\src\Hosting\Abstractions\src\Microsoft.AspNetCore.Hosting.Abstractions.csproj'. Inside Visual Studio, this may be because the project is unloaded or not part of current solution. Otherwise the project file may be invalid or missing targets required for restore.
84+
85+
This is a known issue in NuGet (<https://github.com/NuGet/Home/issues/5820>) and we are working with them for a solution. See also <https://github.com/aspnet/AspNetCore/issues/4183> to track progress on this.
86+
87+
**The workaround** for now is to add all projects to the solution.
88+
89+
dotnet sln add C:\src\AspNetCore\src\Hosting\Abstractions\src\Microsoft.AspNetCore.Hosting.Abstractions.csproj
90+
6691

6792
#### PATH
6893

69-
For VS Code and Visual Studio to work correctly, you must place the following location in your PATH.
94+
For VS Code and Visual Studio and `dotnet` commands to work correctly, you must place the following location in your PATH.
95+
Use the following commands to update the PATH variable in a command line window.
96+
97+
Windows (Command Prompt)
98+
99+
```batch
100+
set PATH=%USERPROFILE%\.dotnet\x64;%PATH%
101+
```
102+
103+
Windows (Powershell)
104+
105+
```ps1
106+
$env:PATH="$env:USERPROFILE\.dotnet\x64;$env:PATH"
70107
```
71-
Windows: %USERPROFILE%\.dotnet\x64
72-
Linux/macOS: $HOME/.dotnet
108+
109+
Linux/macOS:
110+
111+
```sh
112+
export PATH="$HOME/.dotnet:$PATH"
73113
```
74-
This must come **before** any other installation of `dotnet`. In Windows, we recommend removing `C:\Program Files\dotnet` from PATH in system variables and adding `%USERPROFILE%\.dotnet\x64` to PATH in user variables.
75114

76-
<img src="http://i.imgur.com/Tm2PAfy.png" width="400" />
115+
On Windows, we recommend using the `startvs.cmd` command to launch Visual Studio.
77116

78117
## Building on command-line
79118

@@ -89,6 +128,14 @@ On macOS/Linux:
89128
./build.sh
90129
```
91130

131+
### Building a subset of the code
132+
133+
This repository is large. Look for `build.cmd`/`.sh` scripts in subfolders. These scripts can be used to invoke build and test on a smaller set of projects.
134+
135+
#### Known issue: not every subfolder has a build.cmd script
136+
137+
We'll be adding more. See https://github.com/aspnet/AspNetCore/issues/4247.
138+
92139
#### Build properties
93140

94141
Additional properties can be added as an argument in the form `/property:$name=$value`, or `/p:$name=$value` for short. For example:
@@ -99,8 +146,8 @@ Additional properties can be added as an argument in the form `/property:$name=$
99146
Common properties include:
100147

101148
Property | Description
102-
-------------------------|---------------------------------------------------------
103-
BuildNumber | (string). A specific build number, typically from a CI counter
149+
-------------------------|-------------------------------------------------------------------------------------------------------------
150+
BuildNumberSuffix | (string). A specific build number, typically from a CI counter, which is appended to the pre-release label.
104151
Configuration | `Debug` or `Release`. Default = `Debug`.
105152
SkipTests | `true` or `false`. When true, builds without running tests.
106153
NoBuild | `true` or `false`. Runs tests without rebuilding.
@@ -109,7 +156,7 @@ NoBuild | `true` or `false`. Runs tests without rebuilding.
109156

110157
After building ASP.NET Core from source, you will need to install and use your local version of ASP.NET Core.
111158

112-
- Run the installers produced in `artifacts/installers/` for your platform.
159+
- Run the installers produced in `artifacts/{Debug, Release}/installers/` for your platform.
113160
- Add a NuGet.Config to your project directory with the following content:
114161

115162
```xml
@@ -128,7 +175,7 @@ After building ASP.NET Core from source, you will need to install and use your l
128175
- Update the versions on `PackageReference` items in your .csproj project file to point to the version from your local build.
129176
```xml
130177
<ItemGroup>
131-
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="3.0.0-alpha1-t000" />
178+
<PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="3.0.0-preview-0" />
132179
</ItemGroup>
133180
```
134181

eng/Baseline.Designer.props

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,17 @@
509509
<BaselinePackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" Version="[2.2.0, )" />
510510
<BaselinePackageReference Include="Microsoft.AspNetCore.Hosting" Version="[2.2.0, )" />
511511
</ItemGroup>
512+
<!-- Package: Microsoft.AspNetCore.Session-->
513+
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Session' ">
514+
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>
515+
</PropertyGroup>
516+
<ItemGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.Session' AND '$(TargetFramework)' == 'netstandard2.0' ">
517+
<BaselinePackageReference Include="Microsoft.AspNetCore.DataProtection" Version="[2.2.0, )" />
518+
<BaselinePackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="[2.2.0, )" />
519+
<BaselinePackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="[2.2.0, )" />
520+
<BaselinePackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="[2.2.0, )" />
521+
<BaselinePackageReference Include="Microsoft.Extensions.Options" Version="[2.2.0, )" />
522+
</ItemGroup>
512523
<!-- Package: Microsoft.AspNetCore.StaticFiles-->
513524
<PropertyGroup Condition=" '$(PackageId)' == 'Microsoft.AspNetCore.StaticFiles' ">
514525
<BaselinePackageVersion>2.2.0</BaselinePackageVersion>

eng/Baseline.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
<Package Id="Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv" Version="2.2.0" />
5353
<Package Id="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" Version="2.2.0" />
5454
<Package Id="Microsoft.AspNetCore.Server.Kestrel" Version="2.2.0" />
55+
<Package Id="Microsoft.AspNetCore.Session" Version="2.2.0" />
5556
<Package Id="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
5657
<Package Id="Microsoft.AspNetCore.TestHost" Version="2.2.0" />
5758
<Package Id="Microsoft.AspNetCore.WebSockets" Version="2.2.0" />

eng/Dependencies.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
<LatestPackageReference Include="Microsoft.EntityFrameworkCore" Version="$(MicrosoftEntityFrameworkCorePackageVersion)" />
2020
<LatestPackageReference Include="Microsoft.Extensions.ActivatorUtilities.Sources" Version="$(MicrosoftExtensionsActivatorUtilitiesSourcesPackageVersion)" />
2121
<LatestPackageReference Include="Microsoft.Extensions.Caching.Memory" Version="$(MicrosoftExtensionsCachingMemoryPackageVersion)" />
22+
<LatestPackageReference Include="Microsoft.Extensions.Caching.Redis" Version="$(MicrosoftExtensionsCachingRedisPackageVersion)" />
23+
<LatestPackageReference Include="Microsoft.Extensions.Caching.SqlServer" Version="$(MicrosoftExtensionsCachingSqlServerPackageVersion)" />
2224
<LatestPackageReference Include="Microsoft.Extensions.ClosedGenericMatcher.Sources" Version="$(MicrosoftExtensionsClosedGenericMatcherSourcesPackageVersion)" />
2325
<LatestPackageReference Include="Microsoft.Extensions.CommandLineUtils.Sources" Version="$(MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion)" />
2426
<LatestPackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="$(MicrosoftExtensionsConfigurationCommandLinePackageVersion)" />

eng/ProjectReferences.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions" ProjectPath="$(RepositoryRoot)src\Servers\Kestrel\Transport.Abstractions\src\Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.csproj" />
4242
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv" ProjectPath="$(RepositoryRoot)src\Servers\Kestrel\Transport.Libuv\src\Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.csproj" />
4343
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" ProjectPath="$(RepositoryRoot)src\Servers\Kestrel\Transport.Sockets\src\Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.csproj" />
44+
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Session" ProjectPath="$(RepositoryRoot)src\Middleware\Session\src\Microsoft.AspNetCore.Session.csproj" />
4445
<ProjectReferenceProvider Include="dotnet-dev-certs" ProjectPath="$(RepositoryRoot)src\Tools\dotnet-dev-certs\src\dotnet-dev-certs.csproj" />
4546
<ProjectReferenceProvider Include="dotnet-sql-cache" ProjectPath="$(RepositoryRoot)src\Tools\dotnet-sql-cache\src\dotnet-sql-cache.csproj" />
4647
<ProjectReferenceProvider Include="dotnet-user-secrets" ProjectPath="$(RepositoryRoot)src\Tools\dotnet-user-secrets\src\dotnet-user-secrets.csproj" />

eng/targets/CSharp.Common.targets

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<Project>
22

3+
<!-- For 'legacy' .csproj files, set map TargetFrameworkVersion back to TargetFramework -->
4+
<PropertyGroup Condition=" '$(TargetFramework)' == '' AND '$(TargetFrameworks)' == '' ">
5+
<TargetFramework>net$(TargetFrameworkVersion.Substring(1).Replace('.',''))</TargetFramework>
6+
<TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
7+
</PropertyGroup>
8+
39
<Import Project="Packaging.targets" />
410
<Import Project="ResolveReferences.targets" />
511
</Project>

eng/targets/ResolveReferences.targets

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,18 @@
4646
<ProjectReference Include="@(_ProjectReferenceByAssemblyName->'%(ProjectPath)')" />
4747

4848
<Reference Remove="@(_ProjectReferenceByAssemblyName)" />
49+
50+
<!-- Use _ReferenceTemp to workaround issues in Visual Studio which causes a conflict between Reference, packages, and projects. -->
51+
<_ReferenceTemp Include="@(Reference)" />
52+
<Reference Remove="@(Reference)" />
4953
</ItemGroup>
5054

5155
<Target Name="ResolveCustomReferences" BeforeTargets="CollectPackageReferences;ResolveAssemblyReferencesDesignTime;ResolveAssemblyReferences" Condition=" '$(TargetFramework)' != '' ">
5256
<ItemGroup>
53-
<UnusedBaselinePackageReference Include="@(BaselinePackageReference)" Exclude="@(Reference);@(_ProjectReferenceByAssemblyName)" />
57+
<Reference Include="@(_ReferenceTemp)" />
58+
<_ReferenceTemp Remove="@(_ReferenceTemp)" />
5459

60+
<UnusedBaselinePackageReference Include="@(BaselinePackageReference)" Exclude="@(Reference);@(_ProjectReferenceByAssemblyName)" />
5561
<!--
5662
MSBuild does not provide a way to join on matching identities in a Condition,
5763
but you can do a cartesian product of two item groups and filter out mismatched id's in a second pass.

src/DataProtection/startvs.cmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@ECHO OFF
2+
3+
%~dp0..\..\startvs.cmd %~dp0DataProtection.sln

0 commit comments

Comments
 (0)