Antaris / AspNetCore.Mvc.Widgets

Prototype Widget framework for ASP.NET Core Mvc
17 stars 5 forks source link

dependency problems #1

Closed PromontoryProtean closed 1 year ago

PromontoryProtean commented 8 years ago

Just checking this out and ran into a small problem. I was getting package restore errors on Microsoft.Extensions.PropertyActivator.Sources and Microsoft.Extensions.PropertyHelper.Sources and was not able to compile the project. There is a line in NuGet.config that reads: <!-->add key="AspNetVNext" value="https://www.myget.org/f/aspnetmaster/api/v3/index.json" /-->

I could not get anything to build until I removed the comments and set that line to: <add key="AspNetVNext" value="https://www.myget.org/f/aspnetmaster/api/v3/index.json" />

Package restore worked after adding that line back and I was able to compile. Weird thing is, if I comment that back out the project still compiles. I'm assuming this is because the assemblies are cached on my system.

Both assemblies say rc1-final. Any idea why they are not available on the standard feed? Just curious how you isolated those assemblies and knew to include them.

BTW, nice job on this. I hope the Microsoft team takes a close look at this repository. it will definitely help out framework and cms developers.

Antaris commented 8 years ago

@PromontoryProtean What branch was that, master? The packages are probably not on public NuGet feed yet because I think they depend on the new content package support in NuGet 3, which isn't on the public feed yet. Don't quote me on that though.

If you are building from master, I didn't think you'd need those two packages as I actually bundled them into this project themselves, instead of including them as package references.

If you are building from the rc2 branch, this won't compile yet...

PromontoryProtean commented 8 years ago

@Antaris, it was the master branch. Thanks for the explanation. I was wondering what "type": "build" meant because I had not seen it in a project.json file before. I'll strip those lines out later today and see if it compiles. I should have more time to experiment and get you some more feedback.

PromontoryProtean commented 8 years ago

@Antaris, I attempted to update the library and get this to compile on RC2 final. I have a fork here: https://github.com/PromontoryProtean/AspNetCore.Mvc.Widgets

I can set up a pull request if you think it might save you some time and are you interested in exploring this. I'm stuck on a few things, in particular the references to Microsoft.Extensions.PropertyActivator.Sources and Microsoft.Extensions.PropertyHelper.Sources in project.json. Microsoft includes these in Microsoft.AspNetCore.Mvc.ViewFeatures (https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNetCore.Mvc.ViewFeatures/project.json) so I'm at a loss as to why they won't resolve. I know you said you bundled them with an earlier build, so I'm not sure how you tracked those packages down and/or included them. I'm pretty sure that I can get the project to build if I can resolve the dependency issues. As it stands I'm down to 7 classes that are throwing up errors.

Antaris commented 8 years ago

Hey, @PromontoryProtean

Sorry for the late reply on this.

Current the project doesn't carry a root NuGet.config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="AspNetVNext" value="https://www.myget.org/F/aspnetcidev/api/v3/index.json" />
    <add key="NuGet" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
</configuration>

With that it should resolve those build dependencies. Next, you'll also need to change the reference to the class library from "Antaris.AspNetCore.Mvc.Widgets": "" to "Antaris.AspNetCore.Mvc.Widgets": "*" (note the asterisk) as the .NET CLI project.json doesn't support project references with empty strings for version ranges.

Happy to take a pull request with your RC2 work when you're happy with it. I'd still class this as prototype work, as I am note sure what the MVC team are doing post-RTM.

PromontoryProtean commented 8 years ago

@Antaris, thanks for the feedback. I added the NuGet.config file back and was able to resolve the dependency problems. I had deleted it because I thought it was being used to get the project to compile on pre-release builds of RC2. I had some weird issues where nuget restore was not working from the GUI. Even after adding the config file back I still had to run dotnet restore form the command line to get everything to work and get rid of the red squigglies. I guess I need to read up on the changes and mechanisms of project.json a little more closely.

I'll spend some more time in the next day or so trying to get the project to compile and let you know how things go. I agree with you about the prototype concept. My hope is that if we can create a good proof-of-concept and show that there is community interest, we can get the asp.net team to consider including something similar into a future build of the framework.

Antaris commented 8 years ago

@PromontoryProtean Visual Studio has a tendency to want to use cached packages - often not finding newer packages until you perform a dotnet restore --no-cache. Having the same issue myself on some other project work.

Incidentally, we're using a variant of this widget framework for some internal code and I'm just about to start the RC1-RC2 upgrade myself. Will keep an eye on your changes to see how they compare...

PromontoryProtean commented 8 years ago

@Antaris thanks for the no cache tip. I did some more work trying to get it to compile. One thing to note is I added 3 new classes to make it line up with ViewComponent changes - WidgetFeature, WidgetFeatureProvider and WidgetConventions.

I'm down to 3 classes that won't compile. They are DefaultWidgetArgumentBinder, DefaultWidgetHelper and DefaultWidgetInvoker. I'll take another look soon and see what I can come up with. I'll keep an eye out on your repository as well, interested to see how you get the binders to work. I've no idea how far along you might be, but if you think it will help for me to set up a pull request so that you compare and maybe save some time just let me know.

Antaris commented 8 years ago

@PromontoryProtean I've pushed my RC2-compatible build to the develop branch (merged from rc2).

PromontoryProtean commented 8 years ago

@Antaris this is great. I saw your post in the MVC repository as well. I've been preoccupied with a work project but I'm hoping to have a chance to play with your code tomorrow. Should be able to get you some feedback in the next day or so.