Bug 57868 - msbuild 15.3 and Microsoft.Bcl.Build.targets - error CS0246: The type or namespace name could not be found
Summary: msbuild 15.3 and Microsoft.Bcl.Build.targets - error CS0246: The type or name...
Status: NEW
Alias: None
Product: Tools
Classification: Mono
Component: msbuild ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Ankit Jain
URL:
Depends on:
Blocks:
 
Reported: 2017-06-29 19:10 UTC by Igor K.
Modified: 2017-09-04 22:25 UTC (History)
2 users (show)

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


Attachments
This is an example of MonoDevelop project. (6.35 KB, application/zip)
2017-06-29 19:10 UTC, Igor K.
Details
Two logs - with this issue and without it. (119.96 KB, application/gzip)
2017-07-13 15:10 UTC, Igor K.
Details
Sample of a very simple project without the Microsoft.Bcl.Build (32.72 KB, application/gzip)
2017-07-13 15:11 UTC, Igor K.
Details
Sample of a very simple project with the Microsoft.Bcl.Build (Can't build) (90.08 KB, application/gzip)
2017-07-13 15:13 UTC, Igor K.
Details


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 for Bug 57868 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Igor K. 2017-06-29 19:10:01 UTC
Created attachment 23224 [details]
This is an example of MonoDevelop project.

Environment:
Linux Debian 9 "Scratch"
msbuild 15.3

mono-project alpha build:
deb http://download.mono-project.com/repo/debian alpha-jessie main

Description:

Create a solution with 2 PCLs - "FirstLibrary" and "SubLibrary" (in the MonoDevelop or in the Visual Studio 2017).
Add the "SubLibrary" to the "FirstLibrary" (as a reference).
Then add a Microsoft.Bcl.Build to the "SubLibrary".

You will see 

<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="portable-net45+win+wp80" />

in the packages.conf

Also you will see the next lines in the SubLibrary.csproj

  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />

  <Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />

  <ItemGroup>
    <None Include="packages.config" />
  </ItemGroup>

Add "using SubLibrary;" to the MainClass.cs of the "FirstLibrary" or do something like that.

Try to build it in the MonoDevelop - it will not show the error.
I wonder how it works because I do not use the flatpak in this case - does it run the same msbuild 15.3?

Open the command line (if you have msbuild version 15.2 or less) and type

msbuild FirstLibrary

Everything ok.

Update to msbuild version 15.3

msbuild FirstLibrary

"/home/homedir/Projects/FirstLibrary/FirstLibrary/FirstLibrary.csproj" (default target) (1) ->
(CoreCompile target) -> 
  MyClass.cs(3,7): error CS0246: The type or namespace name 'SubLibrary' could not be found (are you missing a using directive or an assembly reference?) [/home/homedir/Projects/FirstLibrary/FirstLibrary/FirstLibrary.csproj]


But, you can found there the SubLibrary.dll - it builds that PCL, but it can not see it somehow because of the Microsoft.Bcl.Build

If you will remove that import tag with "Microsoft.Bcl.Build" from the SubLibrary.csproj then everything will be ok and you can use the command line again.

Personally I don't need that Microsoft.Bcl.Build today - but I've spend hours before I was able to understand what broken the build and how to fix it.
Comment 1 Ankit Jain 2017-07-12 15:58:48 UTC
Could you please attach the diagnostic log from the command line build?

 $ msbuild /t:Clean # this is to ensure a *clean* build
 $ msbuild /v:diag /fl <your_sln>

Then attach the generated msbuild.log . Also, from the same shell:

 $ mono --version
 $ msbuild -version
Comment 2 Igor K. 2017-07-13 15:10:03 UTC
Created attachment 23534 [details]
Two logs - with this issue and without it.
Comment 3 Igor K. 2017-07-13 15:11:16 UTC
Created attachment 23535 [details]
Sample of a very simple project without the Microsoft.Bcl.Build
Comment 4 Igor K. 2017-07-13 15:13:13 UTC
Created attachment 23536 [details]
Sample of a very simple project with the Microsoft.Bcl.Build (Can't build)

You can comment out this <Import> in the VerifyIssueSecond.csproj to fix the build.

  <Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
Comment 5 Igor K. 2017-07-13 15:31:14 UTC
You may use the sample projects to reproduce the bug.

I have a very specific environment, so if you can't reproduce it with the latest (I have used the alpha jessie channel, but not the latest update) msbuild and mono then probably no sense to work with this issue at all.

http://www.mono-project.com/download/alpha/#download-lin-debian
Comment 6 Marek Safar 2017-09-04 22:25:41 UTC
Resetting the status