Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
/src/WebSdk/ @vijayrkn
/src/Tests/Microsoft.NET.Sdk.Publish.Tasks.Tests/ @vijayrkn

/src/BlazorWasmSdk @captainsafia
/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests @captainsafia
/src/Assets/TestProjects/BlazorHosted @captainsafia
/src/Assets/TestProjects/BlazorHostedRID @captainsafia
/src/Assets/TestProjects/BlazorWasmMinimal @captainsafia
/src/Assets/TestProjects/BlazorWasmWithLibrary @captainsafia
/src/BlazorWasmSdk @captainsafia, @pranavkm, mkArtakMSFT
/src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests @captainsafia, @pranavkm, mkArtakMSFT
/src/Assets/TestProjects/BlazorHosted @captainsafia, @pranavkm, mkArtakMSFT
/src/Assets/TestProjects/BlazorHostedRID @captainsafia, @pranavkm, mkArtakMSFT
/src/Assets/TestProjects/BlazorWasmMinimal @captainsafia, @pranavkm, mkArtakMSFT
/src/Assets/TestProjects/BlazorWasmWithLibrary @captainsafia, @pranavkm, mkArtakMSFT

/src/Cli/dotnet/commands/dotnet-add/dotnet-add-package @dotnet/nuget-team
/src/Tests/dotnet-add-package.Tests @dotnet/nuget-team
Expand Down
1 change: 0 additions & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@
<MicrosoftAspNetCoreMvcApiAnalyzersPackageVersion>6.0.0-alpha.1.20629.3</MicrosoftAspNetCoreMvcApiAnalyzersPackageVersion>
<MicrosoftAspNetCoreAnalyzersPackageVersion>6.0.0-alpha.1.20629.3</MicrosoftAspNetCoreAnalyzersPackageVersion>
<MicrosoftNETSdkRazorPackageVersion>6.0.0-alpha.1.20629.3</MicrosoftNETSdkRazorPackageVersion>
<MicrosoftNETSdkBlazorWebAssemblyPackageVersion>6.0.0-alpha.1.20629.3</MicrosoftNETSdkBlazorWebAssemblyPackageVersion>
</PropertyGroup>
<PropertyGroup>
<!-- Dependencies from https://github.com/dotnet/wpf -->
Expand Down
9 changes: 9 additions & 0 deletions sdk.sln
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Sdk.BlazorWeb
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BlazorWasmSdk", "BlazorWasmSdk", "{9D207DE3-6D6E-4CD8-B3A4-E88FD255FCB0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Targets", "Targets", "{35D87DC9-B492-43B6-9FB3-F3ADFC162193}"
ProjectSection(SolutionItems) = preProject
src\BlazorWasmSdk\Targets\BlazorWasm.web.config = src\BlazorWasmSdk\Targets\BlazorWasm.web.config
src\BlazorWasmSdk\Targets\Microsoft.NET.Sdk.BlazorWebAssembly.Current.props = src\BlazorWasmSdk\Targets\Microsoft.NET.Sdk.BlazorWebAssembly.Current.props
src\BlazorWasmSdk\Targets\Microsoft.NET.Sdk.BlazorWebAssembly.Current.targets = src\BlazorWasmSdk\Targets\Microsoft.NET.Sdk.BlazorWebAssembly.Current.targets
src\BlazorWasmSdk\Targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets = src\BlazorWasmSdk\Targets\Microsoft.NET.Sdk.BlazorWebAssembly.ServiceWorkerAssetsManifest.targets
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -583,6 +591,7 @@ Global
{CB7F74C6-BF0A-4CD6-94B4-BBF47AF9BB56} = {580D1AE7-AA8F-4912-8B76-105594E00B3B}
{6CFB4CBF-1618-4D13-8880-518939E1809A} = {9D207DE3-6D6E-4CD8-B3A4-E88FD255FCB0}
{9D207DE3-6D6E-4CD8-B3A4-E88FD255FCB0} = {22AB674F-ED91-4FBC-BFEE-8A1E82F9F05E}
{35D87DC9-B492-43B6-9FB3-F3ADFC162193} = {9D207DE3-6D6E-4CD8-B3A4-E88FD255FCB0}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FB8F26CE-4DE6-433F-B32A-79183020BBD6}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Copyright (c) .NET Foundation. All rights reserved.
<BlazorWebAssemblySdkDirectoryRoot Condition="'$(BlazorWebAssemblySdkDirectoryRoot)'==''">$(MSBuildThisFileDirectory)..\</BlazorWebAssemblySdkDirectoryRoot>
<_BlazorWebAssemblySdkTasksTFM Condition=" '$(MSBuildRuntimeType)' == 'Core'">net6.0</_BlazorWebAssemblySdkTasksTFM>
<_BlazorWebAssemblySdkTasksTFM Condition=" '$(MSBuildRuntimeType)' != 'Core'">net46</_BlazorWebAssemblySdkTasksTFM>
<_BlazorWebAssemblySdkTasksAssembly>$(BlazorWebAssemblySdkDirectoryRoot)tasks\$(_BlazorWebAssemblySdkTasksTFM)\Microsoft.NET.Sdk.BlazorWebAssembly.Tasks.dll</_BlazorWebAssemblySdkTasksAssembly>
<_BlazorWebAssemblySdkToolAssembly>$(BlazorWebAssemblySdkDirectoryRoot)tools\net6.0\Microsoft.NET.Sdk.BlazorWebAssembly.Tools.dll</_BlazorWebAssemblySdkToolAssembly>
<_BlazorWebAssemblySdkTasksAssembly>$(BlazorWebAssemblySdkDirectoryRoot)tools\$(_BlazorWebAssemblySdkTasksTFM)\Microsoft.NET.Sdk.BlazorWebAssembly.Tasks.dll</_BlazorWebAssemblySdkTasksAssembly>
<_BlazorWebAssemblySdkToolAssembly>$(BlazorWebAssemblySdkDirectoryRoot)tools\net6.0\Microsoft.NET.Sdk.BlazorWebAssembly.Tool.dll</_BlazorWebAssemblySdkToolAssembly>
</PropertyGroup>

