question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error with blazor when moving the BIN folder

See original GitHub issue

From @rpc-scandinavia on Thursday, July 25, 2019 11:00:28 AM

Steps to reproduce

Create new Blazor clientside demo project:

dotnet new -i Microsoft.AspNetCore.Blazor.Templates::3.0.0-preview7.19365.7

dotnet new blazor --name “Test Blazor Client”

Use this CSPROJ file:

<Project>
	<PropertyGroup>
		<LangVersion>7.3</LangVersion>
		<RazorLangVersion>3.0</RazorLangVersion>
		<TargetFramework>netstandard2.0</TargetFramework>
		<GenerateBuildRuntimeConfigurationFiles>true</GenerateBuildRuntimeConfigurationFiles>
		<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
		<GenerateDocumentationFile>false</GenerateDocumentationFile>

		<!-- Move the "bin" folder. -->
		<OutDir>../.tmp/$(MSBuildProjectName)/bin</OutDir>
		<OutputPath>$(OutDir)</OutputPath>

		<!-- Move the "obj" folder. -->
		<BaseIntermediateOutputPath>../.tmp/$(MSBuildProjectName)/obj.$(TargetFramework)</BaseIntermediateOutputPath>
	</PropertyGroup>

	<!-- Import SDK properties here, when moving the "obj" folder. -->
	<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk.Web" />

	<ItemGroup>
		<!-- Required. -->
		<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview7.19365.7" />
		<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview7.19365.7" PrivateAssets="all" />
		<PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="3.0.0-preview7.19365.7" PrivateAssets="all" />
	</ItemGroup>

	<!-- Import SDK targets last, when moving the "obj" folder. -->
	<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk.Web" />
</Project>

dotnet build (OK)

dotnet run (EXCEPTION)

Expected behavior

I expect that “dotnet run” works.

Actual behavior

The “dotnet run” gives this exception:

crit: Microsoft.AspNetCore.Hosting.Diagnostics[6]
      Application startup exception
System.InvalidOperationException: Application assembly not found at /data/users/rpc@rpc-scandinavia.dk/Development/Projects3/.tmp/Test Blazor Client/bin/netstandard2.0/Test Blazor Client.dll.
   at Microsoft.AspNetCore.Blazor.DevServer.Server.Startup.ResolveApplicationAssemblyFullPath()
   at Microsoft.AspNetCore.Blazor.DevServer.Server.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment environment, IConfiguration configuration)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.<UseStartup>b__2(IApplicationBuilder app)
   at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
Unhandled exception. System.InvalidOperationException: Application assembly not found at /data/users/rpc@rpc-scandinavia.dk/Development/Projects3/.tmp/Test Blazor Client/bin/netstandard2.0/Test Blazor Client.dll.
   at Microsoft.AspNetCore.Blazor.DevServer.Server.Startup.ResolveApplicationAssemblyFullPath()
   at Microsoft.AspNetCore.Blazor.DevServer.Server.Startup.Configure(IApplicationBuilder app, IWebHostEnvironment environment, IConfiguration configuration)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.<UseStartup>b__2(IApplicationBuilder app)
   at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
   at Microsoft.AspNetCore.Blazor.DevServer.Commands.ServeCommand.Execute()
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Microsoft.AspNetCore.Blazor.DevServer.Program.Main(String[] args)

It adds a “netstandard2.0” after the “bin” directory, and if I add it in the CSPROJ file, it still adds a extra “netstandard2.0” after the “bin/netstandard2.0” directory:

<OutDir>../.tmp/$(MSBuildProjectName)/bin/$(TargetFramework)</OutDir>

crit: Microsoft.AspNetCore.Hosting.Diagnostics[6]
      Application startup exception
System.InvalidOperationException: Application assembly not found at /data/users/rpc@rpc-scandinavia.dk/Development/Projects3/.tmp/Test Blazor Client/bin/netstandard2.0/netstandard2.0/Test Blazor Client.dll.

Back to the first CSPROJ. When I use the file manager and manually creates the “missing” “netstandard2.0” directory, and copies the content from the “bin” directory into it - then “dotnet run” works.

Environment data

dotnet --info output:

.NET Core SDK (reflecting any global.json):
 Version:   3.0.100-preview7-012821
 Commit:    6348f1068a

Runtime Environment:
 OS Name:     debian
 OS Version:  10
 OS Platform: Linux
 RID:         debian.10-x64
 Base Path:   /usr/share/dotnet/sdk/3.0.100-preview7-012821/

Host (useful for support):
  Version: 3.0.0-preview7-27912-14
  Commit:  4da6ee6450

.NET Core SDKs installed:
  2.2.300 [/usr/share/dotnet/sdk]
  3.0.100-preview6-012264 [/usr/share/dotnet/sdk]
  3.0.100-preview7-012821 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.2.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.2.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-preview5-19227-01 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-preview6.19307.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-preview7.19365.7 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.2.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview5-27626-15 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview6-27804-01 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview7-27912-14 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Copied from original issue: dotnet/cli#11997

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
rpc-scandinaviacommented, Aug 15, 2019

Yes i understand, that this is not critical. I just tested, and wanted to let people reading this thread know that the error still exists.

0reactions
mkArtakMSFTcommented, Nov 6, 2019

We’re going to change a lot of things in this area, which will eliminate this issue. Closing as the relevant work is already tracked.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changing Blazor folder gives me "Cannot find the fallback ...
I created a default Blazor project and wanted to have a Web API part in the same project for prototyping purposes. So I...
Read more >
Weird errors problem with dotnet watch with blazor/wasm.
I clean everything (and even remove all bin/ obj/ .vs folders); I build the whole solution in VS --> no build errors! I...
Read more >
Blazor WASM app won't load after publish. Works fine on ...
The bin/obj folders from your solution. This folders dont appear in the solution itself you need to manually go to the folder of...
Read more >
JavaScript Errors - Telerik UI for Blazor
This indicates a timing issue (for example, low machine performance or slow network) that causes the script to load and be parsed too...
Read more >
Cannot debug net6.0-macos Apps - Developer Community
When I hit debug, the following error is shown in the Terminal: Possible reasons for this include: * You misspelled a built-in dotnet...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found