I have developed and deploy a webpart into SP2010. I would like make some changes to the webpart and show it to my clients but I need to keep the original webpart in case they dont like the new changes. So I would like to have 2 versions of my webpart on the server but use only one Visual Studio project.
In Visual Studio I made the following changes :
1. The solution name ( MyWebPart to MyWebPartNew)
2. The assembly name (from the Properties window of the project)
3. The MyWebPart.webpart file to MyWebPartNew.webpart
+
4. Element.xml
The 'new' webpart is successfully deployed on the server BUT it overwrote my old webpart :( . I looked into the debug output folder and see the dll and pdb file has changed to the new name but not the wsp file.
Have I missed something ? How do I add the new webpart without overwrite the old one from the same project ?
Thanks
The easieast way would probably be to add a new webpart next to your old one. In that case you can simply remove the old one if they prefer the new one.
But in your case, I think your problem is that you didn't change your wsp name (double click "package" in Visual studio) and that you didn't change you solution id (guid in properties window after you click package). What happens when you deploy (from Visual Studio) is that is first retract your old solution and then adds the new one resulting in that your old webpart is malfunctioning.
But as I wrote, I would suggest you instead create a new, identical webpart with your changes in it, and deploy it next to you old webpart.
Related
I have a straightorward console application that I build using code::blocks. A client has requested a microsoft visual studio project to build it. So I downloaded and installed visual studio and created a project. Now I am trying to add my source files to the project.
Various online help pages say "Select project; select menu item "Add Existing Item" ( e.g. https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/9f4t9t92(v=vs.100). I cannot find "add existing item"! Add new item simply adds an empty file.
I tried dragging files from windows explorer onto the project, but this REMOVES the file from where it belongs - NOT what I want to happen.
Surely there must be a way to do this! Even without using alternative IDEs, different projects frequently must share common source code, so source files from one project need to be added to another.
The answer is to use File | New | Project from Existing code rather than simple 'New Project' when creating the project
How do I change the Product Code for my application within Visual Studio 2010 ?
I've built a new application by reusing an existing workspace by renaming the folders and namespace. Now when I build an msi file file, it asks me to uninstall the existing app on the server (which is a completely separate app) and I'm unable to proceed..
If you start a new project you're supposed to start a new project from scratch otherwise there are things that get left behind. Apart from the ProductCode you may have the same UpgradeCode as the previous product, and it's probably not a good idea to have two separate products installed with the same UpgradeCode.
The easiest way to change the ProductCode in a Visual Studio setup is to go the Properties Window (not Properties) of the project that shows Manufacturer etc, and ProductCode is there too. Just select it and choose "New Code".
You can create a new Guid product code in the Visual Studio 2010 using the below tool. And replace the new Guid to the ProductCode field in your project.
https://weblogs.asp.net/jevgeni/adding-guid-generator-guidgen-to-visual-studio-2010
Visual Studio seems to consist of a single solution file (*.sln) along with one or more project files (a C# project would have the *.csproj extension).
I have been playing around with a console application that parses existing directory entries to create solution files with the associated project files.
It works, but every time I run into a new project here at work I find myself spending a week or more debugging my console project so that it can churn out a solution for that particular work project.
Is there something out there already that can create a VS solution out of an existing file structure?
As you can tell from my screen capture below, these projects are nested very deep, so it would take a very long time to do this with the apps folder below with the "by mouse" technique in the Visual Studio IDE.
I created the custom console application that is posted in this post:
https://stackoverflow.com/a/22153536/153923
I invite others to contribute how they approached this solution, though.
So, I found out today that this feature already exists in Visual Studio.
Link 1: How to: Create a Project from Existing Code Files
Link 2: How to: Create a Project from Existing Code Files
Basically, though, it says this (just in case the MSDN links get changed or deleted):
You can create a Visual Studio project from an existing app—for example, an app that you obtained from an online source. Project and solution files are created on your computer and the other relevant files are added. A project can be created from Visual C++, Visual Basic, or Visual C# code files.
Security note Security Note
We recommend that you determine the trustworthiness of existing code files before you import them into Visual Studio, because Visual Studio will execute some of the code in a fully trusted process when you open the newly created project.
To create a project from existing code files
On the menu bar, choose File, New, Project From Existing Code.
The Create New Project from Existing Code Files wizard opens.
Use the wizard to specify the details of the existing code files that will be added to the project and the application that will be created when you build the project.
Another good answer was given by cbp in Visual Studio: Create a web application from existing code:
--
OK I figured it out. It's weird, but the following steps will work:
Open fresh copy of Visual Studio
File->New Project, select Web Application
Use the following settings:
Name: Website (this is the name of the existing folder with the website files in it)
Location: C:\Temp\ (anywhere will do for now)
Solution Name: TheProject (name of the existing project's root folder)
Check "Create directory for solution"
Delete the auto-created Default, Global and Web.config files
Save All and close Visual Studio
In Windows Explorer, copy the new folder on top of the existing folder so that the files are merged.
Double click on the sln file to open Visual Studio again.
Select "Show all files" (at the top of Solution Explorer)
Right click on any files or folders you want to add and select Include in Project.
Great idea!
I am working on a PHP project, so I am not using Visual Studio, however the company I work at is mostly a .NET shop so we use Team Foundation Server for version control. I can use VS to manually add files to the TFS project but that is a bit cumbersome when I am adding a bunch of new files, I pretty much have to add the file right after I create it so I don't forget.
What I want to know is if there is a way to have TFS pick up a new file added to a directory that is under source control for a project. For instance if I added a few PHP files to the source controlled html directory I would like to be able to just go to check in pending changes in TFS and have the newly added files included in the list. Does anyone know if this is possible? Thanks much!
There's no way to have this happen automatically with TFS 2010 or below. I've seen a video that says they'll be adding this feature for the next release.
In the meantime, you can use Source Control Explorer, then right-click a folder in the left pane and choose "Add Items to Folder". Follow the dialog and you'll be able to add any of the items that haven't previously been added.
I followed the steps on MSDN for creating a template. I created a new project in VS2010 and then used the File->Export Template... option to create my template. I went through the wizard and everything seemed to make sense. I left the default Output location alone (it was:
...Documents\Visual Studio 2010\My Exported Templates\MyProject.zip)
and I left the Automatically import the template into Visual Studio checked. I can see the exported zip file (and I tried moving a copy to the:
Documents\Visual Studio 2010\Templates\ProjectTemplates\Visual C#
folder. But when I start up a new instance of VS2010 and use File->New Project I don't see my template. I was expecting that in addition to RecentTemplates/ Installed Templates/ Online Templates I might get a new category for User Templates. Failing that I thought it might be under Installed Templates but there is nothing new there. Where is my template supposed to appear? Did I miss a step?
Duh, It was working I just didn't know where to look. I would bring up the new project template and search through all the leaf nodes. Turns out I had to click on the Visual C# root in the tree view (it appears to not be in any of the leafs). This always trips me up in tree views, I never expect the root to have options, let alone be the only place that has an option.
I think you should restart( quit and run again) your visual studio!