Friday, December 23, 2011

Create BAT File in MOSS 2007 / SharePoint 2007


To ease the deployment process, create a batch file called InstallAll.bat in the folder that contains the FormDataWorkflow.sln Visual Studio solution file. Add the following code to the InstallAll.bat file.
iisreset /stop

"%programfiles%\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" -uf FormDataAspxPages
"%programfiles%\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" -if FormDataASPXPages\bin\Debug\FormDataAspxPages.dll

"%programfiles%\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" -uf FormDataWorkflow
"%programfiles%\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe" -if FormDataWorkflow\bin\Debug\FormDataWorkflow.dll

iisreset /start

copy /Y "FormDataAspxPages\FormDataAssocForm.aspx" %SystemDrive%"\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS"
copy /Y "FormDataAspxPages\FormDataInitForm.aspx" %SystemDrive%"\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS"

mkdir  %SystemDrive%"\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATURES\FormDataWorkflow"

copy "FormDataWorkflow\Feature.xml" %SystemDrive%"\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATURES\FormDataWorkflow"
copy "FormDataWorkflow\workflow.xml" %SystemDrive%"\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATURES\FormDataWorkflow" 

pushd "%programfiles%\common files\microsoft shared\web server extensions\12\bin"

stsadm -o deactivatefeature -filename "FormDataWorkflow\feature.xml" -url http://localhost -force
stsadm -o uninstallfeature -filename "FormDataWorkflow\feature.xml" -force

stsadm -o installfeature -filename "FormDataWorkflow\feature.xml" -force
stsadm -o activatefeature -filename "FormDataWorkflow\feature.xml" -url http://localhost -force

popd

PAUSE

Friday, December 9, 2011

Debugging Feature Receivers


Feature receivers can be difficult because they are often executed within a separate process. To see an example of this problem put a breakpoint on the first line of our FeatureActivated method and try debugging using Visual Studio.  The code will be deployed and the feature will be activated, but execution will not stop at the breakpoint.  Visual Studio makes use of a separate process, VSSPHost.exe, to automate the deployment only, and therefore the breakpoint is never hit but the code still execures.
        We can work around this issue in one of two ways: we can either attach a debugger to the appropriate process, or we can ensure that our feature receiver runs in the W3SVC process. To ensure  that a debugger is attached to the correct process, we can take the following steps:
   
            1.   Add the following line of code to the method to be debugged:
    Debugger.Break();

   When error window open then select “Debug the Program”
 

Featured Post

Mention a Channel or Team – Power Automate

Mention a Channel or Team – Power Automate graph.microsoft.com/v1.0/teams/{teamId}/channels/{channelId}/messages Channel: ---------- {   ...

Popular posts