How to upgrade a part of a package/solution (customwebform, workflow, etc.) without losing list items - sharepoint

I've been developing a new SharePoint 2010 package in Visual Studio 2010. This is my first development project in SharePoint so please pardon my use of incorrect terminology.
Within the package/solution there are a couple of Features, a couple of custom web forms, and a workflow for the custom list type which is also within the solution.
To develop and debug I've been simply using the Build > Deploy Solution option from within Visual Studio to build the solution and then it would automatically connect to my sharepoint server and create the custom List, install the features, add the workflow, etc.
But when I want to make a change, say change the color of the text on the custom NewForm (mine is called MyCustomForm.ascx) then I click Build > Deploy Solution it deletes the custom list, deletes the workflow, deactivates and deletes the features and then re adds them all again. Thus I lose all of my list items.
In production if I need to modify the workflow I can't simply do this as we would lose all of our list items. How can I do this?
I've done days worth of research and nothing works. I've looked into:
stsadm -o upgradesolution -name SharePointProject1.wsp -filename ...
stsadm.exe -o execadmsvcjobs
with no avail. It says everything "works" fine (no errors) but doesn't update the custom MyCustomForm.
I've also tried manually editing the files in:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\CONTROLTEMPLATES
to no avail as well. I modify the MyCustomForm.ascx file and refresh the SharePoint site page and it hasn't changed.
Any insight would be helpful. I am doing all development on the server machine that is running SharePoint and have admin access if that helps. Thank you in advance for all of your help.

The list is deleted because the solution package that you're deploying has the list item in it so Visual Studio is "helping" by making sure that you get the lastest version of everything (even it it hasn't changed)
There are two approaches you can take to over-ride this behaviour
Set the deployment model to "No Activataion" this will result in the package being deployed and leaving previously deployed and activated feature in place.
Remove the list instance item from the package by double clicking on the Package in the Solution Explorer and then double clicking on the List Instance Item in the right hand pane.
Next time re-deploy the solution you not should have your existing list removed (I'm not 100% on the workflow association behaviour).
Of the two I'd lean towards option 2

Related

Visual Studio 2012 Build Process Template Dropdown does not populate

My issue is that I cannot select a build process template after migrating to TFS/VS2012.
I managed to google and find one article which suggest the same problem here,
Possible Bug
Any ideas how I can get the dropdown to load the Build Process Templates or why they may not be getting loaded?
Also, I am able to click New->Copy Template, and copy successfully, but it never populates the dropdown list after accepting.
Possibly the same issue
I recently ran into the same problem but not related to upgrading the server. We were not able to see build process templates when trying to add a new build definition. We are in TFS 2012. This team project also appeared not to have any build definitions. That was expected though because we had not yet used the TFS builds on this team project.
The problem was caused by someone with admin rights setting the "View build definition" and the "View Builds" access rights to Deny for everyone.
By just setting that back to allow on the TFS group, we suddenly could see the build definitions and also were able to select build process templates.
It was really strange that it let us add new build process templates, but we couldn't select them.
Sooo...
I was finally able to get the templates loading by doing the following.
Unmapped the entire TFS project which had been mapped in a sub folder and not at the root.
Deleted files from disk completely
Remapped the TFS project, this time from the root TFS project level
Accepted the "get"
After doing this my build definitions loaded and worked. (Seems to be a mapping issue...bug...)
This may be an extream solution and I am still not sure what happened but it now works.

Visual Web Part with referenced DLL not checking GAC

I have a SharePoint project with a visual web part (WebPartA inherits from OtherWebPartC) - the web part references two DLL's, (ClassLibraryB and OtherWebPartC), and they are included in the package, set to be deployed to GAC.
When I deploy the project, the DLL's are successfully deployed to GAC, and the web part successfully shows up in the gallery in SharePoint.
However, when I try to add the visual web part (WebPartA) to a page, the page breaks - I enabled error display and stack trace - it says it can't find ClassLibraryB.dll. I used fuslogvw and procmon to determine that it was trying to load the DLL from typical locations (Virtual directory/bin, temporary asp.net folders), even though the DLL was not in these locations (but as I said, it was successfully deployed to GAC).
So I manually added ClassLibraryB.dll and OtherWebPart.dll to virtual directory/bin, and it worked successfully.
How do I get SharePoint to see the ClassLibraryB.dll and OtherWebPart.dll in the GAC? Or do I have to manually deploy the DLL to the site's Virtual Directory/bin?
Try to:
Change the WebPart/assemblies deployment target to "WebApplication" (instead of the GAC);
Retract the Solution and remove corresponding assemblies from the GAC;
Re-build and re-deploy the Solution together with the assemblies to the SharePoint Bin folder (the selected "WebApplication" deployment target).
Are all the necessary assemblies copied to the Bin folder? Does the Solution work in this case?
Just a heads up to all of you digging through these ancient questions...
I stumbled upon this issue today, so i decided to leave a comment in order to claridy things.
Most of the info can be taken from this great article by Waldek Mastykarz
Using the Project you would like to package the Controls project including the SafeControls entries.
Double click on the Package project item and the Package Designer will open.
In the Package Designer you click the Advanced button. In the Advanced view you click the Add button and choose the Add Assembly from Project Output (the options are different in VS17 but they are similar)… menu option.
From the Source Project dropdown list you choose your other Project.
Then in the Safe Controls section, you click the Click here to add a new item button to add a new Safe Controls entry.
Use the $SharePoint.Project.AssemblyFullName$ token so that you can specify that you want to include the fully qualified name of your assembly.

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.

Speeding up VS2010 "SharePoint" cycle times for Web Part development

I am starting work on a SharePoint 2010 Project and using the Visual Studio 2010 Built-In Magical Extension to do so. However, the turn-about cycle to re-deploy the solution is terribly long (build, package, retract, deploy, then restart, etc.) The only changes during this time have been to the individual Web Parts.
In the past I have used WSP Builder and for minor updates on the dev box just using the Copy-to-GAC/Copy-to-Hive features which has a much shorter turn-about to see changes to a Web Part. I was wondering if there was a similar (or alternative) method to get a similar quick turn-about in VS2010? The Mapped Folders address say, a changing view, but it's the Web Parts that interest me most now.
Please, if you are going to say "but you should always re-deploy", please do so only as a suggestion with other [useful] advice -- the testing servers get a full re-deploy. This is simply about helping me reduce the development cycle times.
Copy to 14 / Copy to GAC functionality in Visual Studio 2010
If you deploy the BIN directory rather than the GAC then you can just do a copy on postbuild - no restart/deploy etc needed.

The type or namespace name 'Script' does not exist in the namespace 'System.Web'

I just deployed a website into IIS 7 (about which I am woefully ignorant), and upon trying to build the site, I receive this error. I did a little googleing and I saw an article that said I should put system.web.extensions.dll into the /bin. But, I also saw an article saying not to do that. I tried it anyway, but I just received a different error ('Resource cannot be found').
I am totally clueless as to what else to try
Can you use the "Publish" command in Visual Studio to publish directly to the site? If not, then use that command to publish to a similar site on your machine, then copy it to the customer site.
You should also look into the IIS Web Deployment Tool. It can copy an entire site, including IIS settings and any databases. It will be built into VS2010.
Go to control panel, then programs, turn windows features on or off, scroll down to Microsoft.net framework 3.5.1 expand, make sure both sub options are selected, this might help your issue.

Resources