Showing posts with label visual studio 2008. Show all posts
Showing posts with label visual studio 2008. Show all posts

Sunday, September 14, 2014

Cannot package wsp in VS2008 for SP2007

Error:

SPService.svc is too busy


Resolution:
Turn on Sharepoint services.

Error:

VSeWSS Service Error: Error loading assembly XXX


Resolution:
Ensure IIS Website Central Admin has started.
App Pool ID should be the admin account and not Network Service.

Wednesday, August 4, 2010

aspnet_merge.exe

I installed the VS2008 Web Deployment Projects on my machine and when I try to run msbuild (for K2 Workflow deployment) I am getting this error:
System.Exception: The forms could not be published successfully to the server. Please review logger details for more information. Logger Error: C:\Program Files (x86)\MSBuild\Microsoft\WebDeployment\v9.0\Microsoft.WebDeployment.targets(575,9,The specified task executable location "bin\aspnet_merge.exe" is invalid.)

It seems that aspnet_merge.exe is not packaged together with VS2008. One solution is to install the Windows 2008 SDK.

Alternatively, can try to extract the exe file from another machine with Visual Studio installed and place it in this folder: C:\Program Files\Microsoft SDKs\Windows\v6.1
You might also need to set the environment variable for FrameworkSDKDir:
SET FrameworkSDKDir="C:\Program Files\Microsoft SDKs\Windows\v6.1"

References:

Monday, May 3, 2010

Debug Silverlight 2 in Visual Studio 2008

http://blogs.digitss.com/microsoft/silverlight-microsoft/not-able-to-debug-silverlight-20-application-in-visual-studio-2008/

Right Click the Web Project and go to Web tab under properties. Please check the Silverlight Debugger as shown in the Image below, you will be able to Debug.

Monday, November 2, 2009

How to Publish Web Sites (Visual Studio)

Publishing a Web site compiles the executable files in the web site and then writes the output to a folder that you specify. [More]

Before publishing:
1. Check config file for any settings that need to exist at the remote location (e.g. connection strings, membership settings, and other security settings).
2. Check config file for any settings that need to be changed on the published Web site (e.g. Disable debugging, tracing, and custom errors).

To publish:
1. On Build
menu, click Publish Web Site.
2. In the Publish Web Site dialog box, click the ellipsis button (...) to browse to the location to which you want to publish.
3. Other properties:
3a. Allow this precompiled site to be updateable: To be able to change layout (but not code) of .aspx files after publishing.
3b. Enable strong naming on precompiled assemblies: To name strongly named assemblies using key file or key container.
4. Click OK.
Publishing status is displayed in the taskbar. When publishing is completed, status of Publish succeeded is displayed.

After publish:
You can configure your published web sites here.

Friday, September 4, 2009

Insert Group Headers within GridView [REVISITED]

We should consider using AJAX to solve the problem of expanding/collapsing sub-sections within the grid view. [View Sample]
AJAX elements used: Collapsible Panel
The idea:
- Insert an AJAX Script Manager
- Define 2 Data Sources (for GridView1 and GridView2)
- Insert an AJAX Update Panel, which nests a ContentTemplate, and contains all the elements below.
GridView1
- Links to the data source that retrieves the list of group headers.
- OnRowCreated event handler: GridView1_RowCreated
- Contains 1 column, which is a TemplateField
- Nested inside the TemplateField tag is an ItemTemplate, which nests 2 Panels (Panel1 and Panel2) and an AJAX CollapsiblePanelExtender.
Panel1
- Represents the group header, so customise accordingly (i.e with the expand icon)
Panel2
- Contains GridView2
GridView2
- Links to another data source that retrieves the list of item associated with the group header
- Similar to a normal grid view, add the boundfield tags and initialise the DataField to bind the values of the column.
CollapsiblePanelExtender
[cc1:CollapsiblePanelExtender ID="cpe" runat="Server" TargetControlID="Panel2" CollapsedSize="0" Collapse="True" ExpandControlID="Panel1" CollapseControlID="Panel1" ExpandDirection="Vertical" /]
* Can also add attributes like expand/collapse image

