by mheydt
4.
July 2009 16:15
>
Last night I was porting some of my TweetZenn project over to VS2010 and came across this error in the build. It took quite a bit of googling to figure out what caused this as well as how to solve it, and many of the answers I found where also not related to the type of solution I was building (most seemed related to Azure development), so that made it a bit complicated also. But I have reduced this to a very simple scenario and solution, which I'll show here for everyone.
The problem can be reproduced very simply. Take this scenario:
1) Create a new Silverlight solution in 2010. Call it anything, but in this expositionI will call it OutputPathTest.
2) Add a C# windows library to the solution. I calle it "ALibrary"
Now build the solution. Everything works fine.
3) Now add a reference to "ALibrary" in your web project and build (not that you didn't even need to add any classes to ALibrary). You now get the OutputPath error message:

4) Remove the reference to ALibrary and build, and it builds properly.
So, this problem seems to be related to the reference to ALibrary causing the problem.
But how to solve this?
Well, it appears you need to manually edit the .csproj for ALibrary. Open the file in your favorite text editor; I'm using notepad2, and the following shows the culprits identified with red arrows:

The project is set to target x86 while the web solution is set to AnyCPU. To fix the problem, it is needed to change the mentions of x86 to AnyCPU. Do that, rebuild the solution, and everything will work perfectly.
0e2991ae-0fd0-443e-9a56-9fcc095cdc2b|0|.0
Tags:
C# | VS2010