Skip to content

Commit

Permalink
Allow building with desktop msbuild only
Browse files Browse the repository at this point in the history
  • Loading branch information
ViktorHofer committed Nov 25, 2024
1 parent bcd20ab commit dd10a42
Show file tree
Hide file tree
Showing 18 changed files with 353 additions and 228 deletions.
6 changes: 3 additions & 3 deletions docs/AddingNewProjects.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ Sample PR of final result: https://github.com/dotnet/aspnetcore/pull/41945
- If VS has not already modified these files, open the `.slnf` you want to add the project to. Create a solution folder for your project if doesn't exist already. Then right click solution folder -> Add -> Existing Project... -> follow the wizard.
1. Run the `eng/scripts/GenerateProjectList.ps1` file to regenerate a number of `eng/*.props` files e.g. ProjectReferences.props.

**Note:** If you are adding a new project to the root `src` directory, you will also need to add a reference in both of the `DotNetProjects` lists of the `eng/Build.props` file. The first list (the one with condition `'$(BuildMainlyReferenceProviders)' != 'true'"`) has items in the format of:
**Note:** If you are adding a new project to the root `src` directory, you will also need to add a reference in both of the `ProjectReference` lists of the `eng/Build/Managed.Traversal.proj` file. The first list (the one with condition `'$(BuildMainlyReferenceProviders)' != 'true'"`) has items in the format of:
```XML
<DotNetProjects Include="
<ProjectReference Include="
$(RepoRoot)src\[YOUR FOLDER]\**\*.csproj;
...
```
while the second (the one with condition `'$(BuildMainlyReferenceProviders)' == 'true'"`) has them in the format of (note the second `src`):
```XML
<DotNetProjects Include="
<ProjectReference Include="
$(RepoRoot)src\[YOUR FOLDER]\**\src\*.csproj;
...
```
Expand Down
2 changes: 1 addition & 1 deletion docs/BuildErrors.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ The `darc-int-...` feeds in NuGet.config are used only when building internally

## Error: Generated code is not up to date in eng/ProjectReferences.props.

After some project additions or moves, you may need to update the two `DotNetProjects Include` lists in `eng/Build.props`
After some project additions or moves, you may need to update the two `ProjectReference Include` lists in `eng/Build/Managed.Traversal.proj`

## Warning: Requested Microsoft.AspNetCore.App v&hellip; does not exist

Expand Down
4 changes: 2 additions & 2 deletions eng/AfterSolutionBuild.targets
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project>

<Import Project="Common.props" />
<Import Project="tools\RepoTasks\RepoTasks.tasks" />
<Import Project="SharedFramework.External.props" />
<Import Project="SharedFramework.Local.props" />

<!-- This is temporary until we can use FrameworkReference to build our own packages. -->
<Target Name="RemoveSharedFrameworkOnlyRefsFromNuspec" AfterTargets="Pack"
Condition=" '$(MSBuildRuntimeType)' == 'core' ">
<Target Name="RemoveSharedFrameworkOnlyRefsFromNuspec" AfterTargets="Pack" Condition="'$(BuildManaged)' == 'true'">
<ItemGroup>
<_BuildOutput Include="$(ArtifactsShippingPackagesDir)*.nupkg"
Exclude="$(ArtifactsShippingPackagesDir)*.symbols.nupkg" />
Expand Down
196 changes: 6 additions & 190 deletions eng/Build.props
Original file line number Diff line number Diff line change
@@ -1,61 +1,6 @@
<Project>
<Import Project="Common.props" />

<!--
@(RequiresDelayedBuild) projects can be extended many ways but this isn't fully automated because the new
projects likely aren't referenced initially. To add new projects, edit RequiresDelayedBuildProjects.props
manually, update the $(BuildMainlyReferenceProviders)' == 'true' item group near the bottom of this file,
or edit BuildAfterTargetingPack.csproj. Then run GenerateProjectList.ps1 (even for the first option to ensure
the format is correct) and undo any temporary changes. When complete, only BuildAfterTargetingPack.csproj and
other @(RequiresDelayedBuild) projects should mention projects listed in RequiresDelayedBuildProjects.props.
-->
<Import Project="RequiresDelayedBuildProjects.props" />

