I created a small animation in Expression Blend 2, using the VB code option at the New Project dialog.
This created a page.g.vb code page with some basic settings. It seems this resource does not get updated when I edit it within the project in VS Orcas (I had to add several Imports statements to it). Anyway, whenever I click Build in VS Orcas it advises
that files have been updated outside the editor and that I should reload, when I do, it loads the original default version of page.g.vb, even though I thought saving it in VS Orcas would update the file.
What I had to do was exit Expression Blend and VS Orcas completely, reopen the page.g.vb in my text editor, add the imports statements and then save it out again. Only then, when I relaunched VS Orcas and opened the project had it updated itself with the
later version I had just saved out. That was a lot of work for 1GB Ram and a couple of Imports Statements.
Why do you need to put import statements in the page.g.vb file? This is of course a class generated by VS. Since Page is a parciate class why not just put the import statement in the page.vb file instead. The page.xaml, page.vb and page.g.vb files make up
the page class since they are all partial classes so they would share the same import statements. Editing autogened code is never a good thing [;)]
I was adding the Imports Windows.Media.Animation namespace, because the Storyboard type was unrecognised in the autogen code and the project would not build until I did this.
You should just be able to import the Windows.Media.Animation namespace in the page.vb file. Since page is a partial class made up of page.xaml, page.g.vb and page.vb when you compile it the imports that are in page.vb should be shared across all three.
Did you try putting the import statement in the page.vb file and it did not work?
Projects created in Blend 2 don't set the project type and file information to the same values that Orcas does, so you don't get the expected behavior from page.g.cs. You also have more issues when it comes to setting debug settings, etc. If you create a
project in Orcas you should be able to compare the project file to the one in Blend and fix the differences. Either that, or just create the project again in Orcas and bring in all of your code from the other project. You will still be able to work with the
project in Blend 2 after you make these changes.
Firstly I did add the imports statement to the page.vb file and saved it in Orcas but I still got the original presumably cached file from Expression blend reverting. I shall look more closely at the process when I am back in work on Monday.
You're right in that I created the project in Blend 2 and was viewing it through Orcas. In future I shall create and govern the project with Orcas and let Blend 2 add the bells and whistles.
GerardL
Member
18 Points
14 Posts
Page.g.vb
Jul 06, 2007 02:24 PM | LINK
I created a small animation in Expression Blend 2, using the VB code option at the New Project dialog.
This created a page.g.vb code page with some basic settings. It seems this resource does not get updated when I edit it within the project in VS Orcas (I had to add several Imports statements to it). Anyway, whenever I click Build in VS Orcas it advises that files have been updated outside the editor and that I should reload, when I do, it loads the original default version of page.g.vb, even though I thought saving it in VS Orcas would update the file.
What I had to do was exit Expression Blend and VS Orcas completely, reopen the page.g.vb in my text editor, add the imports statements and then save it out again. Only then, when I relaunched VS Orcas and opened the project had it updated itself with the later version I had just saved out. That was a lot of work for 1GB Ram and a couple of Imports Statements.
I'm just saying...
[:S]
Zodd
Member
30 Points
13 Posts
Re: Page.g.vb
Jul 06, 2007 07:28 PM | LINK
Why do you need to put import statements in the page.g.vb file? This is of course a class generated by VS. Since Page is a parciate class why not just put the import statement in the page.vb file instead. The page.xaml, page.vb and page.g.vb files make up the page class since they are all partial classes so they would share the same import statements. Editing autogened code is never a good thing [;)]
GerardL
Member
18 Points
14 Posts
Re: Page.g.vb
Jul 06, 2007 08:09 PM | LINK
I was adding the Imports Windows.Media.Animation namespace, because the Storyboard type was unrecognised in the autogen code and the project would not build until I did this.
Is there another way? [:$]
Zodd
Member
30 Points
13 Posts
Re: Page.g.vb
Jul 06, 2007 08:20 PM | LINK
You should just be able to import the Windows.Media.Animation namespace in the page.vb file. Since page is a partial class made up of page.xaml, page.g.vb and page.vb when you compile it the imports that are in page.vb should be shared across all three. Did you try putting the import statement in the page.vb file and it did not work?
Bill Reiss
Contributor
4973 Points
947 Posts
Re: Page.g.vb
Jul 07, 2007 01:49 AM | LINK
Projects created in Blend 2 don't set the project type and file information to the same values that Orcas does, so you don't get the expected behavior from page.g.cs. You also have more issues when it comes to setting debug settings, etc. If you create a project in Orcas you should be able to compare the project file to the one in Blend and fix the differences. Either that, or just create the project again in Orcas and bring in all of your code from the other project. You will still be able to work with the project in Blend 2 after you make these changes.
Bill Reiss, Coauthor of Hello! Silverlight
My blog
GerardL
Member
18 Points
14 Posts
Re: Re: Page.g.vb
Jul 07, 2007 09:11 AM | LINK
Zodd and Bill,
Firstly I did add the imports statement to the page.vb file and saved it in Orcas but I still got the original presumably cached file from Expression blend reverting. I shall look more closely at the process when I am back in work on Monday.
You're right in that I created the project in Blend 2 and was viewing it through Orcas. In future I shall create and govern the project with Orcas and let Blend 2 add the bells and whistles.
thanks
Ger