Now, some people are already developing products for Silverlight 2.
However, I want to experience the new features of Silverlight 3 in advance.
However, Silverlight 2 tools and Silverlight 3 beta tools cannot be installed on vs2008 SP1 on the same machine at the same time.
Fortunately, Jeff Wilcox (Microsoft Silverlight Dev) provides a solution for coexistence.
However, his solution still needs to be digested and tested successfully (it took me nearly half an hour)
This is why I wrote a blog and added my understanding. I hope this will help you.
Prerequisites:
- Silverlight tools for Visual Studio 2008 SP1
- Silverlight 3 Tools Beta for Visual Studio 2008 SP1
- Microsoft Expression blend 3 Preview
Select your primary compilation environment:
If you use Silverlight 2 for development
Install Silverlight 3 Tools Beta for Visual Studio 2008 SP1
Install Silverlight tools for Visual Studio 2008 SP1
(It will uninstall Silverlight 3 tools, but does not uninstall Silverlight 3 SDK)
If you are developing a Silverlight 3 applicationProgram
Install Silverlight tools for Visual Studio 2008 SP1
Install Silverlight 3 Tools Beta for Visual Studio 2008 SP1
Supports multi-version Compilation:
Two steps are required to achieve this.
1. Copy all files in the original directory to the root directory of the target directory.
Original directory |
Target directory |
C: \ Program Files \ msbuild \ Microsoft \ Silverlight \ V2.0 \ |
C: \ Program Files \ microsoft sdks \ Silverlight \ V2.0 |
C: \ Program Files \ msbuild \ Microsoft \ Silverlight \ V3.0 \ |
C: \ Program Files \ microsoft sdks \ Silverlight \ V3.0 |
The file in the target directory is as follows:
Note: If you have not installed. Net Ria services Preview
The file microsoft.ria.client.tar gets will not exist
2. Use custom <import/> elements to support the Silverlight version to be compiled
Use NotePad to open the project file of the Silverlight Program (not the web one) (for example, crossbuildtest. csproj)
Find the following sentence:
The editor's translation environment is Silverlight 3 beta
< Import Project = " $ (Msbuildextensionspath) \ Microsoft \ Silverlight \ V3.0 \ microsoft.silverlight.csharp.tar gets " />
The editor's translation environment is Silverlight 2.
< Import Project = " $ (Msbuildextensionspath) \ Microsoft \ Silverlight \ V2.0 \ microsoft.silverlight.csharp.tar gets " />
If you want to compile with Silverlight 2, you can change it to the following:Code:
Code
< Propertygroup >
< Externaltools > C: \ Program Files \ microsoft sdks </ Externaltools >
< Silverlightbuildresources > $ (Externaltools) \ Silverlight \ V2. 0 \ </ Silverlightbuildresources >
< Targetframeworkdirectory > $ (Silverlightbuildresources) Reference assemblies \ </ Targetframeworkdirectory >
< Targetframeworksdkdirectory > $ (Silverlightbuildresources) Libraries \ Client \ </ Targetframeworksdkdirectory >
< Silverlightruntimeversion > 2.0 . 31005.0 </ Silverlightruntimeversion >
</ Propertygroup >
< Import Project = " $(Silverlightbuildresources)microsoft.silverlight.csharp.tar gets " />
To compile with Silverlight 3 beta, modify the following:
Code
< Propertygroup >
< Externaltools > C: \ Program Files \ microsoft sdks </ Externaltools >
< Silverlightbuildresources > $ (Externaltools) \ Silverlight \ V3. 0 \ </ Silverlightbuildresources >
< Targetframeworkdirectory > $ (Silverlightbuildresources) Reference assemblies \ </ Targetframeworkdirectory >
< Targetframeworksdkdirectory > $ (Silverlightbuildresources) Libraries \ Client \ </ Targetframeworksdkdirectory >
< Silverlightruntimeversion > 3.0 . 40217.0 </ Silverlightruntimeversion >
</ Propertygroup >
< Import Project = " $(Silverlightbuildresources)microsoft.silverlight.csharp.tar gets " />
Then, restart the program to compile the Silverlight application you need based on your settings.
When you follow the instructions above to compile other versions
A security warning is displayed when the project is reloaded.
Select load project normally.
Then we can generate a specific Silverlight application based on the specified version.
If you set to compile the application according to Silverlight 2
However, because the new feature of Silverlight 3 is accidentally used, Vs will prompt an error.
The following error message is displayed when 3D plane projection is introduced in Silverlight 2.
Demo:
Silverlight 2 online test
Silverlight 3 online testing (only the Silverlight 3 developer Runtime is installed for normal parsing)