<UsingTask TaskName="Microsoft.NET.Sdk.BlazorWebAssembly.GenerateBlazorWebAssemblyBootJson" AssemblyFile="$(_BlazorWebAssemblySdkTasksAssembly)" />
Expand Down Expand Up @@ -463,7 +463,7 @@ Copyright (c) .NET Foundation. All rights reserved.
</JoinItems>

<PropertyGroup>
<_BlazorPublishOutputPath Condition="'$(StaticWebAssetBasePath)' != '/'">wwwroot\$(StaticWebAssetBasePath.Replace('/', '\'))</_BlazorPublishOutputPath>
<_BlazorPublishOutputPath Condition="'$(StaticWebAssetBasePath)' != '/'">wwwroot\$(StaticWebAssetBasePath.Replace('/', '\').Trim('\'))\</_BlazorPublishOutputPath>
<_BlazorPublishOutputPath Condition="'$(StaticWebAssetBasePath)' == '/'">wwwroot\</_BlazorPublishOutputPath>
<_BlazorFrameworkPublishPath>$(_BlazorPublishOutputPath)_framework\</_BlazorFrameworkPublishPath>
</PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/BlazorWasmSdk/Tasks/BrotliCompress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ protected override string GenerateResponseFileCommands()
{
var input = FilesToCompress[i];
var inputFullPath = input.GetMetadata("FullPath");
System.Console.WriteLine($"inputFullPath: {inputFullPath}");
var relativePath = input.GetMetadata("RelativePath");
var outputRelativePath = Path.Combine(OutputDirectory, CalculateTargetPath(inputFullPath, ".br"));
var outputFullPath = Path.GetFullPath(outputRelativePath);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,54 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project>

<PropertyGroup>
<BlazorWasmSdkRoot>$(RepoRoot)\src\BlazorWasmSdk\</BlazorWasmSdkRoot>
<PackageId>Microsoft.NET.Sdk.BlazorWebAssembly</PackageId>
<OutDirName>$(Configuration)\Sdks\$(PackageId)\tools</OutDirName>
</PropertyGroup>

<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<Description>SDK for building and publishing Blazor WebAssembly applications.</Description>
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.NET.Sdk.BlazorWebAssembly</RootNamespace>
<TargetFrameworks>$(SdkTargetFramework);net472</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<EnableDefaultItems>false</EnableDefaultItems>
<GenerateDependencyFile>false</GenerateDependencyFile>
<IncludeBuildOutput>false</IncludeBuildOutput>

<NoPackageAnalysis>true</NoPackageAnalysis>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<!-- MSBuild Task DLLs need to be versioned with every build -->
<AutoGenerateAssemblyVersion>true</AutoGenerateAssemblyVersion>
</PropertyGroup>

<PropertyGroup>
<OutputPath>$(BaseOutputPath)</OutputPath>
<IsPackable>true</IsPackable>
<PackageLayoutOutputPath>$(ArtifactsBinDir)$(Configuration)\Sdks\$(PackageId)\</PackageLayoutOutputPath>
<NoDefaultExcludes>true</NoDefaultExcludes>
</PropertyGroup>

<PropertyGroup>
<Description>SDK for building and publishing Blazor WebAssembly applications.</Description>
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.NET.Sdk.BlazorWebAssembly</RootNamespace>
</PropertyGroup>

<PropertyGroup>
<TargetFrameworks>$(SdkTargetFramework);net46</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<AdditionalContent Include="$(BlazorWasmSdkRoot)Targets\**\*.*">
<Pack>true</Pack>
<PackagePath>targets</PackagePath>
</AdditionalContent>
<AdditionalContent Include="$(BlazorWasmSdkRoot)Sdk\**\*.*">
<Pack>true</Pack>
<PackagePath>Sdk</PackagePath>
</AdditionalContent>
</ItemGroup>

<ItemDefinitionGroup>
<PackageReference>
<PrivateAssets>All</PrivateAssets>
Expand All @@ -38,15 +57,27 @@
</ItemDefinitionGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildFrameworkVersion)" ExcludeAssets="Runtime" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildUtilitiesCoreVersion)" ExcludeAssets="Runtime" />
<PackageReference Include="Microsoft.Build.Framework" Version="15.8.166" ExcludeAssets="Runtime" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="15.8.166" ExcludeAssets="Runtime" />
</ItemGroup>

<ItemGroup>
<Compile Include="**\*.cs" />
</ItemGroup>

<Target Name="CopyAdditionalFilesToLayout" Condition="'$(TargetFramework)' == ''" AfterTargets="Build" Inputs="@(LayoutFile)" Outputs="@(LayoutFile-&gt;'$(PackageLayoutOutputPath)%(TargetPath)')">
<Target Name="PrepareAdditionalFilesToLayout" BeforeTargets="AssignTargetPaths">
<ItemGroup>
<LayoutFile Include="@(AdditionalContent)" Condition="'%(AdditionalContent.PackagePath)' != '' and '%(AdditionalContent.PackagePath)' != 'Icon.png'">
<TargetPath>%(AdditionalContent.PackagePath)\%(AdditionalContent.RecursiveDir)%(AdditionalContent.Filename)%(AdditionalContent.Extension)</TargetPath>
</LayoutFile>
</ItemGroup>
</Target>

<Target Name="CopyAdditionalFilesToLayout"
Condition="'$(TargetFramework)' == ''"
DependsOnTargets="PrepareAdditionalFilesToLayout"
AfterTargets="Build" Inputs="@(LayoutFile)"
Outputs="@(LayoutFile-&gt;'$(PackageLayoutOutputPath)%(TargetPath)')">
<Copy SourceFiles="@(LayoutFile)" DestinationFiles="@(LayoutFile-&gt;'$(PackageLayoutOutputPath)%(TargetPath)')">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
Expand All @@ -58,4 +89,5 @@
</ItemGroup>
</Target>

<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>
14 changes: 7 additions & 7 deletions src/BlazorWasmSdk/Tool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,28 @@ public static int Main(string[] args)
description: "System.IO.Compression.CompressionLevel for the Brotli compression algorithm.");
var sourcesOption = new Option<List<string>>(
"-s",
description: "A list of files to compress.");
description: "A list of files to compress.") { AllowMultipleArgumentsPerToken = false };
var outputsOption = new Option<List<string>>(
"-o",
"The filenames to output the compressed file to.");
"The filenames to output the compressed file to.") { AllowMultipleArgumentsPerToken = false };

brotli.Add(compressionLevelOption);
brotli.Add(sourcesOption);
brotli.Add(outputsOption);

rootCommand.Add(brotli);

brotli.Handler = CommandHandler.Create<CompressionLevel, List<string>, List<string>>((compressionLevel, sources, outputs) =>
brotli.Handler = CommandHandler.Create<CompressionLevel, List<string>, List<string>>((c, s, o) =>
{
Parallel.For(0, sources.Count, i =>
Parallel.For(0, s.Count, i =>
{
var source = sources[i];
var output = outputs[i];
var source = s[i];
var output = o[i];

using var sourceStream = File.OpenRead(source);
using var fileStream = new FileStream(output, FileMode.Create);

using var stream = new BrotliStream(fileStream, compressionLevel);
using var stream = new BrotliStream(fileStream, c);

sourceStream.CopyTo(stream);
});
Expand Down
1 change: 0 additions & 1 deletion src/Layout/redist/targets/BundledSdks.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<ItemGroup>
<BundledSdk Include="NuGet.Build.Tasks.Pack" Version="$(NuGetBuildTasksPackPackageVersion)" />
<BundledSdk Include="Microsoft.NET.Sdk.Razor" Version="$(MicrosoftNETSdkRazorPackageVersion)" />
<BundledSdk Include="Microsoft.NET.Sdk.BlazorWebAssembly" Version="$(MicrosoftNETSdkBlazorWebAssemblyPackageVersion)" />
<BundledSdk Include="Microsoft.NET.Sdk.WindowsDesktop" Version="$(MicrosoftNETSdkWindowsDesktopPackageVersion)" Condition="'$(DotNetBuildFromSource)' != 'true'" />
<BundledSdk Include="FSharp.NET.Sdk" Version="1.0.4-bundled-0100" />
<BundledSdk Include="Microsoft.Docker.Sdk" Version="1.1.0" />
Expand Down
6 changes: 3 additions & 3 deletions src/Layout/redist/targets/GenerateLayout.targets
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
</Target>

<Target Name="PublishBlazorWasmTools"
BeforeTargets="Build">
BeforeTargets="PublishNetSdks">
<MSBuild
Targets="Publish"
Projects="$(RepoRoot)/src/BlazorWasmSdk/Tool/Microsoft.NET.Sdk.BlazorWebAssembly.Tool.csproj"
Expand All @@ -190,7 +190,7 @@

<Target Name="MoveBlazorWasmTools" AfterTargets="PublishBlazorWasmTools">
<ItemGroup>
<_WebAssemblyToolsOutput Include="$(ArtifactsBinDir)Microsoft.NET.Sdk.BlazorWebAssembly.Tool\$(Configuration)\$(SdkTargetFramework)\publish\Microsoft.*" />
<_WebAssemblyToolsOutput Include="$(ArtifactsBinDir)Microsoft.NET.Sdk.BlazorWebAssembly.Tool\$(Configuration)\$(SdkTargetFramework)\publish\*.*" />
</ItemGroup>

<Error
Expand All @@ -199,7 +199,7 @@

<Copy
SourceFiles="@(_WebAssemblyToolsOutput)"
DestinationFolder="$(NETSdkBlazorWasmSourceRoot)\tools\$(SdkTargetFramework)\"
DestinationFolder="$(ArtifactsBinDir)$(Configuration)\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\tools\$(SdkTargetFramework)\"
SkipUnchangedFiles="true" />
</Target>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<EnableDefaultItems>false</EnableDefaultItems>
<OutDirName>Tests\$(MSBuildProjectName)</OutDirName>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,12 @@ public void Publish_WithNoBuild_Works()
VerifyCompression(testInstance, blazorPublishDirectory);
}

[Fact]
public void Publish_WithStaticWebBasePathWorks()
[Theory]
[InlineData("different-path")]
[InlineData("/different-path")]
[InlineData("different-path/")]
[InlineData("/different-path/")]
public void Publish_WithStaticWebBasePathWorks(string basePath)
{
// Arrange
var testAppName = "BlazorWasmWithLibrary";
Expand All @@ -263,7 +267,7 @@ public void Publish_WithStaticWebBasePathWorks()
{
var ns = project.Root.Name.Namespace;
var itemGroup = new XElement(ns + "PropertyGroup");
itemGroup.Add(new XElement("StaticWebAssetBasePath", @"different-path/"));
itemGroup.Add(new XElement("StaticWebAssetBasePath", basePath));
project.Root.Add(itemGroup);
}

Expand Down Expand Up @@ -310,8 +314,12 @@ public void Publish_WithStaticWebBasePathWorks()
staticWebAssetsBasePath: "different-path");
}

[Fact]
public void Publish_Hosted_WithStaticWebBasePathWorks()
[Theory]
[InlineData("different-path")]
[InlineData("/different-path")]
[InlineData("different-path/")]
[InlineData("/different-path/")]
public void Publish_Hosted_WithStaticWebBasePathWorks(string basePath)
{
var testAppName = "BlazorWasmWithLibrary";
var testInstance = _testAssetsManager.CopyTestAsset(testAppName)
Expand All @@ -323,7 +331,7 @@ public void Publish_Hosted_WithStaticWebBasePathWorks()
{
var ns = project.Root.Name.Namespace;
var itemGroup = new XElement(ns + "PropertyGroup");
itemGroup.Add(new XElement("StaticWebAssetBasePath", @"different-path/"));
itemGroup.Add(new XElement("StaticWebAssetBasePath", basePath));
project.Root.Add(itemGroup);
}

Expand Down