diff options
author | Larry Ewing <lewing@microsoft.com> | 2021-05-03 21:08:42 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-03 21:08:42 +0300 |
commit | bfd6048a605e9a0bebced7171a98bc3f04c78192 (patch) | |
tree | 96596fe2e5e166c25329cedbfea732ef120a67e1 /src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Sdk/Sdk/Sdk.targets | |
parent | bd2d701e7509c4e15e2475a7ca1f6487f7ff7663 (diff) |
[release/6.0-preview4][wasm] Fix Blazor AOT builds inside Visual Studio (#52078)v6.0.0-preview.4.21253.7
* [wasm] Build tasks for net472 also (#51959)
* [wasm] Fix loading WebAssembly tasks in VS
- In case of `WasmAppBuilder.dll`, we were packaging only the task assembly, and
`System.Reflection.MetadataLoadContext` for net472, same as net6.0 .
- But for net472, VS fails with errors like:
```
C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\6.0.0-preview.4.21222.10\Sdk\WasmApp.targets(424,4): Error MSB4018: The "PInvokeTableGenerator" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'System.Reflection.Metadata, Version=1.4.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Reflection.Metadata, Version=1.4.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at System.Reflection.MetadataLoadContext.LoadFromStreamCore(Stream peStream)
at System.Reflection.MetadataLoadContext.LoadFromAssemblyPath(String assemblyPath)
at System.Reflection.PathAssemblyResolver.Resolve(MetadataLoadContext context, AssemblyName assemblyName)
at System.Reflection.MetadataLoadContext.TryFindAssemblyByCallingResolveHandler(RoAssemblyName refName)
at System.Reflection.MetadataLoadContext.ResolveToAssemblyOrExceptionAssembly(RoAssemblyName refName)
at System.Reflection.MetadataLoadContext.TryResolveAssembly(RoAssemblyName refName, Exception& e)
at System.Reflection.MetadataLoadContext.TryGetCoreAssembly(String coreAssemblyName, Exception& e)
at System.Reflection.TypeLoading.CoreTypes..ctor(MetadataLoadContext loader, String coreAssemblyName)
at System.Reflection.MetadataLoadContext..ctor(MetadataAssemblyResolver resolver, String coreAssemblyName)
at PInvokeTableGenerator.GenPInvokeTable(String[] pinvokeModules, String[] assemblies) in /Users/radical/dev/r2/src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs:line 42
at PInvokeTableGenerator.Execute() in /Users/radical/dev/r2/src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs:line 28
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
```
- So, bundle all the dependent assemblies from the publish folder
* Address review feedback
* Update src/tasks/AotCompilerTask/MonoAOTCompiler.csproj
Co-authored-by: Daniel Plaisted <dsplaisted@gmail.com>
* Update src/tasks/AotCompilerTask/MonoAOTCompiler.csproj
Co-authored-by: Daniel Plaisted <dsplaisted@gmail.com>
* Update src/tasks/WasmAppBuilder/WasmAppBuilder.csproj
Co-authored-by: Daniel Plaisted <dsplaisted@gmail.com>
* Update src/tasks/WasmAppBuilder/WasmAppBuilder.csproj
Co-authored-by: Daniel Plaisted <dsplaisted@gmail.com>
* Apply suggestions from code review
Co-authored-by: Daniel Plaisted <dsplaisted@gmail.com>
* Use a property for net472
Co-authored-by: Ankit Jain <radical@gmail.com>
Co-authored-by: Daniel Plaisted <dsplaisted@gmail.com>
Diffstat (limited to 'src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Sdk/Sdk/Sdk.targets')
-rw-r--r-- | src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Sdk/Sdk/Sdk.targets | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Sdk/Sdk/Sdk.targets b/src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Sdk/Sdk/Sdk.targets index 9bd74455ac6..2c2959c87e5 100644 --- a/src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Sdk/Sdk/Sdk.targets +++ b/src/mono/nuget/Microsoft.NET.Runtime.WebAssembly.Sdk/Sdk/Sdk.targets @@ -1,8 +1,11 @@ <Project> <!-- Property overrides --> <PropertyGroup> - <WasmAppBuilderTasksAssemblyPath>$(MSBuildThisFileDirectory)..\tasks\WasmAppBuilder.dll</WasmAppBuilderTasksAssemblyPath> - <WasmBuildTasksAssemblyPath>$(MSBuildThisFileDirectory)..\tasks\WasmBuildTasks.dll</WasmBuildTasksAssemblyPath> + <_TasksDir Condition="'$(MSBuildRuntimeType)' == 'Core'">$(MSBuildThisFileDirectory)..\tasks\net6.0\</_TasksDir> + <_TasksDir Condition="'$(MSBuildRuntimeType)' != 'Core'">$(MSBuildThisFileDirectory)..\tasks\net472\</_TasksDir> + + <WasmAppBuilderTasksAssemblyPath>$(_TasksDir)WasmAppBuilder.dll</WasmAppBuilderTasksAssemblyPath> + <WasmBuildTasksAssemblyPath>$(_TasksDir)WasmBuildTasks.dll</WasmBuildTasksAssemblyPath> </PropertyGroup> <Import Project="$(MSBuildThisFileDirectory)\WasmApp.props" /> |