1.新建工程
模板选择:Visual C# -> SharePo - > Empty
名称输入SamplePage
2.添加新建项选择:Module
3.向Module中添加ASPX页面可以吧Sample.txt扩展名改成aspx文件再输入内容
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/C#" runat="server">
void ShowMessage(object sender, EventArgs e)
{
txt1.Text = "My Page!!";
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txt1" runat="server" Width="100"></asp:TextBox>
<asp:Button ID="btn1" runat="server" Text="Button" _disibledevent=> </div>
</form>
</body>
</html>
4.Module.xml内容进行相应修改
<?xml version="1.0" encoding="utf-8"?>
<Elements Id="e6ad0016-621c-460b-9de6-0881847edc8c" xmlns="http://schemas.microsoft.com/sharepo/">
<Module Name="SamplePage" Url="MyPath">
<!--Url为 2级路径-->
<File Path="MyPage.aspx" Url="MyPage.aspx" />
<!--Path为物理路径名Url为访问时链接页面名称-->
</Module>
</Elements>
5.打开WSP View 窗口可以看到该Module内容(菜单 -> View -> Other Windows -> WSP View)
6.部署:直接F5或从菜单 -> Build -> Deploy Solution
7设置:
打开Central Administration -> Solution Management 可以看到列表中有simplecalculator.wsp将其部署到Team Site
wsp文件格式是个标准zip要所文件用winzip等可以打开看到其内容
然后打开Team Site在Bin文件夹下可以看到已加入SamplePage.dll打开Team Site功能管理激活SamplePage
输入URl:http://localhost/MyPath/MyPage.aspx页面可以正确执行
也可以添加后台页代码后面会用到
飘遥BLOG:http://www.cnblogs.com/zxjay/
最新评论