Windows-XAML / Template10

Making Windows 10 apps great again
Apache License 2.0
1.41k stars 389 forks source link

How do you upgrade an existing project to 1.1.1? #564

Closed rickengle closed 8 years ago

rickengle commented 8 years ago

I uninstalled and then reinstalled Template10 in Visual Studio yesterday before creating a project based on Minimal and yet I was left with this version: nuget\packages\Template10\1.0.8 Is there a way to upgrade that template in place to 1.1.1?

Other than the build output is there a place within the code to see what version of Template10 is being used? Why wouldn't the install through Visual Studio use 1.1.1 in the first place?

Thanks, Rick

qmatteoq commented 8 years ago

Hello Rick, Right click on your project in Visual Studio and choose Manage NuGet packages. Under the Installed tab, you will see the list of installed packages and their version number. Moreover, if you move to the Updates tab, you will see all the packages which have an update, with the option to go on and perform it.

rickengle commented 8 years ago

OK great I found that and upgraded. I really appreciate the help. I'm left with a few compile errors like: Severity Code Description Project File Line Suppression State Error CS0115 'DetailPageViewModel.OnNavigatedTo(object, NavigationMode, IDictionary<string, object>)': no suitable method found to override i3RemoteWP_Universal2

I'm assuming these relate to the breaking news issues on 1.1.1 that Jerry posted and require a manual fix up?

Thanks, Rick

qmatteoq commented 8 years ago

Correct. The new signature of the method is now:

Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary<string, object> state)

rickengle commented 8 years ago

I think I have it, does this change look right? It did fix a compile error: Change this: public override void OnNavigatingFrom(NavigatingEventArgs args) { args.Cancel = false; } to this: public override Task OnNavigatingFromAsync(NavigatingEventArgs args) { args.Cancel = false;

        return Task.CompletedTask;
    }

Just want to make sure I got it right.

Thanks, Rick

qmatteoq commented 8 years ago

Yes, it's correct. Just remember that the code:

return Task.CompletedTask;

is required only if, like your case, the method doesn't perform any asynchronous operation (so you're not using the async / await keyword). Otherwise, you can omit it.

rickengle commented 8 years ago

That cleared up the existing compile errors but left me one last one I don't see instructions for. The error is: Error CS1503 Argument 1: cannot convert from 'Template10.Services.NavigationService.INavigationService' to 'Template10.Services.NavigationService.NavigationService' i3RemoteWP_Universal2

In this code: // runs even if restored from state public override async Task OnInitializeAsync(IActivatedEventArgs args) { // setup hamburger shell var nav = NavigationServiceFactory(BackButton.Attach, ExistingContent.Include); Window.Current.Content = new Views.Shell(nav); await Task.Yield(); }

Any idea what the fix is for that?

Rick

jhalbrecht commented 8 years ago

See here https://github.com/Windows-XAML/Template10/issues/556

// Shell.xaml.cs
public Shell(INavigationService navigationService)
rickengle commented 8 years ago

I couldn't find that reference easily in #556 but I did find that line and replaced it. I then compiled again and got 22 compile errors very similar to this one: Error CS0433 The type 'Interaction' exists in both 'Microsoft.Xaml.Interactivity, Version=12.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' and 'Microsoft.Xaml.Interactivity, Version=1.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' i3RemoteWP_Universal2

This is so hard, its like a scavenger hunt of pain. I wish there was just a fixed, ready to go version of a template 10 minimal project ready to go to use as a baseline.

Rick

qmatteoq commented 8 years ago

You need to remove the Behaviors SDK reference you find in the references of your project and keep just the Behaviors NuGet package

qmatteoq commented 8 years ago

By the way, a full list of the changes to do when you upgrade your project is listed in the wiki https://github.com/Windows-XAML/Template10/wiki/Upgrading-from-Template-10-Nuget-Nuget-1.0-to-1.1

rickengle commented 8 years ago

Thanks Matteo, I ran through all of the changed and think I did them but was left with 1 last error: Error Assembly 'Template10Library' with identity 'Template10Library, Version=1.0.5866.5306, Culture=neutral, PublicKeyToken=d74e748b43bf937b' uses 'Microsoft.Xaml.Interactivity, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'Microsoft.Xaml.Interactivity' with identity 'Microsoft.Xaml.Interactivity, Version=1.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' i3RemoteWP_Universal2

