By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,364 Members | 1,687 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,364 IT Pros & Developers. It's quick & easy.

Excluding a file from VS.Net Project

P: n/a
Hi,

Curiosity - when you right-click on a file in the VS.Net Solution Explorer
and select "Exclude from Project", it continues to be shown in the Solution
Explorer as a sort of ghostly outline (as long as you have selected "Show
All Files"). Yet if you open up the project file (which is just XML) in a
text editor, the reference to the now-excluded file has gone.

Question: how is VS.Net still able to show the file in Solution Explorer
when all references to it have been deleted from the project file?

TIA,

JON

Jul 21 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
Jon Maz wrote:
Curiosity - when you right-click on a file in the VS.Net Solution Explorer
and select "Exclude from Project", it continues to be shown in the Solution
Explorer as a sort of ghostly outline (as long as you have selected "Show
All Files"). Yet if you open up the project file (which is just XML) in a
text editor, the reference to the now-excluded file has gone.

Question: how is VS.Net still able to show the file in Solution Explorer
when all references to it have been deleted from the project file?


Jon, I don't know for certain, but I imagine it just shows *all* files
in the appropriate directory when you select to "Show All Files," giving
the ghostly outline to those that are not included in the project.
That's how it still knows it's there - it's a file in the directory.

That is, excluding a file from a project doesn't delete it from the file
system, it just unassociates it with the project.

hth

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
Jul 21 '05 #2

P: n/a
Hi Scott,

Plausible, but I think the mystery continues...

Try this:

1 Create a project
2 Show All Files
3 Add a new file "temp.txt" via Solution Explorer in the project root folder
4 Exclude "temp.txt" from the project
5 Close the project down, saving everything
6 Navigate to the root folder and delete "temp.txt" via windows explorer
7 Open the project again
8 The file "temp.txt" is *still* there in Solution Explorer, all ghostly and
malevolent.

!!!!!!!???????????!!!!!!!!!!!!

JON

Jul 21 '05 #3

P: n/a
I am not able to repro. I tried what you said, but in Step 7, when I
reopen the Solution and click "Show ALl Files," test.txt is not there.
I am using VS.NET 2003.

Jon Maz wrote:
Hi Scott,

Plausible, but I think the mystery continues...

Try this:

1 Create a project
2 Show All Files
3 Add a new file "temp.txt" via Solution Explorer in the project root folder
4 Exclude "temp.txt" from the project
5 Close the project down, saving everything
6 Navigate to the root folder and delete "temp.txt" via windows explorer
7 Open the project again
8 The file "temp.txt" is *still* there in Solution Explorer, all ghostly and
malevolent.

!!!!!!!???????????!!!!!!!!!!!!

JON

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
Jul 21 '05 #4

P: n/a
Jon, you have too much time on your hands...

--
:-),
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Jon Maz" <jo****@surfeuNOSPAM.de> wrote in message
news:em**************@TK2MSFTNGP09.phx.gbl...
Hi Scott,

Plausible, but I think the mystery continues...

Try this:

1 Create a project
2 Show All Files
3 Add a new file "temp.txt" via Solution Explorer in the project root folder 4 Exclude "temp.txt" from the project
5 Close the project down, saving everything
6 Navigate to the root folder and delete "temp.txt" via windows explorer
7 Open the project again
8 The file "temp.txt" is *still* there in Solution Explorer, all ghostly and malevolent.

!!!!!!!???????????!!!!!!!!!!!!

JON

Jul 21 '05 #5

P: n/a
> 8 The file "temp.txt" is *still* there in Solution Explorer, all ghostly
and
malevolent.

I've done this with my messing around with adding files to the project. I
had several nested directories I wanted to make part of the project. So I
added them like I would do in JBuilder and then refreshed the proj but there
weren't added. :< I could drag'n'drop them into VS, but it would only
recreate the folders, not add the underneath files. :< Kind of makes me
wonder the value of the refresh button?
Jul 21 '05 #6

P: n/a
Hi All,

SCOTT
1 Am using VS2002
2 Genius! When I reach the puzzling Step 8, if I click "Show All Files"
*twice*, the offending file has disappeared as it should! All is now right
in the world, and we are at the cusp of a new dawn of peace and happiness.

KEVIN
1 Why do people keep saying that to me?
2 Amazingly, there is a bit more to all this than idle hands... I'm
following up on a suggestion made to me in another thread "Auto-add files &
folders to VS.Net project?"
http://groups.google.com/groups?hl=e...6btnG%3DSearch

FLIP
1 Yup, that's exactly the issue I'm working on (see other thread)

Thanks for all the interest!

JON

Jul 21 '05 #7

P: n/a
Hi Jon,
1 Why do people keep saying that to me?
I hope you realize my remark was in jest. I try to inject a bit of humor
here and there to keep things from getting too dry.
2 Amazingly, there is a bit more to all this than idle hands... I'm
following up on a suggestion made to me in another thread "Auto-add files & folders to VS.Net project?"
After reading your other question, and the answers you got, I understand
your predicament, and I can tell you that there is a good reason that VS.Net
doesn't automatically add files and folders to an given project. That is,
you may not want them added. For example, if you use Visual SourceSafe to
protect your projects, it adds files to your folders that you definitely do
NOT want in your project. Also, at times I have found it convenient to
temporarily exclude a file from a project when compiling, for one reason or
another. If VS.Net automatically added files and folders to projects, you
would soon see a spate of messages coming from people like myself, who would
complain about it not working the way it does now. It's a no-win situation.
Your best bet is to learn to work with the app as it is. And it looks like
you have a solution that works for you now. So, bask away!

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Jon Maz" <jo****@surfeuNOSPAM.de> wrote in message
news:uE**************@TK2MSFTNGP15.phx.gbl... Hi All,

SCOTT
1 Am using VS2002
2 Genius! When I reach the puzzling Step 8, if I click "Show All Files"
*twice*, the offending file has disappeared as it should! All is now right in the world, and we are at the cusp of a new dawn of peace and happiness.

KEVIN
1 Why do people keep saying that to me?
2 Amazingly, there is a bit more to all this than idle hands... I'm
following up on a suggestion made to me in another thread "Auto-add files & folders to VS.Net project?"
http://groups.google.com/groups?hl=e...wever%252C%2By
ou%2Bcould%2Bvery%2Beasily%2Bwrite%2Ba%2Blittle%2B routine%2Bto%2Bdo%2Bthis%2
6btnG%3DSearch
FLIP
1 Yup, that's exactly the issue I'm working on (see other thread)

Thanks for all the interest!

JON

Jul 21 '05 #8

P: n/a
Hi Kevin,

1 Quite right too - there's nothing like a bit of jocularity when you're
getting down and dirty with XML, which can indeed be as dry as a ...*
2 Good point, hadn't thought of it that way. And anyway I'm learning quite a
lot making this mini-app.

Cheers,

JON

PS Am quite amused that a relatively frivolous question got an immediate
response from several dotnet heavyweights. In future I will avoid all
serious topics, safe in the knowledge that the gurus are on their way.

*see http://www.jamesnaylor.com/extras/slang.html for ways to finish that
sentence


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.797 / Virus Database: 541 - Release Date: 15/11/2004
Jul 21 '05 #9

P: n/a
Jon,

As another step in the experiment, open the .csproj (or .vbproj) file in
your solution with a text editor.

--
Klaus H. Probst, MVP
http://www.vbbox.com/
"Jon Maz" <jo****@surfeuNOSPAM.de> wrote in message
news:e#**************@tk2msftngp13.phx.gbl...
Hi Kevin,

1 Quite right too - there's nothing like a bit of jocularity when you're
getting down and dirty with XML, which can indeed be as dry as a ...*
2 Good point, hadn't thought of it that way. And anyway I'm learning quite a lot making this mini-app.

Cheers,

JON

Jul 21 '05 #10

P: n/a
Hi Klaus,

Yup, playing with the xml in those files is exactly what I'm doing.

Cheers,

JON
Jul 21 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.