Thanks for the interesting comment, dot_tom.I'm interested to hear a little about how you learnt PowerShell. Did you force yourself to go "cold turkey" on cmd.exe? Did you use the book above or the reference card that comes with PowerShell? What's the first time you really found yourself saving time through the use of PowerShell? Was it easier or harder than you expected to make the transition? I'd love to hear your thoughts on these and other areas of the learning curve...
bdesmet wrote:Hi Tom,If you're referring to Server Core concerning the exclusion of .NET Framework and PowerShell in that release, the answer is the following. Because .NET Framework today has bindings with the Windows UI APIs (e.g. System.Windows.Forms) it isn't possible to include it with Server Core. I'm sure there are some other bindings too that make it impossible to include .NET Framework 2.0 with Server Core today but over time we might see refactoring and modularization of the .NET Framework itself, eliminating these kind of issues for a subsequent release of Server Core.Hope this helps,-Bart
Tim Sneath wrote: Thanks for the interesting comment, dot_tom.I'm interested to hear a little about how you learnt PowerShell. Did you force yourself to go "cold turkey" on cmd.exe? Did you use the book above or the reference card that comes with PowerShell? What's the first time you really found yourself saving time through the use of PowerShell? Was it easier or harder than you expected to make the transition? I'd love to hear your thoughts on these and other areas of the learning curve...
Cool. Thanks again. I just started using psh the other day for Post-Build jobs. Have not been use post build because cmd is such a pain to script anything. But now with psh, it is real nice and easy. Here is what I did below. Now I get things like ProjectDir, TargetFileName, ConfigName, etc sent to psh script as parameters. I can then use the params as needed (you can add more of the VS built in params if needed).# File: PostBuild.ps1# Desc: Post-Build Powershell script template.# Add following line to "Post-build event command line:" which will start this script:# 1) powershell -command .'$(projectdir)postbuild.ps1' -targetdir:'$(TargetDir)' -targetfile:'$(TargetFileName)' -projectdir:'$(projectdir)' -configName:'$(ConfigurationName)'# 2) Add this script as a template to your ProjectDir. Change as needed.## For a library (i.e. snapin), you may also want Debug-Run (i.e. F5) support.# Add that support to Debug tab in your project properties:# 1) Add "Start external program": C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe# 2) Add "Command line arguments": -noexit -command add-pssnapin <SnapinName>; cd c:\<SnapinName>\bin\debug# Now when you hit F5, a Powershell window will open and the pssnapin will be added. The snapin# is registered in the Post-build script below so it should already be registered in Psh.
param($targetdir,$targetfilename,$projectdir,$configName)
# Change to build dir.echo "Target: $targetdir"cd $targetdir
get-banner "Build Config:"get-banner $configName
# Build Xeno assem.$xenoDir = "${targetdir}Xeno"echo "XenoDIR:$xenoDir"md $xenoDirdel $xenoDir\*if ($configName -eq "Pro") { xbuild "${projectdir}xenoproject-Pro.postbuild" /passphrase "p" /o "$xenoDir" }if ($configName -eq "Community") { xbuild "${projectdir}xenoproject-Com.postbuild" /passphrase "p" /o "$xenoDir" }if ( ! $? ) {beep; "XENO FAILED."; return}
# Copy required files to Xeno dir.copy $targetdir\*.xml $xenoDirif ($configName -eq "Pro") { copy $targetdir\*CommercialLicense.txt $xenoDir}if ($configName -eq "Community") { copy $targetdir\*CommunityLicense.txt $xenoDir}copy $targetdir\ReadMe.txt $xenoDir
# Install snap-ininstallutil "${TargetDir}Xeno\${TargetFileName}" -uinstallutil "${TargetDir}Xeno\${TargetFileName}"if ( ! $? ) {beep; "InstallUtil FAILED."; return}else{ # Could start a powershell console after build. However, # a better method would be to use Debug option "Command line arguments:" and get F5 support. # invoke-item $pshome\psh.lnk # Example to start a powershell *.lnk that sets colors, buffer size, etc.}del $xenoDir\*.InstallLogdel $xenoDir\*.InstallState
# Create zipif ($configName -eq "Community") { &"c:\Program Files\PACL\pacomp" -a $xenoDir\PowerLockerCv1.zip $xenoDir\*.* }if ($configName -eq "Pro") { &"c:\Program Files\PACL\pacomp" -a $xenoDir\PowerLockerPv1.zip $xenoDir\*.* }
get-banner "Done"# End PostBuild.ps1Now anytime I need Post-build logic, I can just add this file to the project and modify as needed. I add the PostBuild.ps1 file to the Project and make sure the "Build Action" on the file is set to "None" and "Do not copy". Then I just click on the file and edit it in VS and then click Build to run it. Save a ton of manual steps after you get your build script working.Output Windows then looks something like:████ █ █ ███ █ ████ ███ ███ █ █ █████ ███ ███ █ █ █ █ █ █ █ █ █ █ █ █ ██ █ █ █ █ █ ████ █ █ █ █ █ █ █ █ █ █ █ █ ███ █ █ ██ █ █ █ █ █ █ █ █ █ █ █ █ █ ██ █ █ █ █ ████ ███ ███ █████ ████ ███ ███ █ █ █ ███ ███ █
████ ████ ███ █ █ █ █ █ █ ████ ████ █ █ █ █ █ █ █ █ █ █ ███
XenoDIR:C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\PowerLocker\bin\Pro\XenoNew-Item : Item with specified name C:\Documents and
<snip...>
Archive: C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\PowerLocker\bin\Pro\Xeno\PowerLockerPv1.zip preparing to compress... adding: C:\Documents and Settings\Administrator\M████ ███ █ █ █████ █ █ █ █ ██ █ █ █ █ █ █ █ █ █ ███ █ █ █ █ █ ██ █ ████ ███ █ █ █████ I would like to see this support more deeply integrated into VS. For example, the Pre-Build and Post-Build should allow option to use PSH instead of CMD. If psh is selected, it would set all the VS parms automatically. This would eliminate some stuff above and generally be a better experience imo. Enjoy your builds.--William