Howard Bash
asked on
Building and Deploying SharePoint 2010 Web Parts
I am building a web part and am not sure where to deploy it. Initially I need it to available for pages within a site collection subsite. The site collection is also a sub site of a site collection. So forgetting that I may want to use it in another sub site, where do I deploy it and where can I deploy it?
Also, the web part needs to use a class library for accessing some custom reusable functionality and I am not sure of all the required wiring. I have strongly typed the DLL and have exercises it from a console application so I know it does perform the required functions as required. Do I need to add a reference in Web Config for both the web part and this library for safe controls? etc.
Also, the web part needs to use a class library for accessing some custom reusable functionality and I am not sure of all the required wiring. I have strongly typed the DLL and have exercises it from a console application so I know it does perform the required functions as required. Do I need to add a reference in Web Config for both the web part and this library for safe controls? etc.
ASKER
Hi.
I am using VS2013 Pro with Update 4.
I am using VS2013 Pro with Update 4.
ASKER
I tried building a sample and it seemed to deploy but I don't see the web part when I try to add it to a page. This is the Output window during the deploy command:
------ Build started: Project: MyWebParts, Configuration: Debug Any CPU ------
MyWebParts -> C:\mycode\MyWebParts\MyWeb Parts\bin\ Debug\MyWe bParts.dll
Successfully created package at: C:\mycode\MyWebParts\MyWeb Parts\bin\ Debug\MyWe bParts.wsp
------ Deploy started: Project: MyWebParts, Configuration: Debug Any CPU ------
Active Deployment Configuration: Default
Skipping deployment step because a pre-deployment command is not specified.
Skipping application pool recycle because no matching package on the server was found.
Skipping package retraction because no matching package on the server was found.
Add Solution:
Could not load file or assembly 'file:///C:\USERS\MyName\A PPDATA\LOC AL\MICROSO FT\VISUALS TUDIO\12.0 \EXTENSION S\3D1CWR3B .KNL\CKS.D ev12.Cmd.I mp.v4.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
Adding solution 'MyWebParts.wsp'...
Deploying solution 'MyWebParts.wsp'...
Activate Features:
Activating feature 'Feature1' ...
Skipping deployment step because a post-deployment command is not specified.
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========
------ Build started: Project: MyWebParts, Configuration: Debug Any CPU ------
MyWebParts -> C:\mycode\MyWebParts\MyWeb
Successfully created package at: C:\mycode\MyWebParts\MyWeb
------ Deploy started: Project: MyWebParts, Configuration: Debug Any CPU ------
Active Deployment Configuration: Default
Skipping deployment step because a pre-deployment command is not specified.
Skipping application pool recycle because no matching package on the server was found.
Skipping package retraction because no matching package on the server was found.
Add Solution:
Could not load file or assembly 'file:///C:\USERS\MyName\A
Adding solution 'MyWebParts.wsp'...
Deploying solution 'MyWebParts.wsp'...
Activate Features:
Activating feature 'Feature1' ...
Skipping deployment step because a post-deployment command is not specified.
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========
ASKER
I tried the one of the sample projects from https://msdn.microsoft.com/en-us/library/office/ff728094(v=office.14).aspx. The solution builds and deploys but the web part is missing in action. Not clear at all why this is occurring.
Any thoughts on this would be greatly appreciated.
Any thoughts on this would be greatly appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I'll try that in the morning. I have to login and then access a VM to make that change. Also, the web part needs to use another DLL that I built for build some list objects for displaying. I have built that and signed it testing it in a console application where it indeed works. I am guessing that I need to also make sure that that "support" library is written in .Net 3.5 too? Also, do I need to add the safecontrol entries or does VS2013 do that for me (for the web part and the "support" library)?
Thanks.
Thanks.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Since my solution involves two DLLS (the web part and the "support" library), does this solution know to make two safecontrol entries?
Yes :-)
ASKER
Hi,
Both DLLS show on their respective project properties that they are as follows:
The Web Part Project
Application Tab: .Net Framework 3.5, Output Type Class Library, Startup Object Not Set
The "Support Class Library"
Application Tab: .Net Framework 3.5, Output Type Class Library, Startup Object Not Set
Please advise...
Thanks,
Howard
Both DLLS show on their respective project properties that they are as follows:
The Web Part Project
Application Tab: .Net Framework 3.5, Output Type Class Library, Startup Object Not Set
The "Support Class Library"
Application Tab: .Net Framework 3.5, Output Type Class Library, Startup Object Not Set
Please advise...
Thanks,
Howard
ASKER
It has been suggested that the issue is caused by my needing DBA rights on the SQL database where the content is stored. I am currently twisting my shorts attempting to get my rights elevated. I'll let you know if indeed that is the cause of my deployment issue.
Thanks.
Thanks.
ASKER
In a ULS file I am seeing this error which seems like a clue:
Missing one or more of the following attributes from the root node in solution mywebpar.wsp: assembly",type".
Missing one or more of the following attributes from the root node in solution mywebpar.wsp: assembly",type".
if this is a on-premise farm and you can install SharePoint solutions, your scenario looks like what is called a SharePoint farm solution.
A solution package is a CAB file with the extension .wsp and can contain different features (from event receiver, custom actions, site/web/list templates as well as web parts).
What version of Visual Studio are you using?
A quick first guide into SharePoint development can be found here:
https://msdn.microsoft.com/en-us/library/office/ff597540(v=office.14).aspx
Another sample is here:
http://www.informit.com/articles/article.aspx?p=1626325
HTH
Rainer