dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.26k stars 4.73k forks source link

When I try to create a new project referencing the project in this repository it doesn't build properly #71582

Closed Linlccc closed 2 years ago

Linlccc commented 2 years ago

I newly created a solution and then referenced the project in that repository, I got the following error, And when the project is referenced, the bin/obj folder will also be generated in the project code directory instead of the artifacts directory

image image image

But I open the project directly and it builds fine, what should I do to reference the project in this repository in other solutions, thanks

dotnet-issue-labeler[bot] commented 2 years ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

AraHaan commented 2 years ago

Why not simply add the built artifact nuget packages from building this repo locally to your new projects nuget feeds (using nuget.config) and tell it to use package version 7.0.0-dev?

But why use a local build instead of what is in the dotnet7 feed though, unless you have made local changes and are wanting to test them.

Linlccc commented 2 years ago

But why use a local build instead of what is in the dotnet7 feed though, unless you have made local changes and are wanting to test them.

yes i need to debug so i need to reference the project directly not the nuget package or dll

huoyaoyuan commented 2 years ago

The build process of this project is very complex. You need to target net7.0, add global.json, and ensure the libraries has built correctly with build.cmd libs.

yes i need to debug so i need to reference the project directly not the nuget package or dll

The projects here isn't designed to support so. Using source link would be a lot easier.

Linlccc commented 2 years ago

@huoyaoyuan I have successfully built the project, but when I try to use another project to reference a project in this repository, there is a problem and it fails to build

The projects here isn't designed to support so. Using source link would be a lot easier.

Of course I know this, I have some low-level stuff to debug,How do you use the original link you mentioned?

Clockwork-Muse commented 2 years ago

... There are symbol servers for the runtime, which should normally be used, although you may have to disable "only debug my code".

If you're trying to debug a preview/nightly build, you want to refer to the dogfooding instructions.

Linlccc commented 2 years ago

Can't I directly reference the project? A few months ago, when I directly used other projects to reference the library's project, everything was fine, but this time I don't know if it happened because I didn't do it well

huoyaoyuan commented 2 years ago

You need to do at least:

Your screenshot indicates that you are using 6.0 SDK.

Linlccc commented 2 years ago

@huoyaoyuan Thank you very much, the problem is solved, it should be because the global.json configuration of the two projects is different, resulting in the difference between some properties in the project props and targets.