Where are project settings in a Visual Studio website actually stored? - asp.net

Working with a website (as opposed to a web application) in VS2010 so there is no csproj file. Right-clicking on the "Site" node in Solution Explorer and choosing "Property Pages" brings up a dialog with References, Build, Accessibility, Start Options, MSBuild Options and Silverlight Applications. You can make changes in these pages, close Visual Studio, turn off the computer, go home, spend quality time with your family, get a good night's sleep, return to work the next morning, turn your computer on, make a coffee, shoot the breeze about last night's episode of Fringe, log in, start up Visual Studio, open that website, and PRESTO! Most of those settings are still there.
This, despite the fact that there is no trace of those settings anywhere outside the hallowed pixels of the dialog box itself. Certainly not in any files in the website folder. Not in the solution file, for solution file there is none. A slightly desperate search of the Registry found nothing. Where are these settings being persisted? Are they stored in the cloud? Written into the gaps between bytes in the NTFS file system? Perhaps sent over TCP port 666 into the far-flung reaches of Hell itself, to be scratched with hot, rusty nails into the tortured flesh of the eternally-damned by impassive demons with dead, black eyes.
Any advice much appreciated.

There is an SLN file, just not where you expected it. For Web Site projects they are created in your default Projects location e.g. C:\Users\username\Documents\Visual Studio 2010\Projects\YourWebSite\YourWebSite.sln (or wherever you have your default Projects location set up in Tools/Options/Projects and Solutions).
Great aren't they these website projects? What an awesome idea they were.

I just ran into this and found none of the answers given here were correct for references. These were stored using .dll.refresh files - which we can add to source control.
Ref. question here: What is a dll.refresh file in ASP.Net?

They're stored in the solution file.
The references are stored in Web.config and the Bin\ folder.

The settings get saved to the the solution and project files (.sln, .csproj). If you open the file(s) in Notepad, you'll see the various settings listed in XML format. Some settings might be stored in the user settings file (.csproj.user), like certain debugging options, etc.
EDIT
In your case, since this is a web site project, disregard the parts of my answer referring to the project file. I'm going to leave it in there though, just in case it can be useful to someone else in the future.

Related

Configuration of publishing an ASP.NET web site

Forgive my ignorance, though I am new to this. I've search a lot but can't seem to come to a definite conclusion, so any information is appreciated.
So to the question: Is there a built-in configuration for web site publishing in MS Visual Studio called "Release"? The reason I'm asking is that some have told me it is, but I can only find the "Debug" configuration in Visual Studio.
So, if there's supposed to be a "Release" as well, how can I get it or can I manually add a new equivalent?
Go to the Solution Explorer (CTRL+W+S), then find your project. Right click on it and go to its properties. Find the Build tab. The top of the window will contain the active build configuration for your project. You can then change from debug (the default) to release.
By default, projects have two configurations: release and debug. You can make more, but first learn more about those two. The most important differences are explained in the question linked by Nacho in the comments. Good luck and happy codding.
edit: Web Site projects don't have the Release configuration available, but it makes no difference since they are not compiled. Web Application projects, on the other hand, do get compiled and have both configurations available.
It's been a long time (~4,5 years), but I think I might have used a Web Deployment Project for a Web Site Project once, for changing config files (replacing by copying from another directory) (xml node: WebConfigReplacementFiles)
I used Web Deployment Projects before web.config transforms where invented. (If you are interested in web.config transforms, check out my tutorial for VS 2010: http://www.tomot.de/en-us/article/5/asp.net/how-to-use-web.config-transforms-to-replace-appsettings-and-connectionstrings)
Another useful link might be: http://msdn.microsoft.com/en-us/library/377y0s6t(v=vs.100).aspx

Creating project from existing IIS/ASP.NET website, building stuff

So I'm left maintaining a proprietary codebase from a third-party vendor. The vendor is still sort of around, but support is limp. The site is ASP.NET.
I have made some changes but I am having a really hard time getting IIS to compile these changes in. The bin/ directory has what I believe is a precompiled dll for the core classes. I've changed these but it doesn't recompile. I have tried deleting the dll but then the app refuses to build saying that the Global.asax can't inherit the type anymore, so I don't really know how to rebuild with changes.
I spent all day Saturday setting up a build environment and trying to get a testing thing working. I have just been importing into VS2008 as a web site from the local IIS server. I got it to rebuild the app without changes, but it ignores changes I would place in it.
So I need to make a solution out of this website and/or directory structure so that I can do actual, big, full grown-up rebuilds and make changes to this codebase. Anyone know how I can go about this?
EDIT: A bit more elaboration. I've tried creating a blank project and just Add Existing File... on the whole website directory. This hasn't worked, it stops the import about 10% in.
Keep in mind there are two (actually, three) levels of 'builds' or compiles going on here.
1) The DLLs in the /bin directory should be pre-built, by visual studio or otherwise. The content of .ASPX, ASCX, ASHX, ASAX etc fiels are not included in those.
2) The ASPX, etc files I noted above are then compiled by IIS when the first request comes in (normally; there are ways to change that behavior). That is the source of the error with Global.asax you are seeing; With the DLL(s) gone, the class that Global.asax is supposed to inherit from does not exist.
3) Then there is the just-in-time compilation, which is not relevant for this discussion.
It sounds like you may be missing the source files for the project, or perhaps the web site is not getting properly set up as a project to compile that DLL
Try these links, I suppose this is what you are looking for.
http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2010/01/20/linking-files-in-visual-studio.aspx
http://support.microsoft.com/kb/306234
Not sure this question is really valid anymore. The source we were working with was rather different than it should have been. Not sure if someone got angry in the past and moved stuff around or what, but grabbing a new copy of the source fixed most of our issues. I am able to build now with an included csproj.
This doesn't really help many others with the same issue I suppose, but if you are getting weird build behavior like this, you might want to start with basics, like making sure that your source checkout is valid.
I am new in asp.net so I am not sure it is a professional way or not.
I have the project without .snl file. I just create a empty web site and then paste the files inside the folder where I created the project.
It worked for me.
I think pasting the files and folder directly by file manager will help you.

