I'm running mono 2.10.6 on openSUSE 12.1. Shouldn't there be a System.Data.dll in either /usr/lib/mono/4.0 or /usr/lib/mono/2.0 ?
I'm testing a .NET application compiled on windows. The application has a reference to automapper and I get the following error when I try to run the application:
Unhandled Exception: System.TypeInitializationException: An exception
was thrown by the type initializer for AutoMapper.Mappers.DataReaderMapper --->
System.IO.FileNotFoundException: Could not load file or assembly 'System.Data,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its
dependencies.
File name: 'System.Data, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'
Here is the output of mono --version:
linux-19xt:~ # mono --version
Mono JIT compiler version 2.10.6 (tarball Sat Oct 29 18:16:09 UTC 2011)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: debugger softdebug
LLVM: supported, not enabled.
GC: Included Boehm (with typed GC and Parallel Mark)
Install "mono-complete" or "monodevelop" and you should no longer see this issue. On unbuntu the command is...
sudo apt-get install mono-complete
or for the monodevelop ide (which also installs mono-complete)
sudo apt-get install monodevelop
I had 3 vms (1 with just the mono runtime installed, 1 with the monodevelop ide installed, and 1 with mono-complete installed) all running the exact same executable but only one that saw the issue you described was the one with only the mono runtime installed. Running the "mono-complete" command above fixed the issue.
Mono's assemblies do not have the same PublicKeyToken like Microsoft's, as Microsoft won't share the keys with Mono team, so you need to configure AutoMapper to ignore PublicKeyToken.
However, I am not sure if AutoMapper can be configured to work with Mono, as there is no official announcement anywhere, and there is an issue open on GitHub,
https://github.com/AutoMapper/AutoMapper/issues/217
And there is a mail thread about that, too,
http://groups.google.com/group/automapper-users/browse_thread/thread/773193330f7d12ef?pli=1
Related
I'm converting a WIX3/.NET4.8 installer to WIX4/.NET6. At the moment, I'm trying to see from the bundle our custom BA, which was converted to .NET6.
But I still get these errors on a fresh Win 11 VM, when launching the installer bundle:
Error 0x800700c1: Failed to load hostfxr from 'C:\Windows\TEMP\{2198BC7C-AA74-4DBC-A488-F62A6AD921AE}\.ba\hostfxr.dll'.
Error 0x800700c1: Failed to load hostfxr.
Error 0x800700c1: The self-contained .NET Core runtime failed to load. This is an unrecoverable error.
Bundle and BA settings:
the bundle use WIX 4.0.0-rc.2, and target x64
it has a BA with <bal:WixDotNetCoreBootstrapperApplicationHost SelfContainedDeployment="yes"/>
the payload is harvested by heat, with the correct <Payload bal:BAFactoryAssembly="yes" SourceFile="$(var.InstallerUIPath)\VisionMainInstallerUI.exe" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal" />
the custom BA is publish self-contained for runtime win-x86
the custom BA is targeting net6.0-windows/win-x86 (I discovered that x86 was still mandatory, as mbanative.dll is only x86)
As I have set the BA as executable (console) I'm able to launch it and see the console message from C:\Windows\TEMP{2198BC7C-AA74-4DBC-A488-F62A6AD921AE}.ba
I was previously creating a dll, but I had the same error, and the exe permit me to check that the self-contained is working and not missing anything.
I also tried the framework dependent solution, with installing the .NET runtime. But I get the same errors:
The prerequisites were successfully installed. The bootstrapper application will be reloaded.
Bootstrapper application requested to be reloaded.
Error 0x800700c1: Failed to load hostfxr from 'C:\Windows\TEMP\{6D909B1C-378D-4481-96DE-DCF7ADBDBBA4}\.ba\hostfxr.dll'.
Error 0x800700c1: Failed to load hostfxr.
Error 0x81f403ea: The prerequisites were already installed. The bootstrapper application will not be reloaded to prevent an infinite loop.
Loading prerequisite bootstrapper application because .NET Core host could not be loaded, error: 0x81f403ea.
Finally, I also tried our test program, which emulate WIX for UI testing the BA: even in self-contained, without any runtime on the VM, the BA was correctly displayed.
Even if I struggle quite a bit to get the correct self-contained output, and the needed harvesting result, I have now a BA which is working when directly called, but WIX still don't want to start it. I now don't know what to do, as the errors messages are totally misleading (hostfxr.dll being present, and the BA is starting on its own).
Update
I switched again to win-x64 (for both build and publishing self-contained) and to a dll output, and I now get the errors bellow.
mbanative.dll correctly contains "PE\0\0d", therefore it is the 64 bit version (Dependencies GUI x64 misleads by marking an issue on it)
My test application emulating WIX can also use the BA dll in x64, and the UI is displayed without issue on a VM without .NET6 runtime. It is only from the bundle itself that it isn't working.
[1E3C:08BC][2023-02-08T10:23:02]e000: error from hostfxr: You must install or update .NET to run this application.
App: C:\Windows\TEMP\{8521A191-8C06-4ED8-880A-4FE878955375}\.cr\visionCATS.exe
Architecture: x64
[1E3C:08BC][2023-02-08T10:23:02]e000: error from hostfxr: Framework: 'Microsoft.NETCore.App', version '6.0.0' (x64)
[1E3C:08BC][2023-02-08T10:23:02]e000: error from hostfxr: .NET location: C:\Windows\TEMP\{414A222D-3B83-4894-8FC0-5AD87CF921E3}\.ba\
[1E3C:08BC][2023-02-08T10:23:02]e000: error from hostfxr: No frameworks were found.
[1E3C:08BC][2023-02-08T10:23:02]e000: error from hostfxr:
Learn about framework resolution:
https://aka.ms/dotnet/app-launch-failed
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=6.0.0&arch=x64&rid=win10-x64
[1E3C:08BC][2023-02-08T10:23:02]e000: Error 0x80008096: HostfxrInitializeForApp failed
[1E3C:08BC][2023-02-08T10:23:02]e000: Error 0x80008096: Failed to initialize hostfxr.
[1E3C:08BC][2023-02-08T10:23:02]e000: Error 0x80008096: The self-contained .NET Core runtime failed to load. This is an unrecoverable error.
[1E3C:08BC][2023-02-08T10:23:02]i000: Loading prerequisite bootstrapper application because .NET Core host could not be loaded, error: 0x80008096.
I discovered that x86 was still mandatory, as mbanative.dll is only x86
This is not correct. mbanative.dll is available in x86, x64, and ARM64. As long as your BA's project file is SDK-style, it's as simple as building with the win-x64 RID for an x64 bundle.
You must build your BA in the same architecture as the bundle. That's what 0x800700c1 (ERROR_BAD_EXE_FORMAT) is trying to tell you.
I created a .net core 7 project using the entity framework core. Well, at that time I installed .net core 6 so my global ef tool was still version 6, then I updated to version 7. Here I had a problem, it said that I had not installed the framework. I decide to uninstall dotnet. Then I reinstalled sdk 7 and global ef tools. And new error appear. I try reinstall many times. But still like this, now I can't use the ef tool.
This is dotnet --info
.NET SDK:
Version: 7.0.101
Commit: bb24aafa11
Runtime Environment:
OS Name: ubuntu
OS Version: 22.04
OS Platform: Linux
RID: ubuntu.22.04-x64
Base Path: /usr/share/dotnet/sdk/7.0.101/
Host:
Version: 7.0.1
Architecture: x64
Commit: 97203d38ba
.NET SDKs installed:
7.0.101 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
DOTNET_ROOT [/usr/lib/dotnet]
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
And this is the error,
You must install .NET to run this application.
App: /home/apriza/.dotnet/tools/dotnet-ef
Architecture: x64
App host version: 7.0.1
.NET location: Not found
Learn about runtime installation:
https://aka.ms/dotnet/app-launch-failed
Download the .NET runtime:
https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=ubuntu.22.04-x64&apphost_version=7.0.1
I found my answer, I change the Root dotnet env which in /usr/share/dotnet for dotnet 7.
Run export DOTNET_ROOT=/usr/share/dotnet
After adding some nuget packages, my asp.net core app has stopped working and started to generate this error once deployed to Amazon windows server [Works OK on my dev machine (as always :-)].
Visual Studio: 2019
Target Framework: netcoreapp3.1
Installed: dotnet-hosting-5.0.7 + dotnet-sdk-5.0.401
in my deps.json file, the Microsoft.Extensions.Options always appear in the right version (3.1.10) and never in 5.0.0 version.
Any ideas where the problem might come from?
I had similar issue. The error is:
FileNotFoundException: Could not load file or assembly 'Microsoft.Extensions.Options, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified
The fix: upgrade Microsoft.Extensions.Options in Nuget from version 2.x.x to latest version (version 5.0.0) and delete all obj and bin folders and rebuild.
My projects are on .NET Framework 4.7.2. When Microsoft.Extensions.Options get updated, several other Nuget packages that were also on version 2.x.x also got updated.
After uninstalling most of the Nuget packages and reinstalling them with the right version, the problem was resolved.
I'm getting a different behavior when compiling a solution with MonoDevelop 5.1.0 and the same solution through a Cake script invoking XBuild.
When compiling the solution with MonoDevelop, everything works fine.
When compiling through my cake script, I get the following error:
The type System.IDisposable' is defined in an assembly that is not
referenced. Consider adding a reference to assembly System.Runtime,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
What could be the reason for such a different behavior?
The cake script doesn't do anything fancy. It just calls XBuild with the exact same solution.
My environment (on Fedora 23):
mono --version
Mono JIT compiler version 4.4.0 (Stable 4.4.0.142/81f38a9 Thu Apr 28 09:14:25 EDT 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen
XBuild Version:
XBuild Engine Version 14.0
Mono, Version 4.4.0.0
Copyright (C) 2005-2013 Various Mono authors
You could try to instead of using the XBuild aliases to use the Cake.Xamarin addin which provides the MDToolBuild alias for the mdtool which uses Monodevelop without GUI to compile your solution.
public static void MDToolBuild(
FilePath projectOrSolutionFile,
Action<MDToolSettings> settings
)
Example usage in a Cake script:
#addin "Cake.Xamarin"
MDToolBuild(
"./mySolution.sln",
settings=> { settings.Configuration = "Debug"; },
);
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.