Running in assembly related Issues while publishing/compiling a blazor client application in release mode - mono

I am getting below errors while trying to build/publish a blazer application (client version) in release mode. The application is running fine and is getting published as well in debug mode.
Unhandled exception. Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'ExistingLibraryBuiltIn.NetFramework4.7.1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' C:\...\.nuget\packages\microsoft.aspnetcore.components.webassembly.build\3.2.0-rc1.20223.4\targets\Blazor.MonoRuntime.targets 284
ILLink failed with exit code -532462766.
Project Details -
VS Version - 16.7.0 Preview 2.0,
Target Framework - .Net Standard 2.1

Related

.NET Core 2.0 console app: Could not load file or assembly System.ServiceModel version 3.0.0.0

Possibly related to ASP.NET Core 2.0 Could not load file or assembly System.ServiceModel
We are currently developing a console app using .NET Core 2.0 as framework that references a .NET Framework 3.5 WCF library.
When we execute the console app an error appears in the debug output:
Could not load file or assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
What do we have to do to get this assembly visible to the Dotnet Core 2.0 console app?

AspNet Core 1.1. referencing .net 4.6 project fails on runtime

I have an ASP.NET Core 1.1. web application and I have successfully referenced it to a .NET 4.6 class library.
When a call is made from one of the web application's controllers to one of the public methods of .NET 4.6 class library I am getting the following exception:
"Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified."
Any ideas, how I can correct that?

What's the difference between dnxcore50 on Windows and Linux?

It looks like System.Data.SqlClient is defined in dnxcore50 when running on Windows, but not on Linux.
Aren't they both corefx?
For example, an app that targets dnxcore50 beta7, or beta8, and references System.Data.SqlClient will build and run fine in Windows, but on Linux will compile fine only to at execution throw this runtime error;
An unhandled exception has occurred: Could not load file or assembly
'System.Data.SqlClient, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
The system cannot find the file specified.
With ASP.NET 5 RC1, SqlClient is now cross platform and so you can query Microsoft SQL Server from Linux and Mac too.
More info in the release notes below (look for Cross-platform SQL Client)
http://blogs.msdn.com/b/webdev/archive/2015/11/18/announcing-asp-net-5-release-candidate-1.aspx

How to successfully host ASP.NET MVC4 RC on Mono 2.10.8

I'm trying to host a ASP.NET MVC4 RC project on top of Mono 2.10.8.1. I'm getting the following exception when I access the app for the first time:
Missing method System.Web.Security.FormsAuthentication::get_IsEnabled() in assembly /usr/lib/mono/gac/System.Web/4.0.0.0__b03f5f7f11d50a3a/System.Web.dll, referenced in assembly /tmp/root-temp-aspnet-0/eaee30a1/assembly/shadow/5cf10065/40974e7d_1c664e18_00000001/System.Web.Http.WebHost.dll
According to http://www.mono-project.com/Compatibility this should be implemented in Mono 2.10.8. Microsoft lists the property as .NET Framework 4.0: http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.isenabled.aspx
Is there a work-around of some kind, or is it just not possible to host MVC4 on Mono at this time?
I should note that I'm getting this problem both when using XSP4 and mod_mono on Apache2.
Mono version is the following:
Mono JIT compiler version 2.10.8.1 (Debian 2.10.8.1-1~dhx1~lucid1)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: x86
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: Included Boehm (with typed GC and Parallel Mark)
TL/DR: Running MVC4 under Mono is still not recommended, run MVC3 instead.
Long story: at the time Mono 2.10.x was released, Microsoft had not fully released the ASP.NET stack as open source (Razor was one of the components that was still closed source).
Recently Microsoft finally opensourced the full stack, and Mono has included it in their tree, however this has happened only in master branch (and only preview versions of Mono 2.11.x include it). Besides, the async APIs are not yet implemented in Mono (and MVC4 depends on them) so then the best bet for you is use MVC3 for now, with Mono 3.0.1 version.
Even longer story: http://tirania.org/blog/archive/2012/Mar-28.html
It is now possible, and is almost straightforward on the current mono release and using NuGet. The fact that MS have put MVC4 stuff on NuGet helps. I've put working templates for .Net 4 & .Net 4.5 on github https://github.com/chrisfcarroll/AspNetTemplatesForMono. There are a couple of gotchas, but they're addressed in notes.
You need to compile the new XSP form the sources
git clone git://github.com/mono/xsp.git
cd xsp
./autogen.sh --prefix=/opt
make
sudo make install
This version needs enough permission to run, sudo..., otherwise you will get the System.IO.FileNotFoundException message.
Then add these lines to your web.config file
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
To eliminate CS0234: The type or namespace name Helpers does not exist in the namespace System.Web. exception.
Then remove these assemblies from your bin folder (if those are copied form the Windows machine)
Microsoft.Web.Infrastructure.dll
System.Net.Http.dll
System.Net.Http.Formatting.dll
System.Web.Http.dll
System.Web.Http.WebHost.dll
This will remove Missing method System.Web.Security.FormsAuthentication::get_IsEnabled() exception and many other could not load type xyz exceptions.
Please follow below link to host MVC 4 Application on Mono successfully.
http://www.bgsoftfactory.net/run-asp-net-mvc-4-with-mysql-on-linux/
It provides step by step configuration on Linux server.
Remove reference to System.Web.Http and System.Web.Http.Host if you do not need them (WebApi library).
You may need to remove WebApiConfig.cs in the App_Start folder and the references in the Global.asax.
But after that your project will work without any other issues.

Problem with Castle configuration in TFS2010 build machine?

I have a system that implements several web services in C# 4.0. The solution is being compiled under TFS2010's build mechanism. After the build, some low level tests are run.
These run correctly in developer studio (on Windows 7), but for some reason fail under MSTest on the build machine (Windows Server 2008 R2). Some logging shows that it's caused by a System.IO.FileNotFoundException exception on an assembly at the bottom layer (see exception stack below).
Do you think it's a versioning problem? Is Windows Server 2008 R2 doing something completely different that the Castle asembly doesn't grok?
Type: System.Reflection.TargetInvocationException
Error Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
Type: Castle.MicroKernel.SubSystems.Conversion.ConverterException
Error Message: Could not convert from 'MockRepository' to System.Type.
Source: Castle.Windsor
Type: System.IO.FileNotFoundException
Error Message: Could not load file or assembly 'VsWebSite.Interop, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Source: mscorlib
EDIT: I never did find out what the problem was. I had a large amount of refactoring to do and, after that was over, the issue disappeared.
Something is referencing VsWebSite.Interop.dll (definitely not any Castle assembly) which is a Visual Studio assembly, and you probably don't have Visual Studio installed on your build server. Remove that reference.