dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.56k stars 10.05k forks source link

How to get VS to use local build of ASP.NET Core? #27291

Open IanKemp opened 4 years ago

IanKemp commented 4 years ago

I've followed all the steps in BuildFromSource.md to get a local build of release/3.1 built and installed. I'm using the startvs.cmd in the root of the repo to run my own VS solution. When I build and run my sln and check the Debug > Modules, I can see it's indeed using my locally-built 3.1.10 DLLs. All good.

However, if I check the project's referenced frameworks (Project > Dependencies > Frameworks) I see the following:

I would expect that Microsoft.AspNetCore.App would be using C:\aspnetcore\.dotnet\packs\Microsoft.AspNetCore.App.Ref\3.1.10, but that isn't the case. The end result is that instead of building against my local 3.1.10, VS is building against the release 3.1.8, which is not what I want.

How do I make VS build using the 3.1.10 ASP.NET Core DLLs? Do I have to define a new/unique FrameworkReference that points to my 3.1.10 DLLs?

dougbu commented 4 years ago

The SDK in your own solution will use the bundled runtime versions unless you mimic our @(KnownFrameworkReference) overrides (less the Condition attributes). See https://github.com/dotnet/aspnetcore/blob/release/3.1/Directory.Build.targets#L132-L136

dougbu commented 4 years ago

@captainsafia I suggest we need to mention this in https://github.com/dotnet/aspnetcore/blob/master/docs/BuildFromSource.md#use-the-result-of-your-build Do you agree❔ If yes, I can do the needful.

captainsafia commented 4 years ago

@dougbu Sure! I also think it would also be sensible if we moved that section of the doc to another markdown file and linked to it from there to keep the BuildFromSource doc focused on the main build-for-development scenarios.

JunTaoLuo commented 3 years ago

Sounds like a quick doc update/reorganization, let's do this in the current sprint. FYI @dotnet/aspnet-build

dougbu commented 1 year ago

@wtgodbe, @mkArtakMSFT this should probably be on the backlog or closed. Not a big fix but also may not be needed.

ghost commented 1 year ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

roblappcoupa commented 1 year ago

I must be missing something here. I simply want to consume a local build of ASP.NET Core but I don't understand how to do it. I can't seem to find information on this in the link mentioned above (https://github.com/dotnet/aspnetcore/blob/master/docs/BuildFromSource.md#use-the-result-of-your-build). Am I missing something obvious?

captainsafia commented 1 year ago

I must be missing something here. I simply want to consume a local build of ASP.NET Core but I don't understand how to do it. I can't seem to find information on this in the link mentioned above (https://github.com/dotnet/aspnetcore/blob/master/docs/BuildFromSource.md#use-the-result-of-your-build). Am I missing something obvious?

You can find the guidance you're looking for in this branch.

Can I inquire as to why you are wanting to use a local build? Using a nightly or writing unit tests/in-repo samples might be more straightforward depending on your scenario.

roblappcoupa commented 1 year ago

@captainsafia Thanks for getting back to me. I love aspnet core and I want to finally try and contribute to the project. So I am just trying to figure out the local development workflow. For example, if I make a change, what is the best way to consume it or test it? What do the folks at Microsoft do? Any guidance would be appreciated. Thanks!

captainsafia commented 1 year ago

@captainsafia Thanks for getting back to me. I love aspnet core and I want to finally try and contribute to the project. So I am just trying to figure out the local development workflow. For example, if I make a change, what is the best way to consume it or test it? What do the folks at Microsoft do? Any guidance would be appreciated. Thanks!

Got it! So, I can share some info about my particular workflow.

The best starting point for testing is to identify the unit tests local to the area you're changing. Usually, there's a test directory adjacent to the src directory where you are making the modification. You can find tests by querying for places where the API you've changed is being invoked inside a test directory. If you know what feature you want to work on, I can help you find where to make the test change.

WIth regard to testing in a real application, there are various sample directories in the repo that contain apps that you can run that will hook up locally to the build.

I typically will test development changes using the process listed above but that's usually if I'm trying to validate some larger E2E scenario.

roblappcoupa commented 1 year ago

@captainsafia That sounds good. Thank you for sharing that info. I will follow that same workflow so you can disregard my original question about consuming the local builds. Thanks!