<!-- These projects are always excluded, even when -projects is specified on command line. -->
<ItemGroup>
<!-- Explicitly excluded projects -->
<ProjectToExclude Include="$(ProjectToExclude)" />

<!-- These projects use 'legacy' csproj, which is not supported by dotnet-msbuild. -->
<ProjectToExclude Include="
$(RepoRoot)src\Servers\HttpSys\samples\TestClient\TestClient.csproj;
$(RepoRoot)src\Middleware\WebSockets\samples\TestServer\WebSockets.TestServer.csproj;
"
Condition=" '$(MSBuildRuntimeType)' == 'Core' " />

<!-- Exclude the websockets samples for now because they use classic .csproj, which is not yet supported in our build. -->
<ProjectToExclude Include="$(RepoRoot)src\Middleware\WebSockets\samples\**\*.csproj" />

<!-- These projects are meant to be referenced only by tests or via BuildAfterTargetingPack.csproj. -->
<ProjectToExclude
Include="$(RepoRoot)src\**\testassets\**\*.*proj;
@(RequiresDelayedBuild);
"
Exclude="$(RepoRoot)src\Components\WebAssembly\testassets\WasmLinkerTest\*.*proj;
$(RepoRoot)src\Components\WebView\Samples\PhotinoPlatform\testassets\PhotinoTestApp\*.*proj;
$(RepoRoot)src\Http\Routing\test\testassets\RoutingSandbox\*.*proj;
$(RepoRoot)src\Security\Authentication\Negotiate\test\testassets\Negotiate.Client\*.*proj;
$(RepoRoot)src\Security\Authentication\Negotiate\test\testassets\Negotiate.Server\*.*proj;
" />

<!-- These projects are not meant to be built in this repo. In the Installers case, must explicitly opt in. -->
<ProjectToExclude Include="
$(RepoRoot)src\submodules\googletest\**\*.*proj;
$(RepoRoot)src\submodules\MessagePack-CSharp\**\*.*proj;
$(RepoRoot)src\Components\Web.JS\node_modules\**\*.*proj;
$(RepoRoot)src\Installers\**\*.*proj;
$(RepoRoot)src\ProjectTemplates\Web.ProjectTemplates\content\**\*.*proj;
$(RepoRoot)src\SignalR\clients\ts\**\node_modules\**\*.*proj;
" />

<!-- Exclude the benchmarks because they use <PackageReference>. -->
<ProjectToExclude Include="
$(RepoRoot)src\Components\benchmarkapps\BlazingPizza.Server\**\*.csproj;
$(RepoRoot)src\Mvc\perf\**\*.csproj;
$(RepoRoot)src\Servers\Kestrel\perf\PlatformBenchmarks\**\*.csproj;
$(RepoRoot)src\SignalR\perf\benchmarkapps\**\*.csproj;
" />
</ItemGroup>
<Import Project="$(MSBuildThisFileDirectory)Build\Directory.Build.props" />

<Choose>
<!-- Project selection can be overridden on the command line by passing in -projects. -->
Expand All @@ -71,141 +16,12 @@
</ItemGroup>
</When>
<Otherwise>
<ItemGroup Condition=" '$(TargetOsName)' == 'win' AND ('$(TargetArchitecture)' == 'x86' OR '$(TargetArchitecture)' == 'x64' OR '$(TargetArchitecture)' == 'arm64') ">
<NativeProjects Include="$(RepoRoot)src\**\*.vcxproj" Exclude="@(ProjectToExclude)" AdditionalProperties="Platform=x64" />
<NativeProjects Include="$(RepoRoot)src\**\*.vcxproj" Exclude="@(ProjectToExclude)" AdditionalProperties="Platform=Win32" />
<NativeProjects Include="$(RepoRoot)src\**\*.vcxproj" Exclude="@(ProjectToExclude)" AdditionalProperties="Platform=arm64" />
</ItemGroup>

<ItemGroup>
<ProjectToBuild Condition=" $(BuildNative) " Include="@(NativeProjects)" Exclude="@(ProjectToExclude)" />
<ProjectToExclude Condition=" !$(BuildNative) " Include="@(NativeProjects)" />

<NodeJsProjects
Include="$(RepoRoot)eng\Npm.Workspace.nodeproj;
$(RepoRoot)eng\Npm.Workspace.FunctionalTests.nodeproj;"
AdditionalProperties="BuildInParallel=false"
BuildInParallel="false"
RestoreInParallel="false"
Exclude="@(ProjectToExclude)" />

