Wednesday, April 9, 2008

Linq to SQL Setup Problems

I wanted to post this finding that took us a while to figure out and resolve. We are starting to use Linq to SQL in a new project and adding it to an existing Visual Studio setup solution. When this project was added to the setup solution, the project built but it reported a build error in the end. There was no information as to what failed. There was nothing that was reported when we used verbose build option. The setup project just failed. For this project, many things were changed so just removing the new things was not an option. We had other Linq to SQL projects in the solution without a problem and could not understand why this one would make the build fail.

So we turned to the programmer's best friend - Google. Searching for this we found a few cases that were similar.

The only option that seemed to make sense was that there was an issue with the installer project. People have seen this with installer projects that were built in VS2005 and then upgraded to VS2008. One person that had success fixing this rebuilt the installer project using VS2008. The time was taken to rebuild the installer project and it still had problems.

I kept digging into this issue and finally found something to try. All of the other Linq to SQL projects that worked in the setup project were generated using the Linq to SQL template in CodeSmith. This one was just a standard Linq to SQL just generated from the VS2008 IDE. So I converted this project to be generated from the template and things worked. Right after I did this I found this...

https://connect.microsoft.com/VisualStudio/feedback/Workaround.aspx?FeedbackID=317870

It turns out that you can edit the project file for the Linq to SQL and get the setup project to build correctly. This will work until you go back into the designer. Well with new things there are bound to be hiccups. At least if I can share this with others it might be faster to solve their problem.

No comments: