Build/Test Issues

$(MicrosoftNetCoreAppRuntimePackDir)='', and cannot find %(ResolvedRuntimePack.PackageDirectory)=

Started by kpspence on 2,887 views

.net client project Bazor webassembly is failing to build <Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

The error is:
..\..\..\..\..\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\7.0.4\Sdk\WasmApp.targets (216, 5): $(MicrosoftNetCoreAppRuntimePackDir)='', and cannot find %(ResolvedRuntimePack.PackageDirectory)=. One of these need to be set to a valid path

The file referenced translate to:
C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\7.0.4\Sdk\WasmApp.targets
This file is present.
Thanks for sharing this issue.

Can you share any more details about how this particular project was constructed? When I create a standard webassembly blazor project, I don't seem to get this issue under NCrunch. I think this is caused by a complicated set of dependencies.

If you're able to share the XML for the project, this might be enough for me to reproduce the issue.
When I create a brand new Blazor Webassembly App, .NET 7, Configure for https and enable ncrunch. I get the below error.

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!--This is a custom NCrunch file format-->
<solution path="C:\data\vsTest\NcrunchBugBlazorApp1\NcrunchBugBlazorApp1.sln">
<project name="NcrunchBugBlazorApp1" path="C:\data\vsTest\NcrunchBugBlazorApp1\NcrunchBugBlazorApp1\NcrunchBugBlazorApp1.csproj">
<loadErrors />
<build>
<buildTime>00:00:02.790</buildTime>
<errors>
<error>C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\7.0.4\Sdk\WasmApp.targets (216): $(MicrosoftNetCoreAppRuntimePackDir)='', and cannot find %(ResolvedRuntimePack.PackageDirectory)=. One of these need to be set to a valid path</error>
</errors>
<warnings />
</build>
<tests />
</project>
</solution>

My project is here: https://github.com/kpspence/ncrunch

I think it has to do with configuration some how because it was working on my previous laptop. Just at a loss for what is different.

Edited

Thanks for sharing the sample project.

Interesting, the project doesn't seem to reproduce the error on my machine. I've tried variations in install state (i.e. VS with blazor installed and without), yet for some reason my build logic doesn't seem to reference or include the file responsible. There must be an environmental or installation component to this issue that I can't figure out.

What happens if you use the NCrunch 'Custom build properties' setting to set the 'IsWasmProject' property to 'false'?

Edited

After comparing the two computers:

Renaming C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk to C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk2 fixed the issue

Setting the NCrunch 'Custom build properties' setting to set the 'IsWasmProject' property to 'false'? This also worked.

Thank you.

Post a reply

Log in to reply.