What files do you check-in to source countrol management system when working in an ASP.NET web application? - asp.net

We have a main web application that references several other projects. Do you check-in .csproj/.sln files into source control? If so, do you use these files for msbuild or do you just include *.cs to build your dll? Does ILMerge help in any way with performance?

You should aim to check in everything that is needed so that someone can take a fresh install of Visual Studio, do a checkout, double-click the .sln file, build and be on their way.
.sln and .csproj are a no-brainer, in my opinion: what happens if you add a new file to the project: everybody would have to manually add the file to their project files if you didn't commit the .csproj file.

ILMerge - no. Not for web applications. Not for the rest either.
Checkin? What about letting visual studio handle it. Now, in general - source control without all relevant files is garbage ;) So, it should include stuff like the project and solution.

Related

How to open a .publishproj file in Visual Studio 2017?

I just simple know that is a published project, but how to open that file as a project? Here is the story, I got a file from a contractor with all the project and the pages and I would like to check the code and run the project from Visual Studio 2017.
Sorry about my ignorance and thanks in advance.
You can't.
What you can do though is create an ASP.Net Project (e.g. .csproj) and then right-click on a folder or the root of that Project and select "Add Existing Web Site...". This adds your site to that solution.
Note that .publishproj projects ("Web Site" Projects, aka "Web Applications") are not really compiled/built. (Though they can be pre-compiled, but that's not the same thing).
Web Sites are "published" not "built". Note that publish profiles (.pubxml) files are stored in /App_Data/PublishProfiles folder and work very much the same as .csProj files. In fact MSBuild will recognize some of the same elements, such as <task> and <using>. You just have to manually add them.

Including links to external resources in Visual Studio 2010 Web project

I have a ASP.NET project which relies upon the FreeImage .NET wrapper. This is loaded using a reference to a external directory. The wrapper relies upon the FreeImage.dll being present to work (clearly).
How do I get Visual Studio to include a reference to the FreeImage dll. It's not a .NET assembly, i think it was built in something else (so I can't add it as a reference).
I don't really want to have a copy for this project as these files reside in a different SVN repository
Add a pre-build macro/script to copy the file across each time you build. There's no way to add a symbolic link into a visstudio afaik.
I am assuming the .dll was built using a .NET supported language like C#.
You can just right click over the site and select 'Add Reference'.
Browse to the .dll you are looking for and then click 'Ok' to add it.
It should add a .refresh file to your site and the dll. The .refresh file is what is checked into your source control letting the site know the relative location of the .dll to the site.

Visual Studio 2008 doesn't create *.refresh files for external DLL references... what am I missing?

I've got a question about something that's just been irritating me.
A colleague and I are building a support framework for our current client that we want to reference in other projects.
The DLL we want as a reference in our project would be an external reference. We're adding it by doing "Add Reference...", then browsing to the location of the .dll. What I want Visual Studio to do is only add the .xml, .pdb, and a .dll.refresh file, but instead it copies the actual .dll (and .xml and .pdb) into the bin.
When we rebuild the framework project, the other project that uses its .dll gets all out of whack until we drop and re-add the reference. Everything I've read online says that VS2008 is supposed to create the .dll.refresh files for you, but it never does.
Any ideas? Am I missing something or doing something wrong?
At this point I'm ready to add a pre-build event to simply copy the framework .dll into my bin, but the .refresh file seems like less of a hassle if it would just work.
Thanks.
UPDATE:
This SO post describes the actions that are supposed to be happening with the refresh files.
So it turns out that .refresh files are only created for Web Site projects, not Web Application projects.
The problem stems from Visual Studio having trouble deleting lock files for DLL references over 64kb, a problem supposedly fixed in VS 2010.
The current workaround is to close and reopen the solution or to unload and reload the project containing the references.
If the Projects are in the same Solution and you add a "Project Reference" that should solve your problem.
You can try to add references another way.
Add reference
Choose tab Browser (Not tab Project)
Choose *.dll that you need
I have tried it and been successful.
If you choose tab Project --> there are no *.dll.refresh added

What are the pitfalls of combining a web site project with a web application project in Visual Studio?

I have a web site project with a lot of files, it has become really slow to build. What I want to do is to create a web application project, and in Explorer add all the files to it, including the Bin folder. In Visual Studio I will not add these files (Show All Files will show them), only new files in one new folder that I am going to work on.
There are several assemblies in the original Bin folder that I need to reference in the web application project. Also, I will include the original web.config file.
So what way am I going to regret this in a few days?
You wont have support for all the old stuff when using the Visual Studio Publish feature (I assume you wouldn't anyways).
I also would assume you wont have access to what is in your App_Code from your new web application project.
I will add an answer myself.
A rebuild in Visual Studio will clean out the bin folder...

How do I compile an ASP.NET website into a single DLL file?

I have finally finished my web site. I published it, and I was surprised at the results. Although the App_Code compiled into a single DLL file, every page's code behind compiled into its own DLL file. How do I make it so that it is one DLL file?
Also, is it possible to compile everything (SubSonic, AJAX, etc.) into that same single DLL file?
You might prefer to use the web application project style for that.
You can use ILMerge to merge assemblies into one.
The way we do it is by adding a deployment project to our site:
http://msdn.microsoft.com/en-us/asp.net/aa336619.aspx
To accomplish this you will have to covert your project into a Web Application Project (Supported in Visual Studio 2005 SP1 and Visual Studio 2008).
The process of converting is not that hard, but you will need to move everything out of the app_code folder, as WAP (Web Application Projects) projects do not have code inside app_code.
Once you do this, everything inside your project is compiled into a single DLL file, any external assemblies are still contained in their own DLL files though, but there are options around that as well.
We use build scripts for our websites and run the aspnet_merge.exe from the command line. Here's the MSDN page: http://msdn.microsoft.com/en-us/library/bb397866.aspx

Resources