Creating Sharepoint Web Part manifest file and dwp files - c#

Could anyone please help me to understand the following for creating Sharepoint web part please?
Manifest.xml
a. What is the purpose of this file?
b. What happens if we specify the wrong *.wpd file as below?
<DwpFiles>
<DwpFile FileName="WebPart1.dwp"/>
c. How do I create file in Visual Studio as I can't see any template
*.wpd
What is the purpose of this file?
How does this loads the proper dll?
How do we create using Visual studio, any template exists?
If we have webpart project and it references to the dll on another project. Does another project's dll has to be signed?
What are the best mechanisms to deploy the Sharepoint Web Parts?

I use the WspBuilder Visual Studio templates. They are a little quirky but it makes creating the structure of SharePoint projects very simple.
It uses the convention of following the SharePoint folder layout for specifying file locations in the project. Take a look - it might help you get moving. Note there are two versions - one for Visual Studio 2008 and a beta for Visual Studio 2010.
To try to answer your specific questions:
If the file can't be found, no action is taken. It's an error but not one that will bring down SharePoint.
I thought WPD was the old package style. Maybe I'm wrong on this?
Should be same as WSP - a package containing files to be deployed.
Whatever DLL is contained in the package is deployed to the GAC if it's signed.
Take a look at previously mentioned WSP Builder project.
Anything that's loaded by SharePoint and leads to rendered content needs to be signed and possibly added to the SafeControls entry in the web.config (deploying WSPs created from WSPBuilder does this automatically)
"stsadm -o addsolution" then use Central Admin to deploy or continue with "stsadm -o deploysolution"

Related

How to add a c# project as a resource in a class library c# project?

I have been working on a class library that generates c# projects from an existing c# project. Right now I have the template project in a specific folder on my machine but what I really need is to add that template project to the class library as a resource, so I could distribute the dll. Any suggestion will be very helpful.
If I'm understanding this correctly, and you're saying you've got a project that produces new C# projects (so .csproj and .cs files) and you want to add those as a resource, then I'd zip them up and add the zip as a resource.
Also have a look at the way new templates in Visual Studio are distributed. Within Visual Studios program files you'll find the built-in templates for example "C# Console Application" and "VB.NET WinForms" in the default path "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ProjectTemplates", however you can always download new ones from online and add them to Visual Studio, I'm guessing they could be zip or some form of packaged file.
There's information from Microsoft on how to create your own project templates and mentions about zipping them up https://learn.microsoft.com/en-us/visualstudio/ide/how-to-create-project-templates?view=vs-2017
There's also a guide here on how to create your own project templates https://www.ecanarys.com/Blogs/ArticleID/180/Create-custom-project-templates-in-Visual-Studio
Having a look around at distributed project templates, they mostly come from the Visual Studio Marketplace.
Video 18 of this series on the Microsoft Virtual Academy might help you.
Creating and Adding References to Assemblies
https://mva.microsoft.com/en-US/training-courses/c-fundamentals-for-absolute-beginners-16169?l=Ry6jz0QIC_5706218949

External ".xsd" file not included in release folder

I am a WPF newbie. I have my first WPF project which is developed with C# and VS 2013. At the root of the project, there is an external XML schema file with ".xsd" extension that is used in my project codes. Inside VS 2013 environment, I code and run the project without seeing any issue.
Recently, I have built that project for Release. However, the built folder does not include that external ".xsd" file. As a result, on running that project outside VS 2013 environment, I get an exception that tells it could not find out that ".xsd" file. Please tell me how I solve that issue. Thank you in advance.
Make sure the file is set to be copied to output folder on compilation via the property window.

Copy dependent projects needed files in Visual Studio

I have a sample project that is structured like the below image:
The WebApplication2 has depended on ClassLibrary1 at publishing time like this:
I want to copy some needed file in ClassLibrary1 project after publishing in a specific folder, for example in Plug-in/ClassLibrary1/
If you've looked at Orchard you'd see something like this.
Thanks.
In general (regardless of the type of the application) you could define custom actions during deployment, if you build a setup application. I think that limited edition of the InstallShield is the default solution for VS2013. There you could create some custom actions writing a script. Inside this script you could deploy the specific file. An alternative against the InstallShield is the WiX which you could use to build an MSI file using an XML.
Regarding web applications in particular, you could use the publish mechanism provided by the Visual Studio. This tutorial describes how you could configure it so that it would copy all project files. Then you could add the specific file as a project file and copy it each time you publish your website.
Hope I helped!

C# MVC Solution?

I have recently been tasked with updating a system done in C#. I am coming from a Kohana MVC web based development but have experience in C#.
Problem is: My solution is in some 'weird' namind convention. I would like to know what it could be and how to load the solution in VS 2010 Ultimate.
MySolution.BusinessLogic
MySolution.Common
MySolution.Contracts
MySolution.DataAccess
MySolution.DatabaseInstaller
MySolution.Entities
MySolution.Reporting
MySolution.UI
MySolution.UIControls
How does this work? Do I need to edit each folder separately or there is a way to load the whole solution in my developer IDE?
There should be a .sln solution file, probably in the project root folder. That is typically what you would open in Visual Studio. You can open individual project files (.csproj), but its much easier/better to work with a solution that contains all required projects.

Do I need the bin\debug\appName.vshost.exe and appName.vshost.manifest in my SVN code repository?

I am building an application which is based on a sample application,
written in C# on .NET 2, and is built on VS2008. This application is mostly a wrapper for a COM application.
However I compile it in .NET 3.5.
The sample application came with the following files in it's bin\debug:
appName.vshost.exe
appName.vshost.exe.manifest
I noticed that I can delete the files and VS re-builds vshost.exe, and the vshost.manifest file appears with modification date the same as the deleted file as if VS has copied in from somewhere.
My question is, should I put this files in my SVN code repository?
Those two files you list implement the Visual Studio "hosting process". It is a hosted version of the CLR, designed to improve the debugging experience. It takes care of some security issues, the most visible side-effect is that it redirects output written with Console.WriteLine() in a GUI app to the Output window.
These files are not part of your project and do not get deleted when you use Build + Clean. In fact, you cannot delete the .exe file, it is always running while you've got the project opened in Visual Studio. You can disable the hosting process feature with Project + Properties, Debug, scroll down, "Enable the Visual Studio Hosting process" tick. There's no compelling reason to do so.
There's no need to check these in, Visual Studio re-generates them when you check-in a project and load it in VS. In general, you never need to check anything in from the bin subdirectory, its content is always re-created by building your project.
Everything in the debug (or release) folder is generated. Everything that's generated shouldn't be checked in.
When in doubt, just make a fresh checkout to some other folder (or even machine), and try to build from that. If something is missing, this will find it.
I do not think you should. They are for VS use only.
Here are the files I ignore when creating C# projects. You really only want to store the source code in the repository and not the outputs. Similarly you probably do not want to store the user based information that goes along with VS solutions.
*.csproj.user
*.suo
bin (folder)
obj (folder)

Categories

Resources