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

MSBuildWorkspace: Unable to build hello world .netstandard2.0 class library anymore #6283

Closed
ceztko opened this issue Mar 19, 2021 · 3 comments
Assignees
Labels
bug initial-investigation Perform initial investigation, apply untriaged label when done. triaged

Comments

@ceztko
Copy link

ceztko commented Mar 19, 2021

Issue Description

Using MSBuild.Locator, Workspaces.MSBuild and the Roslyn infrastructure I'm unable to compile an hello world netstandard2.0 class library. The same library compile just fine when targeting .Net framework 4.5.2. I noticed the issue after I installed Visual Studio 16.8. Some releases before the same scenario was working.

Steps to Reproduce

  1. Unpack the following test project:
    TestMSBuildWorkspaceCompilation.zip

  2. Open TestMSBuildWorkspaceCompilation.sln;

  3. Compile and run TestMSBuildWorkspaceCompilation project. When trying to compile the netstandard2.0 project an exception should trigger and compilation errors are printed. More explanations are in the code there.

Expected Behavior

No compilation errors should the issued when compiling the project targeting netstandard2.0.

Actual Behavior

A bunch of errors are printed, as the build system is unable to load the netstandard2.0 base library when compiling the project.

TestClassLibrary\obj\Debug\netstandard2.0\.NETStandard,Version=v2.0.AssemblyAttributes.cs[82..88)), CS0400: The type or namespace name 'System' could not be found in the global namespace (are you missing an assembly reference?)
TestMSBuildWorkspaceCompilation\TestClassLibrary\obj\Debug\netstandard2.0\TestClassLibrary.AssemblyInfo.cs[421..427)), CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
TestMSBuildWorkspaceCompilation\TestClassLibrary\obj\Debug\netstandard2.0\TestClassLibrary.AssemblyInfo.cs[497..503)), CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
[...]

Analysis

I'm currently using VS 16.9.2 but the same scenario was working some releases before 16.8.

Versions & Configurations

msbuild 16.9.0.11203
VisualStudio 16.9.2
.NET SDK 5.0.201

@ceztko ceztko added bug needs-triage Have yet to determine what bucket this goes in. labels Mar 19, 2021
@benvillalobos benvillalobos added initial-investigation Perform initial investigation, apply untriaged label when done. and removed needs-triage Have yet to determine what bucket this goes in. labels Mar 24, 2021
@ceztko
Copy link
Author

ceztko commented Mar 30, 2021

Any confirm on reproduction of this?

@ceztko
Copy link
Author

ceztko commented Apr 2, 2021

This issue seems to be more related to roslyn infrastructure (tracking issue dotnet/roslyn#52293). Feel free to close anytime if you're already sure it's not pertinent to msbuild, or I will do it myself later.

@Forgind
Copy link
Member

Forgind commented Apr 2, 2021

Sorry I was a little slow in getting to this, but I agree with your analysis—the GetCompilationAsync call is what's finding the errors, and MSBuild doesn't have anything to do with that. Roslyn sounds like a likely candidate.

@Forgind Forgind closed this as completed Apr 2, 2021
@AR-May AR-May added the triaged label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug initial-investigation Perform initial investigation, apply untriaged label when done. triaged
Projects
None yet
Development

No branches or pull requests

4 participants