TortoiseSVN with ASP.net Web Projects - How to manage this?

We're a small team starting to use TortiseSVN to manage our web projects.
I was just wondering what is the best way to manage web projects into Subversion.
As you know a web solution consists of the .sln file as well as all the .aspx files.
Well we noticed when we right click the solution and we select "Add selected projects to subversion". It prompts me to tell it where to store the .sln file. So I give it some path like svn://serverName/CIS/MyWebSiteProject. Cool it just placed the .sln file...so I thought to myself how is it going to store the .aspx files as well.
Within a second I got a second prompt, I thought cool it is prompting me for the .aspx pages. So I tried giving it the path svn://serverName/CIS/MyWebSiteProject/ASPX_Files, but it comes back with an error stating I cannot place this folder within this path. I actually have to go outside of the folder MyWebSiteProject.
Not good cause now I have 2 folders one with the .sln folder and the other with all the .aspx pages and these folders are sitting on:
(sln file):
svn://serverName/CIS/MyWebSiteProject
(aspx files):
svn://serverName/cis/myWebSitePages
This really is not ideal cause I am sitting on the root of CIS with 2 folders for really one solution. Now when I try to check the project out I have to check both folders out.
What makes this even worse is when I do check them out I try to open the .sln file and I get an error that it cannot find the corresponding .aspx files. This seems like too much work, is there an easier way or a recommended way of using tortisesvn/subversion with asp.net web projects ?
While I am sure you have TortoiseSVN installed, it sounds like you are using Ahnk or some other VS SCC plugin to add from within VS.
I would suggest not using the plugin to initally add the solution to SVN, but to use TortoiseSVN in Windows Explorer for your initial check in. This will add your solution directory in its original state.
From that point on, you should be able to use the SCC plugin from within VS without trouble.
EDIT
Ok, after your commment I realize that I was not fully understanding the problem.
If you are dealing with a single project, after you create your solution and project, select the solution in Solution Explorer, go to 'file>save solution as' and save the solution inside the directory where your project file is.
Close the solution and go out to Explorer and use Tortoise to add the directory to SVN. If you have multiple projects/sites, just pick one to hold the solution.
Does that make sense? and from that point you should have no problems with ahnk
The key to successfully using Visual Studio with any source control is to put the solution file in the same path as the rest of the project files.
Usually, I will do something like the following:
\Project\Project.sln
\Project\MainWebSite\*.* <-- All web site files (including .??proj here).
\Project\Library\*.*
Then, I manually put \Project\*.* into source control.
Other options exist, as for my recent projects, I have been using:
\Project\SolutionFiles\Project.sln
\Project\MainWebSite\*.*
\Project\Library\*.*
Again, I manually put \Project\*.* into source control.
I generally find that it is better to set up the repositories for my solutions and projects from within Tortoise SVN. Then use whatever VS plugin that you care for to manage the commits of your pages etc. This gives you a little more control and allows you to get your setup correct from the start.

