Giter Site home page Giter Site logo

Comments (5)

martinrrm avatar martinrrm commented on September 29, 2024

I can repro it in my local machine

from home.

martinrrm avatar martinrrm commented on September 29, 2024

@snorrk Hi! I investigated a little bit and looks that the problem is that your project extension .proj doesn't import the necessary targets, basically is not supported to have a .proj extension and Microsoft.NET.Sdk project. Can you try do rename the project file to .csproj and see if it works? Thanks!

from home.

snorrk avatar snorrk commented on September 29, 2024

Not being able to restore using static graph with Microsoft.NET.Sdk is the point of this issue.

Sdk.targets says:

This means support for different languages could either be supplied via an SDK or via a NuGet package

This does not work when static graph is enabled (but does when it is disabled).

I believe that is a bug, the behavior should be consistent regardless of the static graph setting?

from home.

jeffkl avatar jeffkl commented on September 29, 2024

@snorrk what happens when you build the project?

D:\repros\duplicate-net40>msbuild /clp:v=n;summary;forcenoalign
MSBuild version 17.9.5+33de0b227 for .NET Framework
Build started 3/12/2024 3:18:20 PM.

Project "D:\repros\duplicate-net40\Project.proj" on node 1 (default targets).
C:\Program Files\Visual Studio 2022\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(1248,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [D:\repros\duplicate-net40\Project.proj]
_CleanRecordFileWrites:
  Creating directory "obj\Debug\".
Done Building Project "D:\repros\duplicate-net40\Project.proj" (default targets) -- FAILED.


Build FAILED.

Since the project file's extension is .proj, the Microsoft.NET.Sdk does not import the C# targets that enable multi-targeting. Since the value of <TargetFrameworks /> isn't interpreted by the SDK when the project file extension isn't .proj, it defaults to .NET Framework v4.0.

https://learn.microsoft.com/dotnet/core/project-sdk/overview#project-files

If you're building a C# library or application, the project file must end in .csproj. If your project is not compiling an C# program or library, consider Microsoft.Build.NoTargets.

from home.

dotnet-policy-service avatar dotnet-policy-service commented on September 29, 2024

This issue has been automatically marked as stale because we have not received a response in 14 days. It will be closed if no further activity occurs within another 14 days of this comment.

from home.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.