PageRenderTime 36ms CodeModel.GetById 17ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 1ms

/V4/PrismLibrary/Silverlight/Prism.Tests/Mocks/Modules/createXap.bat

#
Batch | 70 lines | 40 code | 20 blank | 10 comment | 20 complexity | 643257ca821c78cfcd6bdc541106fb55 MD5 | raw file
 1@echo Dynamically creating a XAP file named RemoteModules.xap. This file is included in the Composite.Silverlight.Tests project as a file link (even if it's not shown in Visual Studio) as an embedded resource. 
 2
 3SET Configuration=%1
 4
 5REM Pick the right program files.
 6SET progRoot=%ProgramFiles(x86)%
 7IF "%progRoot%" == "" SET progRoot=%ProgramFiles%
 8
 9pushd "%~dp0"
10
11set compositeDll="..\..\..\Prism\Bin\%Configuration%\Microsoft.Practices.Prism.dll"
12if not exist %compositeDll% echo ERROR. Could not find %compositeDll%
13if not exist %compositeDll% goto Error
14
15set cscBin="%WINDIR%\Microsoft.NET\Framework\v3.5\Csc.exe"
16if not exist %cscBin% set cscBin="%FrameworkDir%\%Framework35Version%\Csc.exe"
17if not exist %cscBin% echo ERROR. Could not find %WINDIR%\Microsoft.NET\Framework\v3.5\Csc.exe
18if not exist %cscBin% goto Error
19
20REM Try for Silverlight 5 assemblies
21set silverlightDll="%progRoot%\Reference Assemblies\Microsoft\Framework\Silverlight\v5.0\mscorlib.dll"
22if not exist %silverlightDll% echo Could not find %silverlightDll%. Trying for Silverlight 4 assemblies.
23
24REM Try for Silverlight 4 assemblies
25if not exist %silverlightDll% set silverlightDll="%progRoot%\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\mscorlib.dll"
26if not exist %silverlightDll% echo Could not find %silverlightDll%. Trying for Silverlight 3 assemblies.
27
28REM Try for Silverlight 3 assemblies
29if not exist %silverlightDll% set silverlightDll="%progRoot%\Reference Assemblies\Microsoft\Framework\Silverlight\v3.0\mscorlib.dll"
30if not exist %silverlightDll% echo Could not find %silverlightDll%. Trying for Silverlight 2 assemblies.
31
32REM Try for Silverlight 2 assemblies
33if not exist %silverlightDll% set silverlightDll="%progRoot%\Microsoft SDKs\Silverlight\v2.0\Reference Assemblies\mscorlib.dll"
34if not exist %silverlightDll% echo Could not find %silverlightDll%.
35 
36if not exist %silverlightDll% goto Error
37
38REM Build 2 DLLs
39%cscBin% /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE;SILVERLIGHT /reference:%silverlightDll% /reference:%compositeDll% /target:library RemoteModuleA.cs
40%cscBin% /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE;SILVERLIGHT /reference:%silverlightDll% /reference:%compositeDll% /target:library RemoteModuleB.cs
41
42if exist "%CD%\RemoteModules.temp.zip" del "%CD%\RemoteModules.temp.zip"
43
44REM Add the 2 DLLs and the manifest to a Zip file
45cscript /nologo AddToZip.vbs "%CD%\RemoteModules.temp.zip" "%CD%\AppManifest.xaml"
46cscript /nologo AddToZip.vbs "%CD%\RemoteModules.temp.zip" "%CD%\RemoteModuleA.dll"
47cscript /nologo AddToZip.vbs "%CD%\RemoteModules.temp.zip" "%CD%\RemoteModuleB.dll"
48
49REM Rename Zip file to XAP
50move RemoteModules.temp.zip RemoteModules.xap
51
52REM delete temporary files
53del RemoteModuleA.dll
54del RemoteModuleB.dll
55goto End
56
57
58:Error
59echo -------
60echo WARNING
61echo -------
62echo There was an error creating a mock XAP file from createXap.bat. The test XapModuleTypeLoaderFixture.ShouldLoadDownloadedAssemblies will probably fail because of this reason.
63echo .
64
65REM create an blank file to avoid compilation errors for this error only (because the project needs to have the RemoteModules.xap file as a resource).
66if not exist RemoteModules.xap type NUL > RemoteModules.xap
67
68
69:End
70popd