<ExplicitRequiresDelay Include="$(RepoRoot)eng\Npm.Workspace.FunctionalTests.nodeproj" />

<ProjectToBuild Condition=" '$(BuildNodeJS)' == 'true'" Include="@(NodeJsProjects)" Exclude="@(ProjectToExclude)" />
<ProjectToExclude Condition=" '$(BuildNodeJS)' != 'true'" Include="@(NodeJsProjects)" />

<JavaProjects Include="$(RepoRoot)src\SignalR\**\*.javaproj"
Exclude="@(ProjectToExclude)" />

<ProjectToBuild Condition=" '$(BuildJava)' == 'true'" Include="@(JavaProjects)" Exclude="@(ProjectToExclude)" />
<ProjectToExclude Condition=" '$(BuildJava)' != 'true'" Include="@(JavaProjects)" />

<!--
Use caution to avoid deep recursion. If the globbing pattern picks up something which exceeds MAX_PATH,
the entire pattern will silently fail to evaluate correctly.
-->
<DotNetProjects Include="
$(RepoRoot)src\Framework\App.Ref\src\Microsoft.AspNetCore.App.Ref.csproj;
$(RepoRoot)src\Framework\App.Ref.Internal\src\Microsoft.AspNetCore.App.Ref.Internal.csproj;
$(RepoRoot)src\Framework\AspNetCoreAnalyzers\test\Microsoft.AspNetCore.App.Analyzers.Test.csproj;
$(RepoRoot)src\Framework\test\Microsoft.AspNetCore.App.UnitTests.csproj;
$(RepoRoot)src\Assets\**\*.*proj;
$(RepoRoot)src\Caching\**\*.*proj;
$(RepoRoot)src\DefaultBuilder\**\*.*proj;
$(RepoRoot)src\Features\JsonPatch\**\*.*proj;
$(RepoRoot)src\DataProtection\**\*.*proj;
$(RepoRoot)src\Antiforgery\**\*.*proj;
$(RepoRoot)src\Hosting\**\*.*proj;
$(RepoRoot)src\Http\**\*.*proj;
$(RepoRoot)src\HttpClientFactory\**\*.*proj;
$(RepoRoot)src\Html.Abstractions\**\*.*proj;
$(RepoRoot)src\Identity\**\*.*proj;
$(RepoRoot)src\Servers\**\*.csproj;
$(RepoRoot)src\Security\**\*.*proj;
$(RepoRoot)src\SiteExtensions\Microsoft.Web.Xdt.Extensions\**\*.csproj;
$(RepoRoot)src\SiteExtensions\LoggingAggregate\test\**\*.csproj;
$(RepoRoot)src\Shared\**\*.*proj;
$(RepoRoot)src\Tools\**\*.*proj;
$(RepoRoot)src\Logging.AzureAppServices\**\src\*.csproj;
$(RepoRoot)src\Middleware\**\*.csproj;
$(RepoRoot)src\Razor\**\*.*proj;
$(RepoRoot)src\Mvc\**\*.*proj;
$(RepoRoot)src\Azure\**\*.*proj;
$(RepoRoot)src\SignalR\**\*.csproj;
$(RepoRoot)src\StaticAssets\**\*.csproj;
$(RepoRoot)src\Components\**\*.csproj;
$(RepoRoot)src\Analyzers\**\*.csproj;
$(RepoRoot)src\FileProviders\**\*.csproj;
$(RepoRoot)src\Configuration.KeyPerFile\**\*.csproj;
$(RepoRoot)src\Localization\**\*.csproj;
$(RepoRoot)src\ObjectPool\**\*.csproj;
$(RepoRoot)src\JSInterop\**\*.csproj;
$(RepoRoot)src\WebEncoders\**\*.csproj;
$(RepoRoot)src\HealthChecks\**\*.csproj;
$(RepoRoot)src\Testing\**\*.csproj;
$(RepoRoot)src\Grpc\**\*.csproj;
$(RepoRoot)src\ProjectTemplates\**\*.csproj;
$(RepoRoot)src\Extensions\**\*.csproj;
$(RepoRoot)src\BuildAfterTargetingPack\*.csproj;
$(RepoRoot)src\OpenApi\**\*.csproj;
$(RepoRoot)eng\tools\HelixTestRunner\HelixTestRunner.csproj;
"
Exclude="
@(ProjectToBuild);
@(ProjectToExclude);
$(RepoRoot)**\node_modules\**\*;
$(RepoRoot)**\bin\**\*;
$(RepoRoot)**\obj\**\*;"
Condition=" '$(BuildMainlyReferenceProviders)' != 'true' " />
<DotNetProjects Include="
$(RepoRoot)src\Assets\**\*.*proj;
$(RepoRoot)src\Caching\**\src\*.csproj;
$(RepoRoot)src\DefaultBuilder\**\src\*.csproj;
$(RepoRoot)src\Features\JsonPatch\**\src\*.csproj;
$(RepoRoot)src\DataProtection\**\src\*.csproj;
$(RepoRoot)src\Antiforgery\**\src\*.csproj;
$(RepoRoot)src\Hosting\**\src\*.csproj;
$(RepoRoot)src\Http\**\src\*.csproj;
$(RepoRoot)src\HttpClientFactory\**\src\*.csproj;
$(RepoRoot)src\Html.Abstractions\src\*.csproj;
$(RepoRoot)src\Identity\**\src\*.csproj;
$(RepoRoot)src\Servers\**\src\*.csproj;
$(RepoRoot)src\Security\**\src\*.csproj;
$(RepoRoot)src\SiteExtensions\**\src\*.csproj;
$(RepoRoot)src\Tools\**\src\*.csproj;
$(RepoRoot)src\Logging.AzureAppServices\**\src\*.csproj;
$(RepoRoot)src\Middleware\**\src\*.csproj;
$(RepoRoot)src\Razor\**\src\*.csproj;
$(RepoRoot)src\Mvc\**\src\*.csproj;
$(RepoRoot)src\Azure\**\src\*.csproj;
$(RepoRoot)src\SignalR\**\src\*.csproj;
$(RepoRoot)src\StaticAssets\src\*.csproj;
$(RepoRoot)src\Components\**\src\*.csproj;
$(RepoRoot)src\FileProviders\**\src\*.csproj;
$(RepoRoot)src\Configuration.KeyPerFile\**\src\*.csproj;
$(RepoRoot)src\Localization\**\src\*.csproj;
$(RepoRoot)src\ObjectPool\**\src\*.csproj;
$(RepoRoot)src\JSInterop\**\src\*.csproj;
$(RepoRoot)src\WebEncoders\**\src\*.csproj;
$(RepoRoot)src\HealthChecks\**\src\*.csproj;
$(RepoRoot)src\Testing\**\src\*.csproj;
$(RepoRoot)src\Extensions\**\src\*.csproj;
$(RepoRoot)src\BuildAfterTargetingPack\*.csproj;
$(RepoRoot)src\OpenApi\**\src\*.csproj;
"
Exclude="
@(ProjectToBuild);
@(ProjectToExclude);
$(RepoRoot)**\node_modules\**\*;
$(RepoRoot)**\bin\**\*;
$(RepoRoot)**\obj\**\*;"
Condition=" '$(BuildMainlyReferenceProviders)' == 'true' " />

