Sharepoint 2010 Create and Add Webpart Automatically In Sharepoint Site When Deploy WSP - visual-studio-2010

I'm using SharePoint 2010 and I have developed webparts at visual studio 2010. I'm already using WSP to deploy my web application into server, but still should create and add the webpart manually through SharePoint site. Is there any way that we can deploy the application and automatically create and add all webparts into the site?

Generally web parts are added to pages using features. Basically you create one site collection feature to deploy web part files to web part gallery and web scope feature which adds this web parts to pages (for example default site page).

Related

Developing Sharepoint webparts in Visual Studio

I want to use Visual Studio to develop webparts for Sharepoint. I've already got a source code that contains different .vue applications and a website which already uses most of those webparts.
I'm fairly new to SharePoint, so there's a few things I don't understand.
In site contents, can I get the source code of the lists, apps etc. that are there?`
How can I use the .vue applications/files from Visual Studio in the Sharepoint application?
I created a new SharePoint-Add-In project in Visual Studio and connected it with the homepage of the website, but how can I work with the source code I have right now to deploy it to the website?
If you're using SharePoint 2013/2016, you could check this thread for demos(SharePoint add-in with VUEjs).
If you're using SharePoint 2019/online, you could create SPFx solution so you could migrate vuejs by PnP/generator-SPFx
SharePoint Framework(SPFx)

Sharepoint 2010 build solution with UI then export as wsp template, to deploy in new environment

I build up a solution using UI in Sharepoint 2010. Solution consisted in creating a new site, as subsite using Team Site Template. Then I added the following artifacts:
Several Custom Columns
2 Custom content types using above columns
Document Library using my content types above
Several Custom Views created for above Document Library
1 Reuseable Workflow (this was developed with sharepoint designer 2010)
3 List Worklfow, using 'Three-state-workflow' template
Customisation of site navigation (quick launch)
Customisation of site home page
Some security groups
Added users to groups
Then I exported the site as wsp template, downloaded it to local drive.
I imported it in visual studio 2010, than changed the deployement method to 'Farm Solution' (not Sandboxed Solution) and packaged it.
I have to deploy to new sharepoint environment (new server), but till now there are issues in feature activation (total 5 features). the feature wich contains module elements is having issue.
Any idea how to solve this issue ?
Any idea how to streamline this process in order to avoid deployment issues ?

Can we package and publish a website using webdeploy

In Visual Studio, is it necessary to convert a website into Web Application project for Web Deploy to work?
It's not possible to publish a website created in Visual Studio 2010 unless it's a Web Application project.
File based web projects created using File -> New -> Web Site... or Shift+Alt+N (assuming you haven't changed the keystrokes) can only be published using FrontPage extensions when publishing to http://www.mysite.com.
So yes, you need to convert your "web site" project to a "Web Project" to be able to publish using Web Deploy.

In which circumstances are suitable for Web Application or Web Site in Visual Studio?

I have one project which has APP_CODE folder and runs with Windows Authentication.
1) I created Web Site and added the files of project but I couldn't run with windows authentication
2) Then I created web application project and check "Use Visual Studio Development Server". But now, I couldn't get access to the classes which are in App_Code folder.
There is no choice to select Visual Studio Development Server when I use Web Site project!
Questions:
Why can't I add APP_CODE folder to the Web Application ?
Why can't I run my Web Application on Visual Studio Development Server?
In which circumstances I should choose Web Site or Web Application options ?
PS: I want to put pictures of Web Application and Web Site:
Web Application:
Web Site:

Sharepoint 2010: Web parts inside web templates

I created a site in Sharepoint 2010 and exported it using "Save as template". That created a .wsp which I imported into Visual Studio 2010 and created a solution. That solution contains a web template (which is just an onet.xml file) among all the site pages and assets. So far, so good.
Now, I developed some web parts and added them to the project. Then I compiled and packaged everything, created a site in Sharepoint by selecting "Select template later", uploaded the .wsp into the site, and activated it. At that point all the webparts are created, and also the web template. So I go to the home page, and create the site with that template. But when the site is create from the template, all the web parts are deleted and replaced by Sharepoint basic web parts (Content editor, page viewer, ...).
Is there a way to include the web parts in the web template? I'm sure it's possible editing the onet.xml, but I'm not sure how.
Thanks in advance
Have you tried manually setting up your web part page after the deployment? Then you can export the site as a template and then look at the resulting onet.xml file. That should give you some clues about the changes you need to make.

Resources