This commit is contained in:
Pranav K 2020-03-25 15:37:49 -07:00
parent 861e88c61b
commit a127eb86da
No known key found for this signature in database
GPG Key ID: F748807460A27E91
10 changed files with 23 additions and 64 deletions

View File

@ -10,7 +10,6 @@
$CommonFileElements$
<file src="..\..\..\THIRD-PARTY-NOTICES.txt" />
<file src="build\**" target="build" />
<file src="buildTransitive\**" target="buildTransitive" />
<file src="targets\**" target="targets" />
<file src="$taskskDir$\**" target="tools/" />
<file src="..\..\..\Web.JS\dist\$configuration$\blazor.webassembly.js" target="tools/blazor" />

View File

@ -3,6 +3,5 @@
<PropertyGroup>
<ReferencesComponentsWebAssemblyBuild>true</ReferencesComponentsWebAssemblyBuild>
<IsPackable>false</IsPackable>
</PropertyGroup>
</Project>

View File

@ -1,4 +0,0 @@
<Project>
<Import Project="$(MSBuildThisFileDirectory)..\..\targets\All.targets" Condition="'$(ReferencesComponentsWebAssemblyBuild)' == 'true'" />
<Import Project="$(MSBuildThisFileDirectory)..\..\targets\StaticWebAssetsWokarounds.targets" Condition="'$(ReferencesComponentsWebAssemblyBuild)' != 'true'" />
</Project>

View File

@ -272,6 +272,14 @@
<ReadLinesFromFile File="$(_BlazorApplicationAssembliesCacheFile)" Condition="'@(_BlazorResolvedAssembly->Count())' == '0'">
<Output TaskParameter="Lines" ItemName="_BlazorResolvedAssembly"/>
</ReadLinesFromFile>
<ItemGroup>
<!--
Workaround for https://github.com/dotnet/aspnetcore/issues/19926. Add _BlazorResolvedAssembly to FileWrites so it doesn't
get removed during build incremantalism. We cannot do this in _ResolveBlazorRuntimeDependencies since it's incremental.
-->
<FileWrites Include="$(_BlazorResolvedAssembly)"/>
</ItemGroup>
</Target>
<Target
@ -291,9 +299,20 @@
ApplicationDependencies="@(_BlazorManagedRuntimeAssembly)"
WebAssemblyBCLAssemblies="@(_WebAssemblyBCLAssembly)">
<Output TaskParameter="Dependencies" ItemName="_BlazorResolvedAssembly" />
<Output TaskParameter="Dependencies" ItemName="_BlazorResolvedAssemblyUnlinked" />
</ResolveBlazorRuntimeDependencies>
<!--
Workaround for https://github.com/dotnet/aspnetcore/issues/19926. Using the files from their inital locations
as-is causes RazorSDK to remove files from a hosted app's publish directory. This is because files being removed
are looked up by their path. We'll copy files to an intermediate location to trip the removal code.
-->
<Copy
SourceFiles="@(_BlazorResolvedAssemblyUnlinked)"
DestinationFolder="$(_BlazorIntermediateOutputPath)unlinked">
<Output TaskParameter="CopiedFiles" ItemName="_BlazorResolvedAssembly" />
</Copy>
<WriteLinesToFile File="$(_BlazorApplicationAssembliesCacheFile)" Lines="@(_BlazorResolvedAssembly)" Overwrite="true" />
<ItemGroup>

View File

