Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build the code for .NET 4.5 on Linux (mono) #7438

Closed
alexvaluyskiy opened this issue Dec 28, 2016 · 7 comments
Closed

Can't build the code for .NET 4.5 on Linux (mono) #7438

alexvaluyskiy opened this issue Dec 28, 2016 · 7 comments

Comments

@alexvaluyskiy
Copy link

Steps to reproduce

I've created a project with two target frameworks: net45 and netstandard1.6

<Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <AssemblyTitle>TestMonoProject</AssemblyTitle>
    <TargetFrameworks>net45;netstandard1.6</TargetFrameworks>
    <AssemblyName>TestMonoProject</AssemblyName>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="**\*.cs" />
    <EmbeddedResource Include="**\*.resx" />
  </ItemGroup>

  <ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
    <Reference Include="System" />
    <Reference Include="Microsoft.CSharp" />
  </ItemGroup>

  <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
    <PackageReference Include="NETStandard.Library" Version="1.6.1" />
  </ItemGroup>
</Project>

Expected behavior

I can build the project for both targets

Actual behavior

It fails on building for net45 with this error

/usr/share/dotnet/sdk/1.0.0-preview4-004233/Microsoft.Common.CurrentVersion.targets(1107,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/home/ravenger/TestMonoProject/TestMonoProject.csproj]

Environment data

.NET Command Line Tools (1.0.0-preview4-004233)

Product Information:
Version: 1.0.0-preview4-004233
Commit SHA-1 hash: 8cec61c6f7

Runtime Environment:
OS Name: ubuntu
OS Version: 16.04
OS Platform: Linux
RID: ubuntu.16.04-x64
Base Path: /usr/share/dotnet/sdk/1.0.0-preview4-004233

Mono data

Mono JIT compiler version 4.6.2 (Stable 4.6.2.7/08fd525 Mon Nov 21 12:08:40 UTC 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

@alexvaluyskiy
Copy link
Author

It is possible to build net45 projects with Mono in preview2. But there is a problem with xunit tests. But in preview4 everything are broken.

@livarcocc
Copy link
Contributor

@srivatsn @nguerrera @dsplaisted This seems like an SDK problem.

@alexvaluyskiy
Copy link
Author

It think it the same as #335

@borgdylan
Copy link

The SDK people also pointed a shortcoming in xbuild itself when running under .NET Core.

@borgdylan
Copy link

I have recently read that the .NET Core version of MSBuild is only meant to build .NET Core projects. If this is true, we will need a variant of the CLI that uses the Mono flavour of MSBuild or an option to specify the MSBuild path (preferably an ENV VAR). I do not only target .NET Core but also target Mono when developing on my machines (which all run Linux).

@alexvaluyskiy
Copy link
Author

Dnx and Dotnet CLI preview 2 supports Mono out-of-the box. I think this version of CLI should support it as well

@blackdwarf
Copy link

As @livarcocc mentioned, the right place for this issue is the SDK repo and potentially the MSBuild repo. The #335 issue already tracks this and @borgdylan mentioned on that issue that he opened another one on MSBuild. With all of that, I will close this issue and let the discussion continue on the SDK issue.

if you feel this is an error, please reopen. Thanks!

@msftgits msftgits transferred this issue from dotnet/cli Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants