1.新建CopyToLayouts.bat文件保存到项目Web解决方案根目录下,写入以下内容:
ECHO OFF
@SET TEMPLATE="C:program filescommon filesmicrosoft sharedweb server extensions14Template"
@SET STSADM="C:program filescommon filesmicrosoft sharedweb server extensions14inSTSADM.exe"
@SET GACUTIL="C:Program Files (x86)Microsoft SDKsWindowsv7.0ABinNETFX 4.0 Toolsx64gacutil.exe"
@SET BINDIR="C:inetpubwwwrootwssVirtualDirectories80in"
ECHO 复制文件到Sharepoint目录
xcopy _layouts* %TEMPLATE%LAYOUTS /e /r /y
echo 复制用户控件
xcopy _controltemplates* %TEMPLATE%CONTROLTEMPLATES /e /r /y
Echo 复制到BIN目录
xcopy BIN* %BINDIR% /e /r /y
2.在项目-属性-生成事件中的后期生成时间命令中加入以下命令:
cd $(ProjectDir)
CopyToLayouts.bat