Sign in to follow this  

[.net] Multiple solutions in dotnet prebuild

This topic is 3291 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Anyone here familiar with dotnet prebuild? I want to be able to have it create multiple solutions and have some projects shared between solutions. Is there any way to do that without duplicating the <project /> section in Prebuild.xml for each solution that includes the same project?

Share this post


Link to post
Share on other sites
Been a while since I looked at prebuild, but you might be able to do something with changing the path of the <Project> node to go up a level, but I don't think there is specific code for including another XML file into one file (though, Preprocessor.cs is where you would do that).

Share this post


Link to post
Share on other sites
Most of my work on prebuild was with the nant building and some processing instruction stuff. There isn't explictly a <?link?> PI or something like that from what I remember, nor an xlink. So, unless I missed something browsing the code again, you'll have to make some changes to include.

I would go with either a <?PI?> or a xlink version, if you want to add it. And I'm sure someone will appreciate it if you do, mainly because its a useful feature.

I could be wrong though, I just didn't see anything when I went through the subversion repository.

Share this post


Link to post
Share on other sites
I thought about adding onto it but it looks like from the forums that the project is not very active. But then I notice that you are one of the developers so maybe I don't have to be as concerned about trying to make a submission to a project that none of the developers are paying attention to.

Well, if I don't get that far I may just create a preprocessing utility to generate dnpb files the way I want.

Edit: Actually it was easy to add support for an include node in dnpb. I will test it some more and then submit a patch.

[Edited by - kanato on November 18, 2008 2:55:25 PM]

Share this post


Link to post
Share on other sites
Ok, I created a patch which add support for include files in a prebuild.xml file. To use it, one adds a preprocessor command like:

<?include file="some_other_file.xml" ?>

Please let me know what you think.

http://agate.sourceforge.net/download/dnpb.patch

Share this post


Link to post
Share on other sites
Cool. I found some other issues with making visual studio project files. Designer generated files and resx files aren't linked with Forms and UserControls correctly. I've fixed some of those issues myself, but I don't have quite the understanding of the whole code well enough to know if the fixes I've done are the way they should be.

Share this post


Link to post
Share on other sites
So, this is an issue that I've been struggling with and I have had to fix several parts of the prebuild code to get this to work. First I have to ask the question, if I have a WinForms app where I have a settings file and resx files that are associatd with UserControls or Forms, what is the proper way to write my prebuild file so that these are included? This is the sort of approach I've been trying to use:

<Files>
<File buildAction="None">Properties/Settings.settings</File>
<Match pattern="*.cs" recurse="true"/>
<Match pattern="*.resx" recurse="true"/>
</Files>


When creating VS2008 project files though, the resx files are not correctly marked as dependent on any associated forms (for instance, if a form has an embedded icon). If the match line for resx files is left off, the resx files are not included in the project and not compiled.

When creating nant build files, the above approach causes resx files to be included as resources, and then again as source files, which causes the build to fail when nant is run.

So if I'm using Prebuild wrong, I need to understand how to setup a basic winforms application with a settings file and resx files which may or may not be attached to a form or usercontrol. Otherwise, I can submit patches for these issues to correct the output for VS2008 and nant. (I've checked in my fixes for Prebuild to the AgateLib SVN on source forge, if you want to take a look. I am not yet satisfied with my testing to submit as a patch, but if you want to give me preemptive feedback on it, feel free to take a look.)

Share this post


Link to post
Share on other sites
I remember encountering the same problem with the VS2005 target. This was fixed at some point, but I'm not sure how.

In OpenTK, I simply include the .cs files and prebuild automatically handles the dependent resources.

Share this post


Link to post
Share on other sites
Yeah, I looked at that, but in OpenTK the project file doesn't come out right, because for instance, for GLControl the GLControl.resx file is not included. It's not an issue with building OpenTK, because there aren't actually any embedded resources in the resx files associated with controls, but try setting an icon for (e.g.) the example launcher form, and then recreate the project files. The project will build fine after that, but it will crash when starting up because the resource hasn't been embedded in the assembly.

[Edited by - kanato on November 30, 2008 1:58:29 PM]

Share this post


Link to post
Share on other sites
Yeah, I think there needs to be a bit more metadata on some of the elements to really get the associations right. One approach is we expand it to allow recursive files with pattern matching, but I'm still coming back up to speed on the code.

Share this post


Link to post
Share on other sites
Has anyone considered updating prebuild to .NET 2.0? The use of strongly typed collections could really improve working with the code. It's be a big project though.

Share this post


Link to post
Share on other sites
Yeah, generics are love. :) I talked to Rob Loach about it and he told me to just mess around with it, so I'll probably be doing that this week once I finish my homework (night school is a bitch), and finish up some other things (like how to get the indented/combined files working neatly).

Share this post


Link to post
Share on other sites
awesome. I have some bug fixes for generating visual studio files and monodevelop files for projects with resources. In monodevelop if you don't write all the right stuff to the project files then you can wind up getting MissingManifestResourceExceptions when running your project. I'll create patches and post them on the dnpb forum next week probably.

Share this post


Link to post
Share on other sites
Looks like a programming week for me. :) I'm going to go through the various patches over on the site and see if I can integrate a bunch of them. I know there are some 2-3 year old bugs that I didn't really notice before (I originally got on as a "scratching an itch" patch and all the work I did on other related projects).

Share this post


Link to post
Share on other sites

This topic is 3291 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this