WSPBuilder questions for first-time webpart - sharepoint

I have made my first webpart using WSPBuilder. When I try to deploy it using STSADM, I get an error stating access is denied. I am an admin on the machine (well it's a VM).
Also, with WSPBuilder, do I need to change the config files (I assume no as the point of the tool is to automate this)?
Thanks

There could two reasons for your problem
Even though you are the admin of the system you may not have privilege in central Administration. So login in the system with the user name of sharepoint administrator and try to deploy it.
There may be a problem in the way you created the WSP. if you deploy webpart using WSP then there is no need to edit the config file manually. Recently I have created a blog which explain how to create simple webpart, creating WSP and deployment. If interested check it out http://www.allaboutmoss.com/index.php/2010/03/22/hello-world-sharepoint-webpart-for-beginners/

It sounds like you don't have enough permissions to add the webpart. What OS are you on? If it's Windows Server 2008 R2 etc you will have to run the command prompt as an administrator or turn off UAC for administrators. As for the config WSP builder will create you a file called solution.txt which contains the Id for your solution. For more control over what it is doing you can add a WSP Builder config file to your project called "WSPBuilder.exe.config". An example one can be found in "C:\Program Files\WSPTools\WSPBuilderExtensions".

Go to --> RUN--> SERVICES.MSC--> check the following service is started or not.
Windows SharePoint Services Administration, if not pls start this service. if the wsp is deployment done. go center admin--> Operations -->Global Configuration -->Solution management . This page has a list of the Solutions in the farm. check ur wsp in this list.

Related

Using MsDeploy to create web site or virtual directory

We're trying to figure out how to automate our website deployment. We've picked an existing project, and started playing around.
First, I used the Publish wizard from with VS2012 to create a Web Deploy Package. We then tried deploying the package as a website, through the IIS Manager, and that succeeded without a problem. We thought we were nearly there.
What was next was to learn how to run this from the command-line, so we could script it. And that's caused us no end of headaches.
We've been playing around with msdeploy.exe, and with the .cmd file that the publish wizard created, and while both methods seem to install the package as a virtual directory just fine, neither will install the package as a root website.
Browsing around on the web, I've run across this:
Web Deploy iisApp Provider
In a sync operation, the iisApp provider copies content to a folder under the destination site that you designate and marks the destination folder as an application. The iisApp provider cannot create a site. The iisApp provider will not create applications under sites that do not exist.
And
If you want to synchronize a Web site and its related configuration, use the appHostConfig provider.
At this point, we don't know beans about iisApp, or appHostConfig, or whatever. We didn't create a package that used one or the other, VS2012 did. We haven't a clue, at this point, how to convince VS2012's web publish to create an appHostConfig package, and for that matter, I don't know if we want to.
Here's the thing - whether a given website is installed as a root application or as a virtual directory is not something the developers control - it's a decision made by the implementation team. Or testing team usually installs any given website both ways, to ensure that both work.
And since IIS seems to be able to manage to install this package as a root site, there must be a way to get msdeploy to do it.
But how?

SharePoint 2010: Setting up a local dev environment from production data - Could not load file or assembly due to invalid PublicKeyToken

I have tried multiple ways to get the production SharePoint content to my newly installed local development environment that is running on a VM Windows Server 2008 R2. After an export of the farm and a restore failed I came across this blog post and followed these instrucitons: http://richardstk.wordpress.com/2012/02/03/build-a-sharepoint-2010-development-test-environment/. To sum up, it's basically backing up the live SQL Content database as well as the Profile, Sync and Social databases, then restoring them on the dev machine and pointing SharePoint to use these new databases instead of the old ones. Then after that I deployed the custom webparts to the development server from within Visual Studio.
I've done this and it seemed to work pretty well. I can access Central Administrator as well as setting up a SharePoint Connection within Visual Studio and being able to see all the pages, lists, documents, etc. So it is definitely pointing to the new content database. I should mention I can also connect via SharePoint Designer and access all the correct content, Master Pages, lists, etc.
The problem I am having is that I am getting a "Could not load file or assembly" error when I go to the site in a browser and it takes me to /Pages/Home.aspx. The file is a custom webpart that I have deployed from within Visual Studio. When I look within the GAC I see the assembly listed but the PublicKeyToken is different from the one that is shown in the error message.
When I dig into it a little more I see that the custom user control is registered in my Master page, and when I look at the ascx file in the _controltemplates directory where it is located there is an Assembly that looks like this:
<%# Assembly Name="BlogRoll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=529e9730fe2a198d" %>
That PublicKeyToken is correct for the live site when I look in the GAC there but when I deployed it to my local GAC it created a new PblicKeyToken. Sorry if I'm rambling but I wasn't sure what was relevant and what wasn't.
I guess my question is how to handle this? It doesn't seem smart to change all the ascx files locally to match the new PublicKeyToken's that I have in the local GAC because then when I deploy these changes to live they won't find the appropriate assembly. What is the best way to handle this?
UPDATE
The code in question has a key.snk file that is being used to strongly sign it. My understanding is that this should make it so that it gets compiled with a specific PublicKeyToken each time and therefore install in the GAC with a specific PublicKeyToken. If that is true, then I believe the only reason it would have a different key token on my dev environment versus the production is that the key.snk file that has been provided is incorrect. Is that true?
You could use WSP Builder or WinGac to forcibly deploy the assembly with the correct PublicKeyToken to your local GAC.

Custom workflow action deployment on multi server farm

I created a wsp solution that which create 2 custom workflow actions. I want to deploy it to my 2 servers farm which have an application server and a webfront end server. SPF Web application is not activated on the app server.
My visual studio solution goes like this:
-One project which create the dll, where actions code is.
-One project which create the wsp package, feature, etc. The package references the other project as additional assembly.
My problem is, when I deploy my wsp package with Deployment Server Type WebFrontEnd, the feature is only installed on the wfe and I can't activate it. I can't see the feature in the manage feature page (the feature is farm level). When I change the Deployment Server Type of the package to ApplicationServer, I get the following message:
"This solution must be deployed to application servers, not front-end Web servers. It cannot contain a resource that is scoped to a Web application."
I did some tests. I removed the additional assembly from my package and then I can deploy my wsp solution as ApplicationServer type (but can't use my custom actions..). Then I created a dummy dll with nothing in it, added it as additional assembly to my sharepoint package and I realised I can't deploy my wsp as ApplicationServer type again.
So, can I reference an additional assembly from my wsp solution and still deploy as ApplicationServer type??
How can I deal with this? Any idea?
I did it again, I've been looking for answers for this all day, I finally post something here and one hour later, I got myself the answer. Here it is anyway.
I deployed independently both solutions using 2 wsp packages. One simply deploys the dll into the gac (and is ApplicationServer), the other one is using it without deploying it itself (and is WebFronEndServer). Now I have to deal with making sure the first one is deployed before using the other one... Feature activation dependency should do it.
Regards.

deploy an Application page of Sharepoint 2010 to another production server

How to deploy an Application page of Sharepoint 2010 to another production server.
I've created an Application page of Sharepoint 2010 inside the mapped layout folder. Everything works nicely now in Visual Studio 2010.
I can debug it after pressing F5, I can retract it and deploy it with Visual Studio 2010.
But when it comes to deploying it to another production server, I have tons of questions.
Basically I don't know how to deploy it to another production server. My first thought was just copy the pages to the Layout folder of IIS and register the referenced dlls. But after I studied a little bit of deployment, I feel my thought is ugly.
I tried "right clicking" on the project name and "package". The Visual Studio generates a "MyProjectName.wsp" in the bin folder. I used the central administration to upload this wsp file. But when I activate it, it raised an error saying "This solution contains invalid markup or elements that cannot be deployed as part of a sandboxed solution. Solution manifest for solution 'af2f9404-3b39-4f90-87f5-31e14b2f9a9a' failed validation, file manifest.xml, line 6, character 4: The element 'Solution' in namespace 'http://schemas.microsoft.com/sharepoint/' has invalid child element 'TemplateFiles' in namespace 'http://schemas.microsoft.com/sharepoint/'. List of possible elements expected: 'FeatureManifests, ActivationDependencies' in namespace 'http://schemas.microsoft.com/sharepoint/'." It seems that my application is not a sandbox, but I can't change it to a sandbox. Because when I do change it, the Visual Studio tells me "The deployment type "TemplateFile" of file "ApplicationPage1.aspx" in Project Item "Layouts" is not compatible with a Package in a Sandboxed Solution.
The Project Item "Layouts" cannot be deployed through a Package in a Sandboxed Solution.
Package validation failed."
Besides, even if I can successfully activate the .wsp file, I am not sure if the application page can be added to the Layout folder. Because I don't know how the .wsp file locate and find my application page? It doesn't have the page in it. Can anyone explain a bit on it?
Thanks for your answers.
1) It's strongly recommended that you use powershell to run your test and production deployments: http://dotnet.sys-con.com/node/1208275
2) Try changing your SharePoint solution to a farm solution and repackaging your wsp.
3) By right clicking on your project in visual studio and adding the mapped Layouts folder the solution packaging handles placing any application pages/user controls that you have in the appropriate directory inside your wsp.

How to change deploy server in visual studio 2010 for web part?

I have a web part that I have been deploying to Server A. I now have a new SharePoint environment I would like to deploy my web part to (Server B). How can I set the web part solution to deploy to Server B rather than Server A? I have done this before but cannot find the place to do it.
Thanks.
To Deploy from Visual studio, VS needs to be installed on the server you're deploying to. To change the site you're deploying to for development/debugging purposes is a property on the project file in VS.
Shane
To clarify select the project in solution explorer then edit the Site URL property in the Properties toolbox, do not right click and select properties.
In order to deploy to a remote SP application, I recommend using PowerShell scripts that are run on the remote server. That is what I did, and it works well. Much easier than stsadm.
Change the Site Url in Project Properties to deploy in desired server.
u can use stsadm command to deploy into new server

Resources