References failing to import to a VS 2005 (VB) ASP.NET Web Service Application Project

I have this VB ASP.NET Web Service Application project running VS 2005. I'm trying to add references. To do so I click on the "Properties" icon in the Solution Explorer window which presents me with a window to add/update/remove references. I click "Add", I select the reference I want and then "OK". Lo en behold, NOTHING! It simply won't add references (I tried adding several different ones). Specifically I'm trying to add the System.Configuration assembly.
I'm not sure why this is happening, but perhaps another clue to the puzzle is that I also see no "References" folder in the Solution Explorer nor can I view it by clicking the "Show All Files" icon since it's greyed out.
Maybe I'm missing something obvious, I'd be grateful if someone could shed some light on this problem.
P.S: The project is source-controlled using VSS, although it had no effect when I checked out the entired project.
*Progress Updates:
Modified project folder & file permissions, no effect.
Scanned through paths in project source files, they are pointing to correct locations (not that I can see why that would have an effect).
Tried to create a new project and adding the existing project files, this fails horribly.
Stared blankly at the screen for minutes at a time. Forcibly willing it to work has no effect.
After a lot of frustration, cupous amounts of caffiene and nictotine, I managed to find the problem. When you "Get Latest Version" on a folder, be sure to "Set Working Folder" on the root of your VSS database. If you don't do that, the original project code may be duplicated under the main solution file like this:
C:\Projects\MyAwesomeProject
C:\Projects\MyAwesomeProject\MyAwesomeProject
From that you should be able to gather that now you have duplicate code and duplicate configuration files that both gets treated as the main app.config/web.config. Changes made in one is not reflected in the other. When you try to add references it technically adds it to one, but not to the other, also causing VSS not to "show" the references in the solutions property pages.
I second-guessed myself on this one, since I took the project over from a previous developer that didn't set the working folder when he did "Get Latest Version" and check all of the duplicate files created as a result back into VSS. My question was basically "Which one is the right one?".
Deleting "C:\Projects\MyAwesomeProject\MyAwesomeProject\" = Build Successfull.
Happy programming!

Excluding a folder from source control in an ASP.NET website?

Right now I'm working with an ASP.NET website that automatically generates images and stores them in a temporary folder. When working on my local system these go going into a temporary folder that gets picked up by Visual Source Safe which then wants to check them in. As such, I am wondering if there is a way to just exclude that particular folder from source control?
I've done a bit of reading and found that there are ways to do this for individual files, but I haven't found anything yet about an entire folder.
I think you've found one of the main reasons MS went back to projects in VS2008 and in MVC.
It's been a long time since I've used VSS (mainly because it's really out of date now), but most source providers let you exclude files and folders as a setting of the provider, rather than the project under control.
If you can switch to a Web Project rather than a WebSite then do so, otherwise I'd look at updating your source control provider, as this sort of exclusion is easy with Vault, CSV, SVN, Git, VSTS and so on (to name but a few).
Are you using ASP.NET Website or ASP.NET Web Project? The difference is significant enough to solve or promote this problem.
Websites, love to scan the file system and auto checkin.
Projects, checkin only what you tell them to.
Also Visual Source Safe is pretty out dated, most recent source control systems allow you to do what you are asking. SVN and TFS 2008 SP1 do from my experience.
You can also try to right click and pick "Exclude" on the folder, but in the case of a Website I believe this renames the folder.
I'm not sure if this is an option for you, but if you exclude your temporary folder from VSS (delete the folder inside VSS using the VSS UI), the files that go into it should not get "picked up" again.
If you perform operations on a parent project of the temporary folder, you may try cloaking the folder.
http://msdn.microsoft.com/en-us/library/x2398bf5(VS.80).aspx
I would suggest emptying/deleting your folder from your website. Have your website on startup create/verify the folder, and on shutdown to clean it up and remove anything in it. This can be DEBUG code only (wrap in #if DEBUG) if so needed. Also add a build script to your project that does this every time it is built also.
Could you just make your application write to a temporary folder that is outside of your website?
e.g. in C:\tempfiles
VSS shouldn't be able to pick it up then.

Resources