Is it possible to reference a custom MSBuild task in a CSPROJ?
This is what I'm trying to do, basically:
(1) Run a custom code generator to generate a CS file
(2) Add the CS file to the CSPROJ
(3) Build the CSPROJ
The code generator has several inputs. I've created a custom MSBuild task
to encapsulare capturing those inputs and passing them on to the code
generator.
I've figured out how to create a custom Target in my CSPROJ, based on my
custom MSBuild task. I can run MSBuild from the command line and direct it
to build my custom Target.
What I'm not quite getting is how I can do this from inside the VS.NET
IDE -- that is, how I can build my SLN (or CSPROJ) such that my custom
Target is built first.
I'm feeling like this maybe a dumb question, but I'm stuck nonetheless.
Thanks in advance.
Howard Hoffman
"Gary Chang[MSFT]" - 24 Nov 2005 06:51 GMT
Hi Howard,
>What I'm not quite getting is how I can do this from inside
>the VS.NET IDE -- that is, how I can build my SLN
>(or CSPROJ) such that my custom Target is built first.
Have you tried to run the run MSBuild command line in the Build
Event/Pre-Build Event, you can specify some commands(separate by
semi-comma) that occurs before the build process. please refer to the
following KB for the details:
HOW TO: Implement Build Events in Visual C# .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;810230
Thanks!
Best regards,
Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn
This posting is provided "AS IS" with no warranties, and confers no rights.
Sayed Ibrahim Hashimi - 28 Nov 2005 16:46 GMT
You may want to put the target(s) in the InitialTargets list. Have a look at:
<a
href="http://msdn2.microsoft.com/en-us/library/ms171463.aspx">http://msdn2.microsoft.c
om/en-us/library/ms171463.aspx</a>
The InitialTargets list will execute before any other targets.
Hope that helps,
Sayed Ibrahim Hashimi
> Is it possible to reference a custom MSBuild task in a CSPROJ?
>
[quoted text clipped - 21 lines]
>
> Howard Hoffman