MonoDevelop Failure "Unknown MSBuild Failure" on Linux - c#

I just installed MonoDevelop on my Ubuntu machine, and attemtepted to run a hello world, just to test it out:
using System;
public class HelloWorld
{
static public void Main ()
{
Console.WriteLine ("Hello Mono World");
}
}
...but when building it gives an "Unknown MSBuild failure" error
I have tested Mono before using MonoDevelop and verified that it works.

This is most likely due to an error or errors during compilation, which oddly enough, MonoDevelop is not telling you.
Assuming you have mono itself installed, open a terminal and compile from there(source):
mcs HelloWorld.cs

I have had similar issue with a project that used to work - it seems error is in the package NUnit, however I have not yet found a solution for it - have a look at your packages, perhaps you find your issue there

Related

How to fix "libtensorflow DllNotFoundException" when I already have the file?

I'm new to C# and I've been researching this error for a long time.
I wanted to use my trained TensorFlow model with Tensorflowsharp in Visual Studio for Mac so I created a .NET console project and installed TensorflowSharp 1.13.0 from nuget.org using the built-in package manager.
However, when I included the following code in Program.cs
using System;
using TensorFlow;
namespace ai
{
class MainClass
{
public static void Main(string[] args)
{
var graph = new TFGraph();
}
}
}
I got this error message:
Unhandled Exception:
System.DllNotFoundException: libtensorflow
at (wrapper managed-to-native) TensorFlow.TFGraph.TF_NewGraph()
at TensorFlow.TFGraph..ctor () [0x00022] in <a8cd6d02fde04a81817b4f25d24a7be9>:0
According to some of the posts that I found, this might states that libtensorflow.dylib is not in bin/Debug/ directory, but when I looked into it I found the file inside.
What am I doing wrong?
My environment setup:
Mac OSX 10.14
Visual Studio for Mac COMMUNITY 7.7.4(build 1)
Target framework: .NET 4.7.1
Thank you so much for any help!
Try change to 64 bit.
This may not correct answer to you. But give a try.
I dont have mac environment. But I tried woth .net core and TensorflowSharp and it works fine.
Same time I tried with .net framework and I also got dll not found issue and BadImageFormatException.
https://github.com/migueldeicaza/TensorFlowSharp/issues/103
https://github.com/migueldeicaza/TensorFlowSharp/issues/103

.NET project Nunit tests are failing during mono build

I'm pretty new to CI (from a brand new set up point at least). I created a project in Rider, using the default version of NUnit that is provided if you select to 'Create new NUnit Project', and I am now trying to set up an automated build for it using travis-CI.
The target .NET framework version of my project and test projects (confirmed in Project properties in Rider) is 4.5.
The version of Nunit I am using is the default version provided with Rider, 3.5.
Here is my .travis.yml build file:
language: csharp
solution: .sln
install:
- nuget restore FindWordsWithConcatenations.sln
- nuget install NUnit.Runners -Version 3.5.0 -OutputDirectory testrunner
script:
- xbuild /p:Configuration=Debug ./FindWordsWithConcatenations.sln
- mono ./testrunner/NUnit.ConsoleRunner.3.5.0/tools/nunit-agent.exe ./TestFindWordsWithConcatenations/bin/Debug/TestFindWordsWithConcatenations.dll
I confirmed on my own machine by running the nuget command that the test runner path should be correct, when I run the nunit-agent (via agent, agent-x86, or agent-console) I get the following error (locally, and on the server):
Unhandled Exception: System.FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
at System.Guid..ctor(String g)
at NUnit.Agent.NUnitTestAgent.Main(String[] args)
I've also tried running with no configuration mode specified, and with configuration mode of Debug and Release specified.
Unfortunately, the normal tactic of googling/stack overflow hasn't helped, I've seen this error in a few questions, but the cause never seems related to what I'm experiencing.
The last build of the pipeline is available to view here, all the builds thus far have failed, previous builds can be seen here.
Thanks in advance, I would be very grateful if someone had any idea about the cause of this issue, or how I could tackle the test running in a different way.
Solved it.
Updated the script section of the travis config to:
script:
- xbuild /p:Configuration=Debug ./FindWordsWithConcatenations.sln
- mono ./testrunner/NUnit.ConsoleRunner.3.5.0/tools/nunit3-console.exe ./TestFindWordsWithConcatenations/bin/Debug/TestFindWordsWithConcatenations.dll
So it's now running the correct console application. Also had to modify the test paths a bit for it to run on the server.

MonoDevelop Error: Unknown MSBuild failure. Please try building the project again

