Categories: C#, VS2010
Posted by
mheydt on
7/4/2009 4:15 PM |
Comments (0)
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
Tim Heuer has instructions on how to setup a multi-targeting SL 2/3 configuration using VS.NET 2010:
Silverlight and Visual Studio 2010 Beta 1
Giving it a try right now and will report back if I have any issues with his instructions.
Update:
Well, I've tried this, and it seems to work. Specifically, what I did do was install as described, and I used 2010 to open an SL2 project which it did fine, and I could also create new SL3 projects, which could not be done with SL2 and 2008 as you had to use either SL2 or SL3, without any possibility of both.
I didn't really try to change the target, as the scenario I mention is my use case that I need this for.
However, I'm not sure I'm going to be using 2010 too much in this beta as I just was annoyed by various issues. A few times starting the debugger it locked up, and I can't seem to change the default colors in the editor to be what I want. Also, coderush / refactor pro don't work in it either.
10388d7c-fa3d-456d-a87d-a74ddc753d4c|0|.0