[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

Customising Setup Projects

hcurrie

8/13/2008 11:43:00 AM

I posted this a few days ago in microsoft.public.dotnet.framework.setup but
haven't had any response:

VS2008 Windows Forms
As part of the process of building my application setup program, I would
like to make some modifications to certain files. I can easily write the
code to do make the necessary changes given a list of filenames, but I'm
unsure of the best way to integrate this into my setup project solution. I
have had a quick look through the help files, and there seem to be several
options (addins, macros, post-build events, etc...) but I'm not sure the
best place to start. Any suggestions appreciated.
TIA
Phil.


8 Answers

Pavel Minaev

8/13/2008 11:58:00 AM

0

On Aug 13, 3:42 pm, "Phil" <N/A> wrote:
> I posted this a few days ago in microsoft.public.dotnet.framework.setup but
> haven't had any response:
>
> VS2008 Windows Forms
> As part of the process of building my application setup program, I would
> like to make some modifications to certain files. I can easily write the
> code to do make the necessary changes given a list of filenames, but I'm
> unsure of the best way to integrate this into my setup project solution. I
> have had a quick look through the help files, and there seem to be several
> options (addins, macros, post-build events, etc...) but I'm not sure the
> best place to start. Any suggestions appreciated.

I'd do this as a part of build process, probably indeed as a post-
build event. So long as it integrates with MSBuild, it should be fine
- so that you can set up a dedicated build server without breaking
things. If your app will also report errors as errorlevel code, its
errors will be reported as build failures (which is what it should be,
if this step is necessary to get a working build).

hcurrie

8/13/2008 3:35:00 PM

0

>
> > VS2008 Windows Forms
> > As part of the process of building my application setup program, I would
> > like to make some modifications to certain files. I can easily write the
> > code to do make the necessary changes given a list of filenames, but I'm
> > unsure of the best way to integrate this into my setup project solution.
> > I
> > have had a quick look through the help files, and there seem to be
> > several
> > options (addins, macros, post-build events, etc...) but I'm not sure the
> > best place to start. Any suggestions appreciated.
>
> I'd do this as a part of build process, probably indeed as a post-
> build event. So long as it integrates with MSBuild, it should be fine
> - so that you can set up a dedicated build server without breaking
> things. If your app will also report errors as errorlevel code, its
> errors will be reported as build failures (which is what it should be,
> if this step is necessary to get a working build).

OK. Thanks. I was looking at custom tools, but it all looks really
complicated.
I have managed to get something very simple working using a post build
event, so I shall continue down this route.
As a test I have used a simple dos command to rename some content files in
the project, and that seems to work. So what I need to do now I guess, is to
write a console app to take the filenames as parameters and make the
necessary changes to the files.
Thanks for the tip about reporting build errors. I'm not sure how to set the
errorlevel code, but I'll have a search for this.

Thanks
Phil.


Pavel Minaev

8/14/2008 6:29:00 AM

0

On Aug 13, 7:34 pm, "Phil" <N/A> wrote:
> > > VS2008 Windows Forms
> > > As part of the process of building my application setup program, I would
> > > like to make some modifications to certain files. I can easily write the
> > > code to do make the necessary changes given a list of filenames, but I'm
> > > unsure of the best way to integrate this into my setup project solution.
> > > I
> > > have had a quick look through the help files, and there seem to be
> > > several
> > > options (addins, macros, post-build events, etc...) but I'm not sure the
> > > best place to start. Any suggestions appreciated.
>
> > I'd do this as a part of build process, probably indeed as a post-
> > build event. So long as it integrates with MSBuild, it should be fine
> > - so that you can set up a dedicated build server without breaking
> > things. If your app will also report errors as errorlevel code, its
> > errors will be reported as build failures (which is what it should be,
> > if this step is necessary to get a working build).
>
> OK. Thanks. I was looking at custom tools, but it all looks really
> complicated.
> I have managed to get something very simple working using a post build
> event, so I shall continue down this route.
> As a test I have used a simple dos command to rename some content files in
> the project, and that seems to work. So what I need to do now I guess, is to
> write a console app to take the filenames as parameters and make the
> necessary changes to the files.
> Thanks for the tip about reporting build errors. I'm not sure how to set the
> errorlevel code, but I'll have a search for this.

If you declare your Main)( as returning int rather than void, then
whatever you return from it will be the error code.

Also, if you are going that route, then you might want to create a
custom MSBuild task rather than a console application. Here's some
info on that:

http://blogs.msdn.com/msbuild/archive/2006/01/21/5...

hcurrie

8/14/2008 9:32:00 AM

0

> If you declare your Main)( as returning int rather than void, then
> whatever you return from it will be the error code.

Thanks. It took a while, but I did manage to find this in the help files.
I'm coding in VB, so I had to change Sub Main() to Function Main() as
Integer.

> Also, if you are going that route, then you might want to create a
> custom MSBuild task rather than a console application. Here's some
> info on that:
>
> http://blogs.msdn.com/msbuild/archive/2006/01/21/5...
>

OK. I've got my console app up and running now, and seems to be doing the
job, but I'll take a look at this too.

Many thanks,
Phil.


hongyes

8/14/2008 10:21:00 AM

0

Hi Phil,

Thank you for posting. And thanks for Pavel's answer. I totally agree with
him that post build event is suitable to your requirement. Other than that,
I have something to complement:

For how to customize your post build event, here is the instruction:
http://msdn.microsoft.com/en-us/library/ke5...
It also contains an example, I think you can follow it easily to build your
custom tool.

For troubleshooting the error in the post build event, please check the
guideline: http://msdn.microsoft.com/en-us/library/b0b...
Although it is Visual C++ guideline, it has many common solutions to help
you to troubleshoot. For example:
" Add @echo on as the first command to see what your custom
build step is actually doing. The build events and build steps are placed
in a temporary .bat file and run when the project is built, so, you can add
error checking to your build event or build step commands.
" Run custom build steps and build events individually to
check their behavior.

One thing I want to mention that VS puts these commands in a batch file and
runs it. VS checks for build failures so it can tell you about them.
However - it only checks for a failure of the batch file that it created -
not for any failures within the batch file.
The solution for this limitation you can find it here:
http://geekswithblogs.net/dchestnutt/archive/2006/05/30/...
Check for error after every meaningful step and add code at the end to
handle the error so VS will report it.

Hope it helps. Please let me know if you have any other concerns, or need
anything else.

Regards,
Hongye Sun (hongyes@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#not....

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&am....
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

hcurrie

8/14/2008 12:35:00 PM

0

""Hongye Sun [MSFT]"" <hongyes@online.microsoft.com> wrote in message
news:kRK54if$IHA.1688@TK2MSFTNGHUB02.phx.gbl...

>

Thanks for your response. I'd already figured most of this out for myself
with Pavel's help. The problem with the error checking with multiple
commands is certainly useful to know about though, so thanks for that.
Note that I first posted this question in the
microsoft.public.dotnet.framework.setup group but never got any reply. Is
that not the most suitable group for this type of issue?

Thanks,
Phil.



Pavel Minaev

8/14/2008 2:15:00 PM

0

On Aug 14, 4:34 pm, "Phil" <N/A> wrote:
> Note that I first posted this question in the
> microsoft.public.dotnet.framework.setup group but never got any reply. Is
> that not the most suitable group for this type of issue?

Not really, it's much simpler than that. Here are the Google Groups
stats for both newsgroups:

microsoft.public.dotnet.framework.setup
Language: English
150 subscribers, Messages per month: 15, Usenet

microsoft.public.dotnet.framework
Language: English
2869 subscribers, Messages per month: 412, Usenet

hongyes

8/15/2008 3:07:00 AM

0

Hi Phil,

Thanks for your reply.

I think your question is ok to post in
microsoft.public.dotnet.framework.setup, but if you're a MSDN subscriber,
you might want to post in one of those MSDN Managed Newsgroups:
http://msdn.microsoft.com/en-us/subscriptions/aa9....

Regards,
Hongye Sun (hongyes@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.