Just installed MonoDevelop and I tried to compile a simple "Hello World".
Code I used:
using System;
public class HelloWorld
{
static public void Main ()
{
Console.WriteLine ("Hello Mono World");
}
}
The error that I get is :
EmptyCSharpFile.csproj(1,1): Error: Unknown MSBuild failure. Please try building the project again (EmptyCSharpFile)
My system info:
Ubuntu 16.04 LTS , updated
The MonoDevelop and mono are freshly installed.
Mono JIT compiler version 5.0.1.1
MonoDevelop Version 5.10
I can use mcs and run it but can't use monodevelop to run it.
I did read these similar topics but no response yet:
MonoDevelop Failure "Unknown MSBuild Failure" on Linux ;
C# compile Unknown MSBuild error MonoDevelop Linux ; https://askubuntu.com/questions/73630/could-not-obtain-c-compiler-error-when-using-monodevelop
I too had the same problem when I first installed it , I assume you went straight to file -> new-> file-> general -> emptyc# file.
Instead of that, go to file->new-> solution from there choose Console C# project or simply press ctrl + shift + N choose next ,and give project name, by default the new project has a simple hello world program run it, this time it will work.(it worked for me)

PythonEngine.Initialize() fails without any error message

I am trying to embed Python in a C#-application but I cannot seem to get it to work.
My code is
using System;
using Python.Runtime;
namespace NLP.Python
{
public class PythonRumtime
{
public PythonRuntime()
{
//Location of python installation
PythonEngine.PythonHome = "C:\\Python27";
PythonEngine.Initialize();
}
}
}
When I try to create an instance of this class, the code fails without any errors when invoking PythonEngine.Initialize()
I have already added a reference to the dll-file Python.Runtime that was installed with pythonnet.
I have no idea what else to do.
I have installed pythonnet-2.1.0 via pip on a Windows 64-bit machine with a 32-bit installation of Python 2.7.11.
EDIT It appears that the error occurs at at call to Py_Initialize() in Python.Runtime.dll.
According to https://docs.python.org/2/c-api/init.html "There is no return value; it is a fatal error if the initialization fails."
This is a bug in python.org official windows installer for python 2.7.11 32-bit:
https://bugs.python.org/issue25824
Try Anaconda, maybe WinPython or python 2.7.10.

Is it possible to use the Ubuntu Linux version of MonoDevelop 6.0 watch window to inspect local variables?

