Skip to content

Commit

Permalink
Add support for using a 3.0 SDK on VS 16.4.
Browse files Browse the repository at this point in the history
- The 3.0 SDK adds RazorDeclaration files to the compile list if they exist. If a user builds in VS and then does a project level operation (adding a property group or item group to their project file) a design time build will trigger for unrelated reasons and declaration files will be included as part of the C# compilation resulting in duplicate member errors. This change ensures that even if declaration files are added we then remove them to ensure we avoid those declaration additions.
- One unfortunate aspect of this change is that declarations are added to the compile list for a brief moment resulting in errors and then are instantly removed in some situations. I say "some situations" because when this happens it is highly dependent on how / when the project system decides to perform a design time build.

dotnet/aspnetcore#14646
  • Loading branch information
NTaylorMullen committed Oct 16, 2019
1 parent 2d18ba2 commit b64c931
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ Copyright (c) .NET Foundation. All rights reserved.
<ProjectCapability Include="SupportsTypeScriptNuGet" />
</ItemGroup>

<!--
In order to properly support Blazor partial classes we need to ensure that older SDKs don't
add declaration files to the compile list. We do all the compilation work in-memory in latest
VS.
-->
<Target Name="_RemoveRazorDeclartionsFromCompile" AfterTargets="RazorGenerateComponentDeclaration">
<ItemGroup Condition="'$(DesignTimeBuild)'=='true'">
<Compile Remove="@(_RazorComponentDeclaration)" />
</ItemGroup>
</Target>

<!--
WebSdk imports these capabilities for nesting in DotNetCoreWeb projects.
Conditinally import these capabilities if the project isn't targeting the WebSdk.
Expand Down

0 comments on commit b64c931

Please sign in to comment.