开发者

Silverlight, MSBuild, VS and some shared files. How?

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 Silverlig开发者_JAVA百科ht 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?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