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.
Related
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
I have two ASP.NET web projects and they share a lot of images and JavaScript files. I tried to create a shared project and linking it into both ASP.NET csproj files:
<Import Project="..\Shared\Shared.projitems" Label="Shared" />
But images inside the shared project are not found during debugging with IIS (Browsers "image not found" image is displayed). But Visual Studio recognized them and showing the image files in IntelliSense.
Any ideas?
You still can bundle resources with project and distribute it, but you nee to create nuget package.
create project
make nuget package
publish it to private feed (e.g. myget.org)
add reference to your feed from client projects
PS: Only content of folder 'Content' included in nuget package.
Apologies for the speculative answer, but hopefully this will help someone;
This is a struggle I'm currently facing too (which is concerning, as nearly two years have passed with barely a mention).
I have also had to manually add the Import line to each solution as it appears you have.
I think the issue is with the inbuilt debugger not knowing how to serve the files properly. If you deploy the compiled solution to any instance of IIS it appears to work correctly.
I am experimenting with the inbuilt debugger to see if I can get it to work, but am quite confident I'll have to use a local IIS instance moving forward.
Shared projects provide invaluable functionality, so it's a shame it's still not natively supported.
At the end of the day your images have to actually be somewhere, you can't just reference them from another project. It would work if this other project was hosted in IIS, given a domain, and you referenced the images from this domain. Perhaps call it your CDN.
When you reference a project to get at classes etc, the project is bundled up in to a dll and packaged along with the main project. Images, js files etc can't be bundled in to a dll, and will not be copied across to your project.
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?
So I have a solution which contains 4 projects, a "Core" Project which is the actual application (as a class library), and 3 wrapper projects, "Console", "WinForm" and "Service" which basically wraps a Facade class in the core class and contains various settings to handle different logging strategies for each different application (Console/Trace/File) and launch the application as either a Console, WinForms or Service, depending on how the customer wishes to deploy the application.
In the Core project I have 3 resource files which contain simple template views for the Nancy web framework. However the way Nancy looks for these views are on the current path. Since the files in the Core project aren't on the current path for any of the 3 other projects I need a simple way to access these files across projects.
Somewhat naively I thought this was where the concept of a "Solution" came in, to handle dependencies between projects. However by searching the Internet, much to my surprise, it appears there is no elegant way to do this. The only two solutions I've been able to find involves copying the files to a scratch/temporary or directory in the solution, and copying them to the respective needed directories later, as post build actions, and Adding an item manually using "Add as Link". Now while both these solutions technically work, the first leaves (possibly out-of-date) build artefacts lying about where they don't really belong (IMHO), and the second is tedious, time-consuming and prone to human error (because you can't just link to a directory).
Are these really my only two options, or is there some third, totally obvious way I've just missed because I'm new to Visual Studio?
You could use a custom IRootPathProvider in Nancy, if the only things you need are Nancy specific.
The other option is to link a folder - you can do this, but it involves manually hacking on the csproj file, there's a few questions on here about it, including this one:
Visual Studio Linked Files Directory Structure
Nuget is a package management system, that I have used to share artifacts between projects as dependencies. You could include libraries available via nuget.org or have your own nuget packages defined.
Teamcity has got good support for generating nuget packages with every build and can serve as a Nuget server.
Here is a reference to include files into a nuget package.
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.