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

dotnet cli and Visual Studio restore SDK-style netfx 2.0 projects differently #40816

Open
na1307 opened this issue May 10, 2024 · 1 comment
Open
Labels
Milestone

Comments

@na1307
Copy link

na1307 commented May 10, 2024

I'm not sure of the proper repository for this issue. If this repository is not appropriate, please move this to another repository.

Describe the bug

dotnet cli and Visual Studio restore SDK-style netfx 2.0 projects differently. The packages.lock.json that dotnet cli restores includes Microsoft.NETFramework.ReferenceAssemblies and Microsoft.NETFramework.ReferenceAssemblies.net20. But Visual Studio doesn't. This causes an error in locked mode restore.

To Reproduce

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net20</TargetFramework>
    <RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
  </PropertyGroup>
</Project>

Try restoring this project in visual studio and dotnet cli respectively.

Exceptions (if any)

Further technical details

.NET SDK 8.0.204, Visual Studio 17.9.6

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-CLI untriaged Request triage from a team member labels May 10, 2024
@Forgind
Copy link
Member

Forgind commented May 14, 2024

We talked about this internally, and our eventual conclusion is that this is currently by-design.

The way this probably works is that the SDK is adding a reference to microsoft.NETFramework.ReferenceAssemblies. Probably .NET 2.0 is compiled against the implementation in program files, and the SDK doesn't know how to look that up, so it uses the reference assembly pack. We need that package in order to be able to target .NET 2.0. VS does succeeds in finding them, so it doesn't need that.

If you want restore to work the same way in VS and from the SDK, you can add an explicit reference to Microsoft.NETFramework.ReferenceAssemblies, and then it will be there in both cases.

That said, we might be able to build that behavior into the SDK to unify the two. I think this is an appropriate repo for that work.

@Forgind Forgind removed their assignment May 14, 2024
@Forgind Forgind removed the untriaged Request triage from a team member label May 14, 2024
@Forgind Forgind added this to the Backlog milestone May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants