Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mdh1418
Copy link
Contributor

@mdh1418 mdh1418 commented Apr 21, 2020

Fixes #19466

It was discovered that the specified cast is not valid was being thrown because of an attempt to cast an object of type ResourceType as XmlDictionaryString. However, ResourceType is of type Enum, so instead a check for type XmlDictionaryString is performed before resorting to getting the object's name via ToString().

To test code changes, I needed to side install msbuild into my mono install via
make -j in <msbuild_repo>
<msbuild_repo>/install-mono-prefix.sh <local-mono-install>
And then in the Wasm project directory
<local-mono-install>/bin/msbuild Wasm.csproj

Steps to reproduce:

$ dotnet new -i Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.0-preview3.20168.3
$ dotnet new blazorwasm -o Wasm
$ cd Wasm
$ msbuild Wasm.csproj

output before

"/Users/mdhwang/Wasm/Wasm.csproj" (default target) (1) ->
(_GenerateBlazorBootJson target) ->
  /Users/mdhwang/.nuget/packages/microsoft.aspnetcore.components.webassembly.build/3.2.0-preview3.20168.3/targets/Blazor.MonoRuntime.targets(348,5): error : Specified cast is not valid. [/Users/mdhwang/Wasm/Wasm.csproj]

    0 Warning(s)
    1 Error(s)

Output after code changes

Wasm (Blazor output) -> /Users/mdhwang/Wasm/bin/Debug/netstandard2.1/wwwroot
Done Building Project "/Users/mdhwang/Wasm/Wasm.csproj" (default targets).

Build succeeded.
    0 Warning(s)
    0 Error(s)

@mdh1418 mdh1418 force-pushed the mdhwang/msbuild_blazor_issue branch from 0dd2a4a to 65c2e66 Compare April 21, 2020 19:28
@rodrmoya
Copy link
Contributor

@monojenkins build pkg

@steveisok steveisok merged commit 946a479 into mono:master Apr 23, 2020
@steveisok
Copy link
Contributor

@monojenkins backport 2020-02

@steveisok
Copy link
Contributor

@monojenkins backport 2019-12

@rodrmoya
Copy link
Contributor

This fixes the issue for vsmac 👍

akoeplinger pushed a commit that referenced this pull request Apr 24, 2020
akoeplinger pushed a commit that referenced this pull request Apr 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mono's msbuild can't build Blazor WASM projects

4 participants