Groups | Blog | Home
all groups > visual studio .net general > august 2004 >

visual studio .net general : Problem in adding file to deployment


Carlos J. Quintero [MVP]
8/25/2004 12:18:44 PM
You have to add the file explicitly in the File System Editor of the Setup
project (first button of Solution Explorer wthe the setup project node is
selected). Adding it to the Solution Explorer has wisely nothing to do with
deployment, it just a convenience for you while you are developing.

--

Carlos J. Quintero (Visual Developer - .NET MVP)

FAQs, Knowledge Base, Files, Docs, Articles, Utilities, etc. for .NET
addins:
http://groups.yahoo.com/group/vsnetaddin/ (free join)



"Nick" <nick029@heha.net.tw> escribió en el mensaje
news:erTSEkoiEHA.1344@TK2MSFTNGP11.phx.gbl...
[quoted text, click to view]

Carlos J. Quintero [MVP]
8/25/2004 1:21:10 PM
1) You have solution and projects:

1.1) A solution is a container for projects, but solutions can have also
files: select the solution node, right-click Add, Add New Item... and select
a Text file. The text file is added inside a node called Solution Items.
This is only a convenience during development to avoid you to use the
Windows Explorer to locate and open them. Notice that files in this node
lack the Build Action property.

1.2) A project is a container for files, most of them are source code files
(Build Action=Compile) but projects can have too non source code files, such
text files or xml files. In this case the Build Action is used to set if the
file:

1.2.1) Will be embedded in the executable when built (Build
Action=Embedded Resouce): such an icon or xml file with strings that the exe
will need at run-time but you don´t want to provide it as an external file
but embedded (there is a NET function to retrieve embedded resources at run
time).

1.2.2) Will be excluded from the executable when built (Build
Action=Content). This can happen in 2 cases:

1.2.2.1) The file is only a convenience during development.

1.2.2.2) The file will be needed at run time but it is provided
as an external file (not embedded) and therefore you will need to include
explicitly in the setup. This is your case.

I hope it's clear now.

2) Could you ellaborate this question a bit more? Who needs the path? The
setup knows the path because you have added it... and after installing the
application, the executable can know its path using
System.Reflection.Assembly.GetExecutingAssembly().Location() ...

--

Carlos J. Quintero (Visual Developer - .NET MVP)

FAQs, Knowledge Base, Files, Docs, Articles, Utilities, etc. for .NET
addins:
http://groups.yahoo.com/group/vsnetaddin/ (free join)



"Nick" <nick029@heha.net.tw> escribió en el mensaje
news:%23XZs26oiEHA.556@tk2msftngp13.phx.gbl...
[quoted text, click to view]

Carlos J. Quintero [MVP]
8/25/2004 4:36:26 PM
You have 2 options, choose whichever you dislike less:

1) To copy it by hand from the original source code folder to the Debug
folder each time you make a change. Maybe you can do this automatically with
some kind of macro, addin or post-build event (in C# project properties, not
in VB.NET). But in this case you have 2 copies of the file which is not
always a good idea... or

2) Move it from the original source code folder to the Debug folder, to have
only one copy. In this case you can still see it in the Solution Explorer if
you click the Show All Files button (the 4th): it shows the Bin (debug)
folder, etc. But in this case you have a development file outside source
code folders, not always a good idea... if you use this approach just ensure
that you never wipe out the Debug folder!

--

Carlos J. Quintero (Visual Developer - .NET MVP)

FAQs, Knowledge Base, Files, Docs, Articles, Utilities, etc. for .NET
addins:
http://groups.yahoo.com/group/vsnetaddin/ (free join)




"Nick" <nick029@heha.net.tw> escribió en el mensaje
news:eACEIvqiEHA.3348@TK2MSFTNGP12.phx.gbl...
[quoted text, click to view]

Nick
8/25/2004 5:50:51 PM
Hi,

I am creating an add-in using VS.NET add-in wizard. The MSI is auto
generated by the wizard. This works fine.

What I want to do is to add a custom readme file to the installation
folder, then I add an existing item in solution explorer, and set the
build action to content. But the file does not appear when the user
install the MSI (also debug folder). What is the problem?

Thanks.

Nick
8/25/2004 6:31:38 PM
Hi Carlos,

Thanks for your suggestions, it is helpful, but I still have some more
questions...

1. You suggestion works, so what is the function of adding file in
solution explorer (for convenience only? what is build action then?)

2. How to reference the path of the file after adding to the setup project?

Thanks!

Nick


[quoted text, click to view]
Nick
8/25/2004 9:03:26 PM
Hi Carlos,


You explanation is very clear and helpful for me. I really appreciate
and thanks so much for your kind help.

Thanks again!

Nick


[quoted text, click to view]
Nick
8/25/2004 9:59:39 PM
Hi Carlos,

One more question, :)

1. Now I can deploy the file through MSI, but the file does not appear
in the debug folder when debugging. How to make it also appear when
debugging.


Thanks
Nick


[quoted text, click to view]
Nick
8/25/2004 11:18:30 PM
Thanks.

[quoted text, click to view]
Matt
10/14/2004 9:45:08 AM
Is there any tool or setting to do this in VB.NET projects? Option 1 is the
prefered solution, since the file stays in souce control, and everything in
the Bin or Debug directories can be recreated from source. Escentially, this
should be treated as a source file where the compile action is just to copy
it.

[quoted text, click to view]
Carlos J. Quintero [MVP]
10/15/2004 10:58:57 AM
AFAIK, C# projects have pre/post build events, but VB.NET projects don´t.
So, you could create a solution add-in (an add-in tied to your solution, not
a general add-in for the IDE) and trap the EnvDTE.BuildEvents.OnBuildDone
event...


--

Carlos J. Quintero (Visual Developer - .NET MVP)

The MZ-Tools all-in-one add-in, now for .NET: http://www.mztools.com



"Matt" <Matt@discussions.microsoft.com> escribió en el mensaje
news:7A1A2B8B-33CE-4C5E-AC2E-F68A79EE2D23@microsoft.com...
[quoted text, click to view]

AddThis Social Bookmark Button