I'll comb through the links you sent to make sure I didn't miss anything. I did remove the reference to the Behaviors SDK.

Rick

pjh1974 commented 8 years ago

It looks like the project has a dependency on 'Microsoft.Xaml.Interactivity, Version=1.0.3.0' but the NuGet package is dependent on 'Microsoft.Xaml.Interactivity, Version=1.0.2.0,

rickengle commented 8 years ago

I never added that dependency though, I installed a fresh copy of Template 10 through VS 2015, I think it was 1.0.8, upgraded that in place to 1.1.1 and did the fix ups. I didn't make any modifications the to project yet, its pretty much as is based on the Minimal template. I don't see a reference to 'Microsoft.Xaml.Interactivity so its not clear how to fix it to make it depend on .Xaml.Interactivity, Version=1.0.2.0

pjh1974 commented 8 years ago

I got my solution building again by deleting all my bin and obj folders to get rid of any caches. Then I changed "Microsoft.Xaml.Behaviors.Uwp.Managed" version="1.0.2" to "Microsoft.Xaml.Behaviors.Uwp.Managed" version="1.0.3" in the Template10.nuspec file in my .nuget folder. Now it all builds again.

I know its a bit hacky but the 1.1.1 NuGet package is broken, this just makes it less broken. Any fix is going to mean a new version of the NuGet package, so I don't mind hacking it as a temporary measure.

JustinXinLiu commented 8 years ago

Actually the 1.1.1 NuGet Package is not broken. I updated to it recently and you just need to follow the upgrade guide here. Here's what's in my project.json.

"dependencies": {
    "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0",
    "Microsoft.Xaml.Behaviors.Uwp.Managed": "1.0.3",
    "MvvmLight": "5.2.0",
    "Rx-WinRT": "2.3.0-beta2",
    "Rx-XAML": "2.3.0-beta2",
    "Template10": "1.1.1",
    "Newtonsoft.Json": "8.0.2"
  },
pjh1974 commented 8 years ago

@JustinXinLiu that is a better fix - still getting used to the new project.json files. I'm pretty sure those instructions weren't there when I originally went to that page, I never thought to go back, d'oh!. However, the Nuget package is still wrong; it shouldn't specify a version of a dependency that is not compatible with the contents of the package.

rickengle commented 8 years ago

OK its working. I edited Template10.nuspec (I had to figure out where that was) and changed the behavior dependency to 1.0.3. I thought it was odd that in that file it showed dependency for Newtonsoft.Jason for 7.0.1 even though I upgrade that to 8:

In my project.json file I don't even show the dependency for Microsoft.Xaml.Behaviors.Uwp.Managed:

"dependencies": { "Microsoft.ApplicationInsights": "1.0.0", "Microsoft.ApplicationInsights.PersistenceChannel": "1.0.0", "Microsoft.ApplicationInsights.WindowsApps": "1.0.0", "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0", "Newtonsoft.Json": "8.0.2", "Template10": "1.1.1" },

I am thrilled that my project is finally alive and running for the first time!

Rick

rickengle commented 8 years ago

Oh no, after my post I was about to load the Minimal project in Blend and see how it looked but literally after simply compiling fine, exiting the app in Local Machine and then terminating the app, I was left with an invalid markup error on the designer surface and the error in here of MainPageViewModel not existing in the Viewmodels namespace. I also noticed that I now have 37 compile errors. I realized I didn't do the 1.1.1 fixup about the bootstrapper code but I can't find where that code exists to modify it. I think the release notes need to give more guidance as to precisely where all these change nuggets originate from. Its amazing that I can get a perfect compile, run the app and then upon completion have a completely new set of failures. Its a linked list of complications.

Rick

Raamakrishnan commented 8 years ago

Version 1.1.0 of Microsoft.Xaml.Behaviors.Uwp.Managed has been released and it seems to be breaking. I got this error using version 1.1.0

the assembly version has a public key token that does not match that of the request

So, I need to go back to 1.0.3. And now it is working perfectly.