Composite C1 is delivered as a Website Project for Visual Studio 2010. I want to use a Web Application Project instead when I develop. So I created a Web Application Project and copied all the files from the Composite Website folder in the zipfile to my project. After I have done this I see that every class file I create in the App_Code folder dosent have intellisense nor the color notations in the classfile. How can I fix this problem?
* UPDATE, Problem Solved *
All I had to do was to move my classes from my App_Code folder to another (random) folder in my solution.
All I had to do was to move my classes from my App_Code folder to another (random) folder in my solution.
Related
I have website built on MVC4 in visual studio 2019 and for publish profile I usually used right click and select publish site. which is working great but i want it should be part of my csproj. As when as i build my web.sln it should create a publish folder.
Right now it is only creating bin folder having dll and dependency but it should have all folder having content and web.config and razor file.
I tried to search how I can make this as part of csproj file but could not figure it out? Please help me.
According to what I can find here it is not possible to add a SolutionFolder inside a SolutionFolder:
Visual Studio 2005 and higher allows you to add folders to the
solution (which are called solution folders), not only to add folders
to a project (something that was already allowed by Visual Studio .NET
2002). Solution folders can be nested, and a folder that belongs to
the solution (a root solution folder) is modeled as an EnvDTE.Project,
so to add a child solution folder to a root solution folder you have
to use the EnvDTE.Project.ProjectItems.AddFolder method. However, this
method causes a NotImplementedException.
I am trying to do the same thing now - 7 years after the writing of that blogpost, in Visual Studio 2017 version 15.8.4 - and unfortunately, I get the same NotImplementedException when trying this.
Is there any other possible way of creating such a sub-solution-folder from a Visual Studio Extension?
Visual Studio Extensions - How to create a SolutionFolder inside a SolutionFolder?
Here is a extension about how to create a Solution Folder from a selected folder also including the files in that selected folder: Folder To Solution Folder.
Remove the hassle of adding several files to solution folder. Just use
the context menu for the solution and just below the option of
creating a new solution folder you now find 'Add Folder as Solution
Folder'. This will create a solution folder with the same name as you
selected and add the items inside of that folder to the solution
folder. This will not move the files on disk.
You can check the source code from: https://github.com/ceciliasharp/Extension.FolderToSolutionFolder
Hope this helps.
So, it appears the trick is to get the SolutionFolder in which you want to create the subfolder as a EnvDTE.Project, then get its Object property and cast that as a SolutionFolder.
That will give you an object on which you can call "AddSolutionFolder" with a foldername.
using EnvDTE;
using EnvDTE80;
Solution2 solution = (Solution2)dte.Solution;
// Adds a SolutionFolder (in the standard way) underneath the Solution and returns
// a Project. That Project object is the same as what you would get when going
// over your solution with solution.Projects and getting the folder you need
Project solutionFolderAsProject = solution.AddSolutionFolder(folder.Name);
SolutionFolder solutionFolderAsSolutionFolder = (SolutionFolder)solutionFolderAsProject.Object;
Project subSolutionFolder = solutionFolderAsSolutionFolder.AddSolutionFolder(item.Name);
Visual Studio seems to consist of a single solution file (*.sln) along with one or more project files (a C# project would have the *.csproj extension).
I have been playing around with a console application that parses existing directory entries to create solution files with the associated project files.
It works, but every time I run into a new project here at work I find myself spending a week or more debugging my console project so that it can churn out a solution for that particular work project.
Is there something out there already that can create a VS solution out of an existing file structure?
As you can tell from my screen capture below, these projects are nested very deep, so it would take a very long time to do this with the apps folder below with the "by mouse" technique in the Visual Studio IDE.
I created the custom console application that is posted in this post:
https://stackoverflow.com/a/22153536/153923
I invite others to contribute how they approached this solution, though.
So, I found out today that this feature already exists in Visual Studio.
Link 1: How to: Create a Project from Existing Code Files
Link 2: How to: Create a Project from Existing Code Files
Basically, though, it says this (just in case the MSDN links get changed or deleted):
You can create a Visual Studio project from an existing app—for example, an app that you obtained from an online source. Project and solution files are created on your computer and the other relevant files are added. A project can be created from Visual C++, Visual Basic, or Visual C# code files.
Security note Security Note
We recommend that you determine the trustworthiness of existing code files before you import them into Visual Studio, because Visual Studio will execute some of the code in a fully trusted process when you open the newly created project.
To create a project from existing code files
On the menu bar, choose File, New, Project From Existing Code.
The Create New Project from Existing Code Files wizard opens.
Use the wizard to specify the details of the existing code files that will be added to the project and the application that will be created when you build the project.
Another good answer was given by cbp in Visual Studio: Create a web application from existing code:
--
OK I figured it out. It's weird, but the following steps will work:
Open fresh copy of Visual Studio
File->New Project, select Web Application
Use the following settings:
Name: Website (this is the name of the existing folder with the website files in it)
Location: C:\Temp\ (anywhere will do for now)
Solution Name: TheProject (name of the existing project's root folder)
Check "Create directory for solution"
Delete the auto-created Default, Global and Web.config files
Save All and close Visual Studio
In Windows Explorer, copy the new folder on top of the existing folder so that the files are merged.
Double click on the sln file to open Visual Studio again.
Select "Show all files" (at the top of Solution Explorer)
Right click on any files or folders you want to add and select Include in Project.
Great idea!
How can i take an existing website (files and folders) that exist on my hard drive into a VS2012 project?
I am trying to highlight the files/ folders in explorer and drag/ drop into the project but that doesn't work in 2012.
I am trying to get the existing site imported into a blank website project and don't want all the extra files VS adds as part of lets say a win forms project.
In VS2012 Solution Explorer:
Right Click on your Solution Name > Add > Existing Website
You can select your existing website files here.
Hope it solves your query.
I've created a Visual Studio 2010 ASP.NET MVC Project Template as a VSIX package that I'd like to upload to the Visual Studio Gallery, but every time I try it tells me the path is too long...
Locally, it installs and works without issue...
The structure of the project (zipped as t.zip to try and reduce the length) is a standard MVC structured project, the only caveat is that it needs (well, doesn't need to but makes sense for it be there) installs to the Web sub-folder under the C# language, so the path inside the VSIX package is ProjectTemplate\CSharp\Web.
Is there a way around this limitation, or am I simply doing something wrong?
There is a check when you upload to the VS Gallery to see if the path length might end up being too long when installed on the users machine. This check includes not only the files directly in your VSIX, but also the files embedded inside the zip file. (This is because templates are unzipped on disk before they are used for instantiating a new project.)
Unfortunately, I think your only option is to shorten-up the paths of the files in the template itself.