@ -1,47 +0,0 @@
<Project>
<!--
We're attempting to work around a behavior in the Razor SDK with publishing + static web assets for 3.1 applications.
Some assets such as dlls can appear both as part of a .NET project's publish output as well as the output of the wwwroot. For instance, consider the
MyApp.Shared.dll. The target in the RazorSDK: https://github.com/dotnet/aspnetcore-tooling/blob/fae9a5fdbc19edcf5b59a093ce347897a78b0386/src/Razor/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.StaticWebAssets.targets#L493-L519
unconditionally retargets these items to the wwwroot sub-directory of the publish folder.
The behavior we want is for these items to appear in both places.
-->
<Target
Name="_BlazorStashStaticWebAssets"
BeforeTargets="_StaticWebAssetsComputeFilesToPublish"
Condition="'$(RazorSdkSupportPublishingSharedBinaries)' == ''">
<ItemGroup>
<!-- These are all static web assets that are to be copied to the publish output -->
<_BlazorExternalPublishStaticWebAssets
Include="%(StaticWebAsset.FullPath)"
Condition="'%(StaticWebAsset.SourceType)' != ''" />
<!--
We want the intersection of static web assets and ResolvedFilesToPublish that are to be copied to the publish root.
_BlazorNonSharedFilesToPublish - set of items that only appear in ResolvedFileToPublish
_BlazorSharedFilesToPublish - set of items that appear in both groups are are copied to the publish root.
-->
<_BlazorNonSharedFilesToPublish Include="@(ResolvedFileToPublish)" Exclude="@(_BlazorExternalPublishStaticWebAssets)" />
<_BlazorSharedFilesToPublish
Include="@(ResolvedFileToPublish)"
Exclude="@(_BlazorNonSharedFilesToPublish)"
Condition="'%(ResolvedFileToPublish.RelativePath)' == '%(ResolvedFileToPublish.FileName)%(ResolvedFileToPublish.Extension)'"
/>
</ItemGroup>
</Target>
<Target
Name="_BlazorUnstashStaticWebAssets"
AfterTargets="_StaticWebAssetsComputeFilesToPublish"
Condition="'$(RazorSdkSupportPublishingSharedBinaries)' == '' AND '@(_BlazorSharedFilesToPublish->Count())' != '0'">
<ItemGroup>
<ResolvedFileToPublish Include="@(_BlazorSharedFilesToPublish)" />
</ItemGroup>
</Target>
</Project>

View File

@ -194,6 +194,7 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
var publishDirectory = project.PublishOutputDirectory;
// Make sure the main project exists
Assert.FileExists(result, publishDirectory, "blazorhosted.dll");
Assert.FileExists(result, publishDirectory, "RazorClassLibrary.dll");
var blazorPublishDirectory = Path.Combine(publishDirectory, "wwwroot");
Assert.FileExists(result, blazorPublishDirectory, "_framework", "blazor.boot.json");
@ -263,7 +264,6 @@ namespace Microsoft.AspNetCore.Components.WebAssembly.Build
Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "RazorClassLibrary.dll");
Assert.FileExists(result, blazorPublishDirectory, "_framework", "_bin", "Microsoft.Extensions.Logging.Abstractions.dll"); // Verify dependencies are part of the output.
// Verify static assets are in the publish directory
Assert.FileExists(result, blazorPublishDirectory, "index.html");

View File

@ -10,7 +10,7 @@ namespace blazorhosted.Server
public static void Main(string[] args)
{
Console.WriteLine(typeof(IWebHost));
Console.WriteLine(typeof(RazorClassLibrary.RCLTest));
GC.KeepAlive(typeof(RazorClassLibrary.Class1));
}
}
}

View File

@ -9,7 +9,4 @@
<ProjectReference Include="..\razorclasslibrary\RazorClassLibrary.csproj" />
</ItemGroup>
<!-- Approximating a build transitive reference -->
<Import Project="$(BlazorBuildRoot)buildTransitive\netstandard1.0\Microsoft.AspNetCore.Components.WebAssembly.Build.targets" />
</Project>

View File

@ -1,4 +0,0 @@
namespace RazorClassLibrary
{
public class RCLTest {}
}

View File

@ -10,7 +10,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="${MicrosoftAspNetCoreComponentsWebAssemblyPackageVersion}" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="${MicrosoftAspNetCoreComponentsWebAssemblyBuildPackageVersion}" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="${MicrosoftAspNetCoreComponentsWebAssemblyBuildPackageVersion}" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="${MicrosoftAspNetCoreComponentsWebAssemblyDevServerPackageVersion}" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="${MicrosoftAspNetCoreComponentsWebAssemblyAuthenticationPackageVersion}" Condition="'$(IndividualLocalAuth)' == 'true'" />
<PackageReference Include="Microsoft.Authentication.WebAssembly.Msal" Version="${MicrosoftAuthenticationWebAssemblyMsalPackageVersion}" Condition="'$(OrganizationalAuth)' == 'true' OR '$(IndividualB2CAuth)' == 'true'" />