* Remember to add the following tag at the top of the .aspx file
[%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %]

In the .cs page, method for GridView1_RowCreated(object sender, GridRowEventArgs e) should contain:
if (e.Row.RowType == DataControlRowType.DataRow)
{
    SqlDataSource ctrl = e.Row.FindControl(”SqlDataSource1”) as SqlDataSource;
    if (ctrl != null && e.Row.DataItem != null)
      ctrl.SelectParameters["CustomerID"].DefaultValue = ((DataRowView)e.Row.DataItem)["CustomerID"].ToString();
}

Source:
http://yasserzaid.wordpress.com/2008/12/21/ajax-collapsible-panel-with-gridview-master-and-detail/
http://mosesofegypt.net/post/Building-a-grouping-Grid-with-GridView-and-ASPNET-AJAX-toolkit-CollapsiblePanel.aspx

Thursday, September 3, 2009

Insert Group Headers within GridView

The idea is to group the data in the Grid View, then insert a group header for each group of items.
References:
http://blog.zygonia.net/PermaLink,guid,c093836d-8d97-4e5b-8a1c-8218742cb686.aspx
http://www.agrinei.com/gridviewhelper/gridviewhelper_en.htm
http://www.asp.net/learn/data-access/tutorial-27-cs.aspx

In a nutshell, we can do the following:
1) Add a RowDataBound event to add additional table row when we encounter new group.
2) Override the Render method to add additional table row when we encounter new group.

Issue at hand:
1) Add "Expand/Collapse" button in the group header, such that upon click, will set the respective rows to visible = true or false.

Friday, August 28, 2009

.NET Tips and Tricks [String]

Use string.IsNullOrEmpty(myStringValue) instead of myStringValue == "" for better accuracy.

----------------------------------

When comparing strings, a better convention would be to use myStringValue.Equals(anotherStringValue, StringComparison.CurrentCultureIgnoreCase)

.NET Tips and Tricks [General]

string fileName;
byte[] data = GenerateReport(string ReportTitle, out string fileName);
// The GenerateReport(..) method returns a byte array containing report content.
// The method will also initialise the string variable "fileName"

--------------------------

Avoid indentations as much as possible because it makes your code harder to read.
Suggestion:
Instead of using if (A && B) { ... }
consider using if (!A || !B) continue;

.NET Tips and Tricks [Extension Classes]

Characteristics of extension classes:
- Must be public
- Static functions
- Include keyword "this" in the parameter to be extended
- Solution must include the reference System.Core
- Class must be in same namespace

Example of use:
namespace ReportingWebApp
{
public static class SPListItemExtensions // extends the SPListItem class
{
public static string GetStringValue(this SPListItem item, string fieldName)
{
// insert code here
}
}
}

In main application:
SPListItem item = myList.Items[0];
string itemStringValue = item.GetStringValue("Color");

.NET Tips and Tricks [Debugging]

#if DEBUG
      // enter code for debugging here
#else
      // enter code for live here
#endif

[Place debugging code within the #DEBUG region to prevent any mistakes of forgetting to comment out the printlines or carry out certain test actions when live]

Thursday, August 27, 2009

Deploying a SharePoint webpart

There are several ways to do it:

From Visual Studio 2008 [Condition: You have the source code]
1) In Visual Studio 2008, DEPLOY webpart solution
2) Go to local SharePoint, Site Actions -> Site Settings
3) Under the Site Collection Administration header, click "Go to top level site settings"
4) Under Galleries, click "Web Parts". You should see your web part listed there.
5) Under Site Collection Administration, click "Site collection features". Your web part should be Activated.
6) Add a new web part page, click Edit Page and then add the web part to the page.

Using CMD [Condition: You only have the wsp file]
1) Type cd C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN
2) Then type stsadm -o addsolution -filename [insert filename]
This will add your solution (.wsp) into SharePoint
3) Launch SharePoint Central Administration.
4) Under Operations, click on Solution Management. You should see your webpart there.
5) Click on the web part, then click Deploy.