I am debugging a modified C# pure .NET CoreCLR Hello World application compiled with the Roslyn csc.exe compiler. The Hello World C# program is shown below:
using System;
namespace TestingMonoDevelop6.0
{
class MainClass
{
public static void Main(string[] args)
{
string value = "one";
Console.WriteLine("Hello World!");
}
}
}
This is the Roslyn csc.exe compiler directive and result:
Building TestingMonoDevelop6.0 (Debug|x86) Executing:
/home/venkat/roslyn/Binaries/Debug/csc.exe /noconfig /nostdlib
/debug:portable /out:/home/venkat/Caisse/Caisse/bin/Debug/Caisse.exe
/r:/home/venkat/Sandbox/Microsoft.CodeAnalysis.dll
/r:/home/venkat/Sandbox/Microsoft.Data.Sq
Microsoft (R) Visual C# Compiler version 42.42.42.42
Copyright (C) Microsoft Corporation. All rights reserved.
Program.cs(9,11): warning CS0219: The variable 'value' is assigned but its value is never used
---------------------- Done ----------------------
Build successful.
Here is the Ubuntu Linux 14.04 LTS mono version and path.
[mono-2015.12.15+14.05.01]venkat#clickit:~/monodevelop$ which mono
/opt/mono-2015.12.15+14.05.01/bin/mono
So, I was told that Monodevelop 6.0 would support Roslyn csc.exe compilation s month ago in the github.io.mono.monodevelop forum. My first question is how do we ask Monodevelop 6.0 to compile with the Roslyn csc.exe compiler?
When I create the following Monodevelop 6.0 C# custom build step on
Ubuntu : /home/venkat/roslyn/Binaries/Debug/csc.exe /noconfig
/nostdlib /debug:portable
/out:/home/venkat/December14/December14/bin/Debug/Program.exe
/r:/home/venkat/Sandbox/Microsoft.CodeAnalysis.dll
/r:/home/venkat/Sandbox/Microsoft.Data.Sqlite.dll
/r:/home/venkat/.dnx/packages/System.Collections/4.0.11-beta-23409/ref/dotnet/System.Collections.dll
/r:/home/venkat/.dnx/packages/System.Collections.NonGeneric/4.0.0/ref/dotnet/System.Collections.NonGeneric.dll
/r:/home/venkat/.dnx/packages/System.ComponentModel/4.0.1-beta-23516/ref/dotnet5.1/System.ComponentModel.dll
/r:/home/venkat/Sandbox/System.dll
/r:/home/venkat/.dnx/packages/System.Data.Common/4.0.1-beta-23516/ref/dotnet5.1/System.Data.Common.dll
/r:/home/venkat/.dnx/packages/System.Xml.ReaderWriter/4.0.10-beta-22816/lib/contract/System.Xml.ReaderWriter.dll
/r:/home/venkat/.dnx/packages/System.Xml.XmlDocument/4.0.0-beta-22816/lib/contract/System.Xml.XmlDocument.dll
/r:/home/venkat/.dnx/packages/Microsoft.CSharp/4.0.1-beta-23409/ref/dotnet/Microsoft.CSharp.dll
/r:/home/venkat/Sandbox/System.Runtime.dll
/r:/home/venkat/Sandbox/System.Xml.XDocument.dll
/r:/home/venkat/Sandbox/System.Xml.dll
/r:/home/venkat/Sandbox/System.Threading.Tasks.dll
/r:/home/venkat/Sandbox/System.Linq.dll
/r:/home/venkat/Sandbox/System.Xml.dll
/r:/home/venkat/Sandbox/mscorlib.dll Program.cs ,
it successfully compiles. When I start debugging the Roslyn generated executable and using the Monodevelop Watch window on i, I get the following error
message: Unknown variable i
when I set a breakpoint on the Console.WriteLine("Hello World!") line.
My third question is do I have to create a Custom Execute Step in
Monodevelop 6.0 for Linux referencing Corerun Program.exe instead of
mono Program.exe?
The answer to question 1, "how do we ask Monodevelop 6.0 to compile with the Roslyn csc.exe compiler?" is:
/home/venkat/roslyn/Binaries/Debug/csc.exe /noconfig
/nostdlib /debug:portable
/out:/home/venkat/December14/December14/bin/Debug/Program.exe
/r:/home/venkat/Sandbox/Microsoft.CodeAnalysis.dll
/r:/home/venkat/Sandbox/Microsoft.Data.Sqlite.dll
/r:/home/venkat/.dnx/packages/System.Collections/4.0.11-beta-23409/ref/dotnet/System.Collections.dll
/r:/home/venkat/.dnx/packages/System.Collections.NonGeneric/4.0.0/ref/dotnet/System.Collections.NonGeneric.dll
/r:/home/venkat/.dnx/packages/System.ComponentModel/4.0.1-beta-23516/ref/dotnet5.1/System.ComponentModel.dll
/r:/home/venkat/Sandbox/System.dll
/r:/home/venkat/.dnx/packages/System.Data.Common/4.0.1-beta-23516/ref/dotnet5.1/System.Data.Common.dll
/r:/home/venkat/.dnx/packages/System.Xml.ReaderWriter/4.0.10-beta-22816/lib/contract/System.Xml.ReaderWriter.dll
/r:/home/venkat/.dnx/packages/System.Xml.XmlDocument/4.0.0-beta-22816/lib/contract/System.Xml.XmlDocument.dll
/r:/home/venkat/.dnx/packages/Microsoft.CSharp/4.0.1-beta-23409/ref/dotnet/Microsoft.CSharp.dll
/r:/home/venkat/Sandbox/System.Runtime.dll
/r:/home/venkat/Sandbox/System.Xml.XDocument.dll
/r:/home/venkat/Sandbox/System.Xml.dll
/r:/home/venkat/Sandbox/System.Threading.Tasks.dll
/r:/home/venkat/Sandbox/System.Linq.dll
/r:/home/venkat/Sandbox/System.Xml.dll
/r:/home/venkat/Sandbox/mscorlib.dll Program.cs
,
The answer to question 2 , "When I start debugging the Roslyn generated executable and using the Monodevelop Watch window on i, I get the following error
message: Unknown variable i
when I set a breakpoint on the Console.WriteLine("Hello World!") line.". is that the mono runtime is mdb bug free and that the Roslyn compiler on non-Window OS can produce only portable pdb's. There is an reproducible Macintosh open bug at https://bugzilla.xamarin.com/ under XamarinStudio->Debugger component.Please see https://gitter.im/dotnet/roslyn.
The answer to question 3, do I have to create a Custom Execute Step in Monodevelop 6.0 for Linux referencing Corerun Program.exe instead of mono Program.exe? Yes. In fact, if one wishes to target CoreCLR, they should use the Roslyn csc.exe compiler.

Categories

Resources