How to create SharePoint web part from Class Library project? - sharepoint

I got a SharePoint web part proejct wth the output type set to Class Library to deploy on SharePoint farm. It all bulds great no errors.
However, The project doesn't package as DWP because of the output type - In the Build menu VS2010 doesn't show Package item.
What is the way to create DWP package from this type of a project in Visual Studio 2010?
Should I create a new web part project from an empty SharePoint web part project and add the the cs files to complile and new project? or there are some good ways?
Thanks,
Val

Yes, you can create a SharePoint Web Part project in Visual Studio and then add your class library project to it. There will be an option to package your web part project into a wsp file and deploy it. Make sure you add your class library to the GAC though in the web part project.

Related

Visual Studio 2022 - File Add New Item CSS, HTML, JS missing

I have 2019 Web Project I'm trying to open in Visual Studio 2022 and it's missing a lot of common file types, HTML, CSS, JS and Text to name a few. If I open the project by going to File -> Open -> Folder the expected file types are available but the Azure Dev Ops integration doesn't work.
Any pointers on how to get this working. Someone recommended building the New Item file templates but that seems like a chore for such a simple set of file types.
Update: If I change the Solution Explorer view to Folder View then I can add the files I expect, but with Folder View I can't check-in or publish. I will need to toggle between Solution View & Folder View complete those actions. To clarify further, how/what populates the Solution Explorer(Solution View) -> Add New Item menu?
In Visual Studio 2022, the .NET Framework project and item templates are now optional components. At the time of installing VS 2022, you need to manually check this option on the ASP.NET and web development section. If somehow this got missed during the installation, you can enable it by following the below steps:-
Open Visual Studio Installer
Click on Modify
Expand Asp.Net and web development
Check .Net Framework project and item templates
Screenshot:-
The above steps will bring back the missing HTML, CSS, JS, and other templates
One of the workaround you can follow to resolve the above issue,
We are trying the same with console application and trying to add html and can able to get it as well using VS-2022 with version 17.2.6.
Make sure that you have open the correct project in your environment.
HERE ARE THE SCREENSHOT FOR REFERENCE:-
Alternatively if you want to add an item template to the Add New Item dialog box in visual studio please refer this MICROSOFT DOCUMENTATION| How to Create item templates
For more information please refer the below links:-
SIMILAR SO THREAD|Can't find ADO.net Entity Data Model template in VS2017 .
This is a pain. It happened to me with the last upgrade. To fix it, open the installer, select "Web and Cloud", then "ASP.NET and web development." Check all the boxes through Intellicode, and then check ".Net Framework project and item templates".

Using Visual Studio 2015 for existing node-js client-side web projects

I have a team working on a client-side node.js application. The sources are stored in a source control. I'd like to modify and debug this application in Visual Studio 2015. They use other IDEs, and I would not like to add additional VS-specific files such as .sln to source control.
I'm able to clone the repository, create a separate empty solution and add the repository as an "Existing Web Site". However, Visual Studio do not recognize package.json, and do not install dependencies as it would for MVC6 projects. Consequently gruntfile.js would not work either.
Is there any way to make Visual Studio see and process package.json, or I'm on a wrong track here?
Instead of using the "Existing Web Site" option, create a new solution and add items to it. Web Site Projects types are a different, legacy project type.

Importing one project (or some of it's classes) into another project in Visual Studio 2012

I added a new project in my VS solution already containing 3 projects. However, I couldn't import this project into the the files of existing project with the help of "using" keyword.
PS: The newly added project is a MVC web application and the older projects are C# projects to develop windows form application. My ultimate goal is to pass data from my MVC web application to the classes of existing projects.
I figured it out. I had to reference the projects.
Right Click -> add reference. Hope this helps to some having same issue.

How to add TypeScript to Visual Studio 2012 ASP.net web forms web-site?

I'm trying to add TypeScript to an existing:
web-site (not a web-application)
web forms (not MVC)
Visual Studio 2012
I think, at a fundamental level, the problem is that an ASP.net web-site has no project. This means there is no ability to define "Build options". An ASP.net web-site cannot declare that a *.ts file should have a build action of Compile, since without a project file there are no build actions.
Obviously i'm not going to convert to a web-application (due to the unresolvable disadvantages of a web-applications).
Having said that, how do i add TypeScript to an:
ASP.net
web-site
web-forms
Visual Studio 2012
solution?
Bonus Reading
Using TypeScript in an existing Visual Studio Web Site project (web-application)
How do I add typescript to an existing Asp.Net MVC project? (mvc web-application)
typescript for web forms (web-application)
Converting existing JavaScript code to TypeScript in Visual Studio (web-application)
You can simply add typescript files to the project and manage the compilation externally (outside of visual studio) using something like grunt-ts https://github.com/basarat/grunt-ts (disclaimer : I am one of the authors)
You can add a *.ts file to the web folder, then run the ts compiler from the command prompt.
Or create a separate web app with just the TS file. Then in the build properties, add a command to copy it to the desired location.

Develop Visual Web Part Without Installing Sharepoint

I want to know if it is possible to develop web parts without installing sharepoint?
I choose Visual Web Part then I get sharepoint not installed error.
You can't develop it without SharePoint on same machine.
The answer is "Yes", you can. But if you do that then you loose all features of Visual Studio for development for SharePoint. You will need to create proper visual web part project artifact structure manually which could be tricky. Also you will have to create wsp package manually or using tools like wsp builder. Then you can copy this wsp package to sharepoint server and deploy it.

Resources