<ProjectToBuild Condition=" '$(BuildManaged)' == 'true'" Include="@(DotNetProjects)" Exclude="@(ProjectToExclude)" />
<ProjectToExclude Condition=" '$(BuildManaged)' != 'true'" Include="@(DotNetProjects)" />

<!-- Build installers after everything else got built. -->
<ProjecttoBuild Condition="'$(BuildInstallers)' == 'true'" Include="$(MSBuildThisFileDirectory)Installers.proj" BuildInParallel="false" />
<ProjectToBuild Include="$(MSBuildThisFileDirectory)Build\Native.Traversal.proj" Condition="'$(BuildNative)' == 'true'" BuildInParallel="false" />
<ProjectToBuild Include="$(MSBuildThisFileDirectory)Build\NodeJS.Traversal.proj" Condition="'$(BuildNodeJS)' == 'true'" BuildInParallel="false" />
<ProjectToBuild Include="$(MSBuildThisFileDirectory)Build\Java.Traversal.proj" Condition="'$(BuildJava)' == 'true'" BuildInParallel="false" />
<ProjectToBuild Include="$(MSBuildThisFileDirectory)Build\Managed.Traversal.proj" Condition="'$(BuildManaged)' == 'true'" BuildInParallel="false" />
<ProjectToBuild Include="$(MSBuildThisFileDirectory)Build\Installers.Traversal.proj" Condition="'$(BuildInstallers)' == 'true'" BuildInParallel="false" />
</ItemGroup>
</Otherwise>
</Choose>
Expand Down
66 changes: 66 additions & 0 deletions eng/Build/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<Project>

