Click here to Skip to main content
15,848,264 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# alias Pin
Pete O'Hanlon24-Feb-09 22:46
subeditorPete O'Hanlon24-Feb-09 22:46 
GeneralRe: C# alias Pin
_Maxxx_24-Feb-09 23:54
professional_Maxxx_24-Feb-09 23:54 
GeneralRe: C# alias Pin
Jon Rista24-Feb-09 13:41
Jon Rista24-Feb-09 13:41 
GeneralRe: C# alias Pin
PIEBALDconsult24-Feb-09 13:53
mvePIEBALDconsult24-Feb-09 13:53 
GeneralRe: C# alias Pin
Jon Rista24-Feb-09 18:06
Jon Rista24-Feb-09 18:06 
GeneralRe: C# alias Pin
PIEBALDconsult24-Feb-09 18:13
mvePIEBALDconsult24-Feb-09 18:13 
GeneralRe: C# alias Pin
PIEBALDconsult24-Feb-09 19:35
mvePIEBALDconsult24-Feb-09 19:35 
GeneralRe: C# alias Pin
Bill Stumps25-Feb-09 21:42
Bill Stumps25-Feb-09 21:42 
Thanks for your responses guys, and just to say that I have managed to adapt PIEBALDconsult's creative solution into something that will work in a straight-through build run with MSBuild rather than Csc. I can now run VS Projects and have MSBuild selectively pre-process files that have #includes in them, and process the others normally in one run.

The 'trick', if you like, was to set up a custom Task that does the preprocessing if it finds a file with a given extension (and I've used PIEBALD's .csi). All the code is actually written in .cs files, but the build is looking for .csi's in specified cases, and the custom Task is doing the pre-processing and generating these 'pre-build'. All I have to do is link my Task into the project in the 'BeforeBuild' targets:

<Project ... >
  ...
  <Target Name="BeforeBuild">
    <PreProcessor 
      Sender="$(RootNamespace).$(AssemblyName)"
      Sources="@(Compile)"
      />
  </Target>
  <UsingTask Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "
     TaskName="PreProcessor"
     AssemblyFile="bin\Debug\Com.Cinsault.PreProcessor.dll"
     />
  <UsingTask Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
     TaskName="PreProcessor"
     AssemblyFile="bin\Release\Com.Cinsault.PreProcessor.dll"
     />
  </Target>
</Project>

and the pre-processing of the headers is done before the build starts. I suppose there are just a couple of issues though. The most inconvenient is that, as the coding is done in the .cs file, but the build is working off the intermediate file, then any errors or warnings in VS are pointing to the wrong one, and the line numbers will be out too because of the included header code. The other is that, on the first run, MSBuild must find something for the files that it expects, even if these are empty, otherwise - even though the pre-build Task gets to do it's stuff first - MSBuild is looking ahead and saying "I got nothing to work with here!"

Could be useful though, so thanks again.

BS
AnswerRe: C# alias Pin
PIEBALDconsult24-Feb-09 11:35
mvePIEBALDconsult24-Feb-09 11:35 
QuestionInvoke and InvokeRequired in dll Pin
Member 471395924-Feb-09 10:40
Member 471395924-Feb-09 10:40 
AnswerRe: Invoke and InvokeRequired in dll Pin
harold aptroot24-Feb-09 10:57
harold aptroot24-Feb-09 10:57 
AnswerRe: Invoke and InvokeRequired in dll Pin
Alan N24-Feb-09 15:22
Alan N24-Feb-09 15:22 
QuestionActivation Code Pin
sitnet24-Feb-09 9:44
sitnet24-Feb-09 9:44 
AnswerRe: Activation Code Pin
Thomas Stockwell24-Feb-09 9:47
professionalThomas Stockwell24-Feb-09 9:47 
AnswerRe: Activation Code Pin
Christian Graus24-Feb-09 10:52
protectorChristian Graus24-Feb-09 10:52 
Question[Message Deleted] Pin
ioctl5124-Feb-09 9:08
ioctl5124-Feb-09 9:08 
AnswerRe: What is the standard way to poll a thread for completion? Pin
PIEBALDconsult24-Feb-09 9:41
mvePIEBALDconsult24-Feb-09 9:41 
GeneralRe: What is the standard way to poll a thread for completion? Pin
Pete O'Hanlon24-Feb-09 10:27
subeditorPete O'Hanlon24-Feb-09 10:27 
GeneralRe: What is the standard way to poll a thread for completion? Pin
PIEBALDconsult24-Feb-09 11:25
mvePIEBALDconsult24-Feb-09 11:25 
QuestionMost efficient switch statement variable to use? Pin
Bruce Coward24-Feb-09 7:34
Bruce Coward24-Feb-09 7:34 
AnswerRe: Most efficient switch statement variable to use? Pin
PIEBALDconsult24-Feb-09 7:49
mvePIEBALDconsult24-Feb-09 7:49 
AnswerRe: Most efficient switch statement variable to use? Pin
Luc Pattyn24-Feb-09 8:17
sitebuilderLuc Pattyn24-Feb-09 8:17 
GeneralRe: Most efficient switch statement variable to use? Pin
PIEBALDconsult24-Feb-09 9:43
mvePIEBALDconsult24-Feb-09 9:43 
GeneralRe: Most efficient switch statement variable to use? Pin
DaveyM6924-Feb-09 9:49
professionalDaveyM6924-Feb-09 9:49 
GeneralRe: Most efficient switch statement variable to use? Pin
PIEBALDconsult24-Feb-09 11:40
mvePIEBALDconsult24-Feb-09 11:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.