elringus / bootsharp

Compile C# solution into single-file ES module with auto-generated JavaScript bindings and type definitions

Home Page:https://bootsharp.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when publishing to custom output path

petarpetrovt opened this issue · comments

Publishing with -o, --output <OUTPUT_DIR> option breaks the PublishDotNetJS task.

<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
	<PropertyGroup>
		<OutputType>Exe</OutputType>
		<TargetFramework>net6.0</TargetFramework>
		<ImplicitUsings>enable</ImplicitUsings>
		<Nullable>enable</Nullable>
	</PropertyGroup>
	<ItemGroup>
		<PackageReference Include="DotNetJS" Version="0.23.1" />
	</ItemGroup>
</Project>
using Microsoft.JSInterop;

Console.WriteLine("Hello, World!");

[JSInvokable]
static string Test(string value) => value;
 dotnet publish -c "Release" -o "D:\ExampleApp\.deploy\test"
...\DotNetJS.targets(23,9): error MSB4018: The "PublishDotNetJS" task failed unexpectedly.
...\DotNetJS.targets(23,9): error MSB4018: System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\ExampleApp\ExampleApp\bin\Release\net6.0\publish\wwwroot\_framework'.
...\DotNetJS.targets(23,9): error MSB4018:    at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound)
...\DotNetJS.targets(23,9): error MSB4018:    at System.IO.Enumeration.FileSystemEnumerator`1.Init()
...\DotNetJS.targets(23,9): error MSB4018:    at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized)
...\DotNetJS.targets(23,9): error MSB4018:    at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles(String directory, String expression, EnumerationOptions options)
...\DotNetJS.targets(23,9): error MSB4018:    at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTargetsearchTarget, EnumerationOptions options)
...\DotNetJS.targets(23,9): error MSB4018:    at System.IO.Directory.GetFiles(String path, String searchPattern, EnumerationOptions enumerationOptions)
...\DotNetJS.targets(23,9): error MSB4018:    at Packer.TypeUtilities.CreateLoadContext(String directory)
...\DotNetJS.targets(23,9): error MSB4018:    at Packer.NamespaceBuilder.CollectConverters(String outDir, String entryAssembly)
...\DotNetJS.targets(23,9): error MSB4018:    at Packer.PublishDotNetJS.CreateNamespaceBuilder()
...\DotNetJS.targets(23,9): error MSB4018:    at Packer.PublishDotNetJS.GenerateSources()
...\DotNetJS.targets(23,9): error MSB4018:    at Packer.PublishDotNetJS.Execute()
...\DotNetJS.targets(23,9): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
...\DotNetJS.targets(23,9): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask

.NET 7 is not supported for now.

.NET 7 is not supported for now.

Same thing happens in .NET 6.

Same problem maybe ? - #16

I was able to reproduce the issue, but not sure how to better fix it; probably something to do with the build targets. PRs are welcome.

If you change the PublishDotNetJS task's PublishDir and BlazorOutDir properties to PublishDir="$(PublishDir)/publish" and BlazorOutDir="$(PublishDir)/wwwroot/_framework" maybe? I don't have time to test it.

Yeah, I've tried tampering with that, but no luck. Don't really have time for this as well, unfortunately. Will get back to it later, unless someone will find a solution.