<!-- Don't import repo infrastructure -->
<PropertyGroup>
<ImportDirectoryPackagesProps>false</ImportDirectoryPackagesProps>
</PropertyGroup>

<Import Project="..\Common.props" />

<!--
@(RequiresDelayedBuild) projects can be extended many ways but this isn't fully automated because the new
projects likely aren't referenced initially. To add new projects, edit RequiresDelayedBuildProjects.props
manually, update the $(BuildMainlyReferenceProviders)' == 'true' item group near the bottom of this file,
or edit BuildAfterTargetingPack.csproj. Then run GenerateProjectList.ps1 (even for the first option to ensure
the format is correct) and undo any temporary changes. When complete, only BuildAfterTargetingPack.csproj and
other @(RequiresDelayedBuild) projects should mention projects listed in RequiresDelayedBuildProjects.props.
-->
<Import Project="..\RequiresDelayedBuildProjects.props" />

<!-- These projects are always excluded, even when -projects is specified on command line. -->
<ItemGroup>
<!-- Explicitly excluded projects -->
<ProjectToExclude Include="$(ProjectToExclude)" />

<!-- These projects use 'legacy' csproj, which is not supported by dotnet-msbuild. -->
<ProjectToExclude Include="
$(RepoRoot)src\Servers\HttpSys\samples\TestClient\TestClient.csproj;
$(RepoRoot)src\Middleware\WebSockets\samples\TestServer\WebSockets.TestServer.csproj;
"
Condition=" '$(MSBuildRuntimeType)' == 'Core' " />

<!-- Exclude the websockets samples for now because they use classic .csproj, which is not yet supported in our build. -->
<ProjectToExclude Include="$(RepoRoot)src\Middleware\WebSockets\samples\**\*.csproj" />

<!-- These projects are meant to be referenced only by tests or via BuildAfterTargetingPack.csproj. -->
<ProjectToExclude
Include="$(RepoRoot)src\**\testassets\**\*.*proj;
@(RequiresDelayedBuild);
"
Exclude="$(RepoRoot)src\Components\WebAssembly\testassets\WasmLinkerTest\*.*proj;
$(RepoRoot)src\Components\WebView\Samples\PhotinoPlatform\testassets\PhotinoTestApp\*.*proj;
$(RepoRoot)src\Http\Routing\test\testassets\RoutingSandbox\*.*proj;
$(RepoRoot)src\Security\Authentication\Negotiate\test\testassets\Negotiate.Client\*.*proj;
$(RepoRoot)src\Security\Authentication\Negotiate\test\testassets\Negotiate.Server\*.*proj;
" />

<!-- These projects are not meant to be built in this repo. In the Installers case, must explicitly opt in. -->
<ProjectToExclude Include="
$(RepoRoot)src\submodules\googletest\**\*.*proj;
$(RepoRoot)src\submodules\MessagePack-CSharp\**\*.*proj;
$(RepoRoot)src\Components\Web.JS\node_modules\**\*.*proj;
$(RepoRoot)src\Installers\**\*.*proj;
$(RepoRoot)src\ProjectTemplates\Web.ProjectTemplates\content\**\*.*proj;
$(RepoRoot)src\SignalR\clients\ts\**\node_modules\**\*.*proj;
" />

<!-- Exclude the benchmarks because they use <PackageReference>. -->
<ProjectToExclude Include="
$(RepoRoot)src\Components\benchmarkapps\BlazingPizza.Server\**\*.csproj;
$(RepoRoot)src\Mvc\perf\**\*.csproj;
$(RepoRoot)src\Servers\Kestrel\perf\PlatformBenchmarks\**\*.csproj;
$(RepoRoot)src\SignalR\perf\benchmarkapps\**\*.csproj;
" />
</ItemGroup>

</Project>
Loading

0 comments on commit dd10a42

Please sign in to comment.