How do you publish Class Libraries in Visual Studio? - c#

I have a MVC web application that I am developing in Visual Studio 2010. Along side my MVC project in my solution I also have 2 Class Library projects.
When I right click the MVC project in the solution explorer I get (among others) these options: Build Deployment Package, Publish..., and Package/Publish Settings.
These options are not available for the 2 Class Library projects, so prior to uploading any code I am currently putting everything in a deployment folder on my local machine using the Publish... option for the MVC project and just copy & pasting the other 2 projects in windows explorer.
I would very much like to use the Publish... option to deploy all 3 projects using FTP to our server.
I have discovered that if I change the Output Type of the 2 Class Library projects from Class Library to Console Application then I get the options to Publish... etc., but they aren't Console Applicationss so I don't really want to do this.
My question is, how can I , using Visual Studio 2010 publish Class Library projects using FTP?
UPDATE
Turns out I'm a numpty!
Because the MVC app references the 2 class libraries, the .dlls for them are already included in the bin folder for the MVC app and I didn't need to include the other projects when I publish.

You shouldn't need to separately publish the class library projects. When you publish the MVC project it will include any references the project has. As your MVC project references the 2 class library projects, when you publish it the class libraries will be included.

Might this one help
Change Solution Configuration to Release mode (by default it may be debug)
Click on Solution Explorer and Rebuld the library project.
This will release the dlls to [yourProjectFolder]\bin\Release

You need to customize how deployment process collects files you want to include in your deployment package.
Since your question is about Visual Studio 2010, I've found a Q&A here in StackOverflow that will guide you to the right direction in terms of including additional files (like your class library assemblies) as part of your deployment:
How do you include additional files using VS2010 web deployment packages?

Related

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# F# MVC 3 template deployment

I've recently started to explore Daniel Mohl "F# C# ASP.NET MVC3" template.
Can anyone share on how this type of project should be deployed to IIS7??
Thanks.
You deploy it pretty much the same way you'd deploy a "normal" ASP.NET MVC3 website, but there is one extra step: you need to make sure your deployed website will have access to FSharp.Core.dll.
If you have admin access to your server, you can simply install the F# redistributable; if not, you'll need to make sure FSharp.Core.dll is included when you publish or create a deployment package. The way I handled this in our website (written in MVC3 with C# + F#) was to manually add a reference to FSharp.Core to the website project, then right-clicked the reference, clicked properties, then set "Copy Local" to true. If you use any assemblies from the F# Powerpack, you'll need to do the same for them.
If I'm correct, the template consists of a C# Web Application that references F# Libraries (DLL) project which contains some of the functionality (namely, controllers and the model).
From the deployment point of view, this is just a normal C# Web Application with some referenced DLLs (created in F#) that will be copied to the bin directory, so the standard deployment procedure should for Web Applications should work just fine. I didn't try it myself now, but try:
Publish application to some folder (right click on C# web project in the solution explorer)
Copy that directory to your web server
Follow the usual IIS configuration steps (see for example here)

How do I get an Installer project to AutoUpdate like the app project publish wizard?

I have a .net solution with 2 projects:
The app
The installation project
The installer is set up in order to copy various additional assets into the project folder for use in the app during runtime (they cannot be embedded resources).
VS 2010 gives us the great capability to publish and app with the ability to use AutoUpdate for free, however I can't work out if I can use the same option when generating the installer through the installation project.
Does anyone know how?

Visual Studio Multi-Project Solution Options

I have a VS2003 solution with 21 ASP.NET 1.1 projects in it. My goal is to eventually migrate them to 2.0 and then 4.0. There are mainly internal admin apps for different departments.
I want to create a multi-project solution now in VS2010 and migrate/re-code these one at a time in ASP.NET 4.0 Web Forms in VS2010. There will be some artifacts common to all projects such as CSS, scripts and images. Could the use of Resources help with the common files and would it be possible to have a single master page for all projects?
What are the best options for creating a multi-project solution here?
From what I understand, your goal is to share resources like CSS, JS files across projects. One way to do it would be to use linked files in Visual Studio. We do it extensively in one of our solutions where we share many class files and signing keys acorss projects. Linking files basically involves putting the files in one project in the solution and then linking to them from other projects of the solution.
You have to be a little careful though during deployment of projects containing linked files as linking the file does not physically copy the file to the destination project. So even if your project has a css folder, the linked file shown under that folder in VS is not physically there in the directory structure on the disk . If you link classes, the dll for the project that has the linked class file will include the linked class, but for resource files like css, JS and common masterpage, they will not be copied over when you deploy. You can leverage build scripts or some simple batch files to handle those issues. This should solve your problem.
Why not just convert them directly to .NET 4.0?
Beware when you move them to .NET 2.0 that the default project type in Visual Studio 2005 changed from the type of project you're used to in VS2003 to "web site" projects. But with Visual Studio 2010, you've got the same Web Application Project you're accustomed to, so why not just go there directly?
Also, be aware that VS2010 can target .NET 2.0 applications, so there's really no reason to stop there.

Web Deployment Projects tool and Web application project

Q1 - As far as I know, Visual Studio doesn’t use aspnet_compiler.exe when compiling web application projects. And since Web Deployment Projects (WDP) tool is only used for manipulation the output created by aspnet_compiler.exe, I don’t understand how VS 2008 also has an option for using WDP with web application projects?!
Q2 - What is a stock project?
thanx
EDIT:
So I was right about the fact that Visual Studio doesn’t use aspnet_compiler.exe when compiling web application projects?
much appreciated
Web Application Projects are real projects - they really build, and produce a single assembly in the output (bin) folder, as well as any copies of referenced assemblies, etc. This is what a Web Deployment Project will package.
It's useful to keep in mind that Web Application Projects and Web Deployment Projects were the only way to create web projects until .NET 2.0 and Visual Studio 2005. In many cases, the better question will be "how do web site pseudo-projects ever work".
aspnet_compiler will compile .aspx/.ascx /.ashx etc.. files also (not just the code behinds). Visual studio does not. So if you want to precompile those files, use the Web Deployment projects and/or precompile manually.

Categories

Resources