Build MonoDevelop on Debian/Jessie using Mono 4.3.3 - c#

I'am trying to build MonoDevelop(master branch) on my Debian/Jessie box.
So far I managed to get it compiled, but it shows me 5 errors and 1 warning.
Build FAILED.
Warnings:
/home/max/monodevelop/main/Main.sln (default targets) ->
(Build target) ->
/home/max/monodevelop/main/external/RefactoringEssentials/RefactoringEssentials/RefactoringEssentials.csproj (default targets) ->
/usr/lib/mono/4.5/Microsoft.Common.targets (GetReferenceAssemblyPaths target) ->
/usr/lib/mono/4.5/Microsoft.Common.targets: warning : Unable to find framework corresponding to the target framework moniker '.NETPortable,Version=v4.5,Profile=Profile7'. Framework assembly references will be resolved from the GAC, which might not be the intended behavior.
Errors:
/home/max/monodevelop/main/Main.sln (default targets) ->
(Build target) ->
/home/max/monodevelop/main/src/addins/NUnit/NUnitRunner/NUnitRunner.csproj (default targets) ->
/usr/lib/mono/4.5/Microsoft.CSharp.targets (CoreCompile target) ->
NUnitTestRunner.cs(105,44): error CS0103: The name `LoggingThreshold' does not exist in the current context
NUnitTestRunner.cs(105,14): error CS1501: No overload for method `Run' takes `4' arguments
NUnitTestRunner.cs(124,25): error CS0246: The type or namespace name `ParameterizedMethodSuite' could not be found. Are you missing an assembly reference?
NUnitTestRunner.cs(124,25): error CS0150: A constant value is expected
/home/max/monodevelop/main/Main.sln (default targets) ->
(Build target) ->
/home/max/monodevelop/main/external/RefactoringEssentials/RefactoringEssentials/RefactoringEssentials.csproj (default targets) ->
/usr/lib/mono/4.5/Microsoft.Common.targets (GetReferenceAssemblyPaths target) ->
/usr/lib/mono/4.5/Microsoft.Common.targets: error : PCL Reference Assemblies not installed.
1 Warning(s)
5 Error(s)
Time Elapsed 00:00:07.6677160
Makefile:1086: recipe for target 'sln_build' failed
make[2]: *** [sln_build] Error 1
make[2]: Leaving directory '/home/max/monodevelop/main'
Makefile:645: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/max/monodevelop/main'
Makefile:23: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
I suggest that it has something to do with nunit which shipps with mono and PCL Reference Assemblies which are not installed. I know MS released PCL Reference Assemblies as an installer, but I can't install them on my linux box. Because its an .NET needed msi installer or sort of.

The solution is to download
http://github.com/directhex/xamarin-referenceassemblies-pcl
using git. Adjust the control file under debian/ directory not depending on
mono-xbuild
Build the debian package using
debuild -i -us -uc -b
then installing the package using
dpkg -i <package>
What the installation does is to copy the PCL reference assemblies to
/usr/lib/mono/xbuild-frameworks/.NETPortable.
After this compiling MonoDevelop does not show error about missing PCL reference assemblies. Hope that helps anyone trying to build latest MonoDevelop.

Related

Problems running a C# C++/CLI wrapper solution on x64

I am using Visual Studio 2019 version 16.11.10. I am trying to do a small C# project that can communicate with an C++ object with functions. What i understand was that i have to use something called C++/CLI wrapper.
I tried to follow this tutorial: redgate - Creating a C++/CLI Wrapper
The project consists of one solution with 3 projects. The three projects are Sandbox (C# project), Wrapper (C++/CLI wrapper project) and Core (C++ project).
A detail about the Core-project is that you have to configure it as Static library (.lib). To do it you will Right-click on the Core-project and select Properties. Under General we select Static library (.lib).
A detail about the Wrapper-project is that you have select “Not Using Precompiled Headers” at Properties->C/C++->Precompiled Headers
I have done some kind of x86/x64 “alignment” for the projects in the Configuration Manager. If i select x86 as solution platform i will set Sandbox to x86, Core to Win32 and Wrapper to Win32. If i select x64 as solution platform i will set Sandbox, Core and Wrapper to x64
I had problems to run the solution on x86. The problem was that Wrapper and Sandbox used different .NET-versions. So now, if both use the same .NET-version (for example .NET 3.1 or .NET 5) for Wrapper and Sandbox, then i can run the solution on x86.
I have problems running the solution on x64. When i run it i get this error:
Microsoft Visual Studio
The debug executable
'C:\Users\Philip\kodning2\vsworkdir\egnaTestProjekt\Solution_CLIExample3\Core\Sandbox\bin\x64\Debug\net5.0\Sandbox.exe'
specified in the 'Sandbox' debug profile does not exist.
OK
I also get these Errors:
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol main referenced in function "int __cdecl invoke_main(void)" (?invoke_main##YAHXZ) Core C:\Users\Philip\kodning2\vsworkdir\egnaTestProjekt\Solution_CLIExample3\Core\Core\MSVCRTD.lib(exe_main.obj) 1
Error C1010 unexpected end of file while looking for precompiled header. Did you forget to add '#include "pch.h"' to your source? Wrapper C:\Users\Philip\kodning2\vsworkdir\egnaTestProjekt\Solution_CLIExample3\Core\Wrapper\Entity.cpp 16
Error CS0246 The type or namespace name 'Entity' could not be found (are you missing a using directive or an assembly reference?) Sandbox C:\Users\Philip\kodning2\vsworkdir\egnaTestProjekt\Solution_CLIExample3\Core\Sandbox\Program.cs 9 Active
Error CS0246 The type or namespace name 'Entity' could not be found (are you missing a using directive or an assembly reference?) Sandbox C:\Users\Philip\kodning2\vsworkdir\egnaTestProjekt\Solution_CLIExample3\Core\Sandbox\Program.cs 9 Active
Error CS0246 The type or namespace name 'CLI' could not be found (are you missing a using directive or an assembly reference?) Sandbox C:\Users\Philip\kodning2\vsworkdir\egnaTestProjekt\Solution_CLIExample3\Core\Sandbox\Program.cs 2 Active
Error CS0006 Metadata file 'C:\Users\Philip\kodning2\vsworkdir\egnaTestProjekt\Solution_CLIExample3\Core\x64\Debug\Wrapper.dll' could not be found Sandbox C:\Users\Philip\kodning2\vsworkdir\egnaTestProjekt\Solution_CLIExample3\Core\Sandbox\CSC 1 Active
Error LNK1120 1 unresolved externals Core C:\Users\Philip\kodning2\vsworkdir\egnaTestProjekt\Solution_CLIExample3\Core\x64\Debug\Core.exe 1
How to be able to run this solution as x64? What i am doing wrong?
EDIT1:
As Alan Birtles suggested, i post the text from the Output-window:
Build started...
1>------ Build started: Project: Core, Configuration: Debug x64 ------
Restored C:\Users\Philip\kodning2\vsworkdir\egnaTestProjekt\Solution_CLIExample3\Core\Sandbox\Sandbox.csproj (in 3 ms).
1>Entity.cpp
1>MSVCRTD.lib(exe_main.obj) : error LNK2019: unresolved external symbol main referenced in function "int __cdecl invoke_main(void)" (?invoke_main##YAHXZ)
1>C:\Users\Philip\kodning2\vsworkdir\egnaTestProjekt\Solution_CLIExample3\Core\x64\Debug\Core.exe : fatal error LNK1120: 1 unresolved externals
1>Done building project "Core.vcxproj" -- FAILED.
2>------ Build started: Project: Wrapper, Configuration: Debug x64 ------
2>pch.cpp
2>AssemblyInfo.cpp
2>Entity.cpp
2>C:\Users\Philip\kodning2\vsworkdir\egnaTestProjekt\Solution_CLIExample3\Core\Wrapper\Entity.cpp(16,1): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "pch.h"' to your source?
2>Wrapper.cpp
2>Generating Code...
2>Done building project "Wrapper.vcxproj" -- FAILED.
3>------ Build started: Project: Sandbox, Configuration: Debug x64 ------
3>CSC : error CS0006: Metadata file 'C:\Users\Philip\kodning2\vsworkdir\egnaTestProjekt\Solution_CLIExample3\Core\x64\Debug\Wrapper.dll' could not be found
3>Done building project "Sandbox.csproj" -- FAILED.
========== Build: 0 succeeded, 3 failed, 0 up-to-date, 0 skipped ==========

Unable to use xbuild to build solution (Mono)

When trying to use xbuild to build my solution through Mono on Mac and Linux (haven't tested under Windows yet), I get this strange error that I've been unable to find anywhere else.
Errors:
/Users/macbook/git/DiscordSharp/DiscordSharp.sln (default targets) ->
(Build target) ->
/Users/macbook/git/DiscordSharp/DiscordSharp/DiscordSharp.csproj (default targets) ->
/Library/Frameworks/Mono.framework/Versions/4.2.2/lib/mono/4.5/Microsoft.CSharp.targets (CoreCompile target) ->
/Library/Frameworks/Mono.framework/Versions/4.2.2/lib/mono/4.5/Microsoft.CSharp.targets: error : Tool executable '/MSBuild/14.0/Bin/mcs.exe' could not be found
1 Warning(s)
1 Error(s)
Time Elapsed 00:00:02.0472770
MacBooks-MacBook:DiscordSharp macbook$
Interestingly enough, I am able to open the solution in MonoDevelop and build it that way. The projects in the solution target Mono / .NET Framework 4.5. I'm running Mono 4.2 SR1 (4.2.2.30).
What could be causing this issue and in what way could I fix it? This problem prevented me from using TravisCI with this project and I have yet to find a fix for it.
The .csproj file is only defining a non-Unix CscToolPath for a Platform conditional (OS should be used...), not sure what the requirement is for v14 for Windows(?), so as a test:
vi DiscordSharp/DiscordSharp.csproj
Remove:
<PropertyGroup Condition="'$(Platform)' != 'Unix'">
<CscToolPath>$(MSBuildProgramFiles32)\MSBuild\14.0\Bin</CscToolPath>
</PropertyGroup>
Rebuild project and it should work fine:
nuget restore
xbuild DiscordSharp.sln
If v14 MSbuild is required for Windows, you can use the following:
<PropertyGroup Condition="'$(OS)' != 'Unix'">
<CscToolPath>$(MSBuildProgramFiles32)\MSBuild\14.0\Bin</CscToolPath>
</PropertyGroup>
http://www.mono-project.com/archived/porting_msbuild_projects_to_xbuild/
Then the following should run fine with no errors:
xbuild /target:clean
xbuild /target:build

How to downgrade NuGet from 2.8.6 to 2.8.5 (or remove completely)?

Recently my projects stopped building with a noninformative message:
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
If I set build verbosity to some other setting it does not produce any more info.
My solution contains a project that I want to build.
MySolution\
MyProject\
Next, I tried a command line build:
Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe MySolution.sln
And this produces following error:
MySolution\MySolution.sln" (default target) (1) ->
"D:\Visual Studio\Projects\MySolution\MyProject\MyProject.csproj" (default target) (6) ->
D:\Visual Studio\Projects\MySolution.nuget\NuGet.targets(100,9): error :
Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
[D:\Visual Studio\Projects\MySolution\MyProject\MyProject.csproj]
D:\Visual Studio\Projects\MySolution.nuget\NuGet.targets(100,9): error MSB3073 : The command ""D:\Visual Studio\Projects\MySolution.nuget\NuGet.exe" install "D:\Visual Studio\Projects\MySolution\MyProject\packages.config" -source ""
-RequireConsent -solutionDir "D:\Visual Studio\Projects\MySolution\ "" exited with code 1. [D:\Visual Studio\Projects\MySolution\MyProject\MyProject.csproj]
This particular message:
Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral,
was a hint to a search that resulted in assumption that the problem lies in Nuget 2.8.6 that was build for .NET 4.5 yet trying to access type in .NET 4.0 mscorlib.
So I have two options:
Downgrade Nuget 2.8.6 to NuGet 2.8.5. I have tried that but have not succeeded.
Tools -> Extension Manager… -> NuGet Package Manager -> Uninstall
Then I tried to install NuGet 2.8.5 found at:
http://nuget.codeplex.com/releases/view/612846
Downloaded the extension and installed, but I ended up with 2.8.6 as visible in Help -> About Microsoft Visual Studio.
A that point I would like to know how to make a clean uninstall and install of version 2.8.5.
The other option is to remove NuGet completely and live without it. I have deleted .nuget folder, deleted sections in .csproj file that mention nugget, but still, my project does not build.
I don't know what else I could do. I need to make a build.

ASP.NET 5 (MVC 6) app failed to build on AppHarbor. Any idea why?

I've tried to publish a sample MVC 6 (ASP.NET 5) app to AppHarbor. But it always failed to build. Here's the build log from AppHarbor:
Build started 12/21/2014 6:09:32 PM.
1>Project "D:\temp\3s5ri4qs.5at\input\WebApplication1.sln" on node 1 (default targets).
1>ValidateSolutionConfiguration:
Building solution configuration "Release|Any CPU".
1>Project "D:\temp\3s5ri4qs.5at\input\WebApplication1.sln" (1) is building "D:\temp\3s5ri4qs.5at\input\src\WebApplication1\WebApplication1.kproj" (2) on node 1 (default targets).
2>D:\temp\3s5ri4qs.5at\input\src\WebApplication1\WebApplication1.kproj(7,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\AspNet\Microsoft.Web.AspNet.Props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
2>Done Building Project "D:\temp\3s5ri4qs.5at\input\src\WebApplication1\WebApplication1.kproj" (default targets) -- FAILED.
1>Done Building Project "D:\temp\3s5ri4qs.5at\input\WebApplication1.sln" (default targets) -- FAILED.
Build FAILED.
"D:\temp\3s5ri4qs.5at\input\WebApplication1.sln" (default target) (1) ->
"D:\temp\3s5ri4qs.5at\input\src\WebApplication1\WebApplication1.kproj" (default target) (2) ->
D:\temp\3s5ri4qs.5at\input\src\WebApplication1\WebApplication1.kproj(7,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\AspNet\Microsoft.Web.AspNet.Props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.03
I've already followed this solution to a similar issue. But it doesn't seem to work. Any help?

How to make MSBUILD resolve System.Action<T1,T2> correctly?

My projects build fine in Visual Studio and also using MSBUILD on my machine.
On the build agent however if I run MSBUILD I get the error below.
I have already tried to specify a target framework of 4.0 but without success.
Any other ideas?
"c:\Test\Test.csproj" (default target) (6) ->
(CoreCompile target) ->
ItemSearchDelegate.cs(17,10): error CS0433: The type 'System.Action<T1,T2>' exists in both 'c:\Windows\Microsoft.NET\
Framework\v4.0.30319\mscorlib.dll' and 'c:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.
dll'
What I find most interesting: some lines above that error from MSBUILD, I see:
CSC : warning CS1685: The predefined type 'System.Action' is defined in multiple assemblies in the global alias; using definition from 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll'
So it decides to use v4 just to complain a second later?
All I do is: open the command line at the location of the .CSPROJ file and run "msbuild". Nothing fancy.

Categories

Resources