VISUAL STUDIO.NET 2005. Exlude a file from project

E

Evian Spring

Hi,

If you right click one of the file within a project, and select from
the context menu "Exclude from project', visual studio will rename the
file to File_Name.File_Extension.exclude.


Example: image1.jpg becomes image1.jpg.exclude

I cannot believe Microsoft is actually doing that? Renaming the file?
The exluded file in my example is no longer a .jpg.


Am I missing something? This must be a bug but I just can't believe it
 
G

Gabriel Magaña

If you are talking about asp.net projects, then you are right... MS in its
eternal wisdon thought this was an ok thing to do (also you cannot exclude a
file from source control). There is hope, you can use Web Application
Projects ( http://go.microsoft.com/fwlink/?LinkId=57541 ) and get most of
the asp.net project brains back...
 
L

Lau Lei Cheong

Or you might just change it back later.

Actually I think "renaming when a file is taken out of a project" is a right
thing to do because otherwise some dxxb user might ask "why I still be able
to see the file after I exclude it from the project?" They just doing it in
a wrong way by changing the extension. The should have named it
"filename_excluded.ext", so you know what file has been excluded and you can
still view the file if you want.
 
G

Gabriel Magaña

Or you might just change it back later.

As long as the file remains in the directory of the web solution, the file
will be considered as included in the project. There is no such thing as a
web project as of vs2005 (with the exception of the Web Application Projects
extension), so there is no such thing as excluding the file and then
renaming back to the original name without including it again.
 
L

Lau Lei Cheong

No, there IS a difference.

For example, if you taken a file out of project, the "Copy Project" button
on the solution panel won't copy that file to the new location. Similar
things happen when you try to add the project to the source safe.

Although you can still view to file on the local web server, the excluded
file is no longer considered as part of the project when you attempt to do
any action targeted to "the project".
 
E

Evian Spring

For your coment:
Actually I think "renaming when a file is taken out of a project" is a
right

We have a "build.props" file for our NANT script.
This prop is different for every developer because they all have a
different working directory on their machine.
We do not want to include this file in the solution but it needs to be
at the root of the project.
Now if you rename it to .exclude, NANT will give you a compilation
error that builds.prop doesn't exists.

So it's not a good idea to rename....it's a catch 22

They should create a .exclude file that list all the files to be
excluded.......not renaming the actual file

Also you rename an image for an example.....How can a browser know a
..exclude is a jpg for example?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top