Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a Shared Code project (.shproj)

How I add a .shproj to my Visual Studio solution and reference it from other projects?

Showing the Shared Project

I know that Visual Studio 2013 Update 2 added a new project type for "Shared Code." This type of project does not produce a dll itself. Instead the files from the Shared project are included as source files in the assemblies that reference it.

I know it exists because I have seen one in an open source project. However, looking through the project templates in Visual Studio I could not find a "Shared" project type.

like image 215
vossad01 Avatar asked Jun 18 '14 20:06

vossad01


People also ask

How do I create a shared project?

Creating a Shared Project To create a new Shared Project, navigate to File > New > Project. In Visual Studio 2019, enter shared in the search box on the Create a new project page. Select the Shared Project template and then select Next. Enter a name for the project, and then select Create.

Can you share a Visual Studio project?

Welcome to Visual Studio Live Share! Live Share lets you collaboratively edit and debug with others in real time, regardless of what programming languages you're using or app types you're building. Live Share lets you instantly and securely share your current project.

What is shared items project in Visual Studio?

You can think of “shared items” projects as another way of organizing your files in case you have many projects building the same source file (e.g. in case you build multiple applications that share the same source and you're not already using static libraries for this purpose).


1 Answers

Edit: According to the Visual Studio 2015 Preview documentation, VS 2015 adds templates for shared projects and a UI for managing the references, so the below should no longer be necessary after upgrading.

There does not seem to be a way to create one directly. It appears currently that Shared Code projects are automatically created when you create a Universal App project as shown in this introduction to creating a Universal App.

Therefore, to create one in your solution: Add a new project type "Blank App (Universal App)." Delete the Windows 8 and Windows Phone projects it created leaving only the Shared project.

like image 135
vossad01 Avatar answered Sep 18 '22 14:09

vossad01