views:

119

answers:

2

I have a VS project used for my .NET WCF host with some simple DTOs in it. I then have another project targeted for Silverlight with links to the files from the .NET-project.

What's the best way automate the build, so that all files from the .NET project are automatically built to a Silverlight assembly too?

I have tried the following in the Silverlight-library project:

<Compile Include="..\KSLog.Core.Services.Shared\**\*.cs" Exclude="..\KSLog.Core.Services.Shared\Properties\AssemblyInfo.cs"></Compile> 

But when I do a build or a rebuild of the solution new files in the .NET project are not automatically added to the Silverlight project, and if I have deleted files in the .NET project, I get a compile error, saying the file is not found in the Silverlight project.

Can I make it automatically update it self in some way? Or am I doing it all wrong?

A: 

If you really get stuck how about trying this...

WCF RIA Services uses Client Code Generation to share code between the service layer and the Silverlight client. You could install the download, generate a sample app using the Silverlight Business Application project template to create a Sample WCF RIA Services line of business application and have a look at the MSBuild techniques they are using.

There is a specific technique where you can include the word shared in the file name and the files end up getting copied into the client project and compiled. I'm not suggesting you need to use RIA Services, just copy their MSBuild technique.

Obviously a fair bit of effort but might be worth a try if you don't figure out the problem with your current technique.

Martin Hollingsworth
Thank you. I will try to take a look at that. I'm pretty sure copying the files will be better than my current technique.
asgerhallas
A: 

It looks like Prism has a way of synchronizing two projects for different target environments:

http://msdn.microsoft.com/en-us/library/dd458870.aspx

I have still to try it, but I will return here, when I have.

asgerhallas
It works like a charm! :)
asgerhallas