Bug 29067 - Mono 4.0.0 Alpha1: compiling requires /usr/lib/mono/4.0/mscorlib.dll but ignores 4.5/mscorlib.dll
Summary: Mono 4.0.0 Alpha1: compiling requires /usr/lib/mono/4.0/mscorlib.dll but igno...
Status: RESOLVED FEATURE
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2015-04-14 04:42 UTC by Timotheus Pokorra
Modified: 2015-04-14 09:02 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FEATURE

Description Timotheus Pokorra 2015-04-14 04:42:44 UTC
I am trying to build packages for Fedora, based on Mono4 Alpha1.
I did not include the external binaries, therefore I only have /usr/lib/mono/4.5/mscorlib.dll

But now I get many messages like this:
CSC: error CS0518: The predefined type `System.Object' is not defined or imported
CSC: error CS0518: The predefined type `System.ValueType' is not defined or imported
CSC: error CS0518: The predefined type `System.Attribute' is not defined or imported
CSC: error CS0518: The predefined type `System.Int32' is not defined or imported
CSC: error CS0518: The predefined type `System.UInt32' is not defined or imported
CSC: error CS0518: The predefined type `System.Int64' is not defined or imported
CSC: error CS0518: The predefined type `System.UInt64' is not defined or imported
CSC: error CS0518: The predefined type `System.Single' is not defined or imported
CSC: error CS0518: The predefined type `System.Double' is not defined or imported
CSC: error CS0518: The predefined type `System.Char' is not defined or imported
[...]

If I create a symbolic link, all compiles fine:
ln /usr/lib/mono/4.5/mscorlib.dll /usr/lib/mono/4.0/mscorlib.dll

I wonder if the wrong mscorlib.dll is referenced?

The csproj file starts like this:

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">^M
  <PropertyGroup>^M
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>^M
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>^M
    <ProductVersion>9.0.30729</ProductVersion>^M
    <SchemaVersion>2.0</SchemaVersion>^M
    <ProjectGuid>{10938016-DEE2-4A25-9A5A-8FD3444379CA}</ProjectGuid>^M
    <OutputType>WinExe</OutputType>^M
    <AppDesignerFolder>Properties</AppDesignerFolder>^M
    <RootNamespace>KeePass</RootNamespace>^M
    <AssemblyName>KeePass</AssemblyName>^M
    <ApplicationIcon>KeePass.ico</ApplicationIcon>^M
    <SignAssembly>false</SignAssembly>^M
    <AssemblyOriginatorKeyFile>KeePass.pfx</AssemblyOriginatorKeyFile>^M
    <FileUpgradeFlags>^M
    </FileUpgradeFlags>^M
    <OldToolsVersion>2.0</OldToolsVersion>^M
    <UpgradeBackupLocation>^M
    </UpgradeBackupLocation>^M
  </PropertyGroup>^M
  [...]
Comment 1 Marek Safar 2015-04-14 06:22:58 UTC
This is expected. Your project is targeting 4.0 api but master/4.0 no longer builds this api. You need to correctly install content of external/binary-reference-assemblies/
Comment 2 Timotheus Pokorra 2015-04-14 06:36:39 UTC
I don't mind targeting 4.5, actually that is what I am trying to do.
How do I do that?

If I use ToolsVersion="4.5" then I get this warning, and the outcome is the same:
warning : Project has unknown ToolsVersion '4.5'. Using the default tools version '4.0' instead.
Comment 3 Marek Safar 2015-04-14 08:50:27 UTC
You need to use TargetFrameworkVersion

e.g.

    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
Comment 4 Timotheus Pokorra 2015-04-14 09:01:12 UTC
Thanks, this works, when I specify TargetFrameworkVersion for 4.5.

It seems it defaults to TargetFrameworkVersion 4.0 if there is no TargetFrameworkVersion specified in the csproj file.

Would it make sense to default to 4.5 in Mono4?
or fail if there is no TargetFrameworkVersion specified?
Comment 5 Marek Safar 2015-04-14 09:02:33 UTC
no, it'd break .net compatibility