views:

31

answers:

1

So I am getting an exception thrown that my Test project cannot open the SQLite assembly. However here is the output when I compile:

------ Build started: Project: Budget, Configuration: Debug x86 ------
  Budget -> C:\Users\Scott\Desktop\Development\Budget\Budget\Budget\bin\Debug\Budget.exe
------ Build started: Project: Test, Configuration: Debug Any CPU ------
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Data.SQLite". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
  Test -> C:\Users\Scott\Desktop\Development\Budget\Budget\Test\bin\Debug\Test.dll
========== Build: 2 succeeded or up-to-date, 0 failed, 0 skipped ==========

As you can see the code project builds fine (seems to be because its set to x86). I have set BOTH projects to x86 though, and saved both and rebuilt, and it still doesn't say that Test is building for x86, therefore we see the assembly warning for test and not the other. How can I get both to build for x86?

-Scott

+1  A: 

This will happen when you import a project that was created in an earlier version of VS. It will import it for configurations Debug|AnyCPU and Release|AnyCPU. Adding a new project to the solution creates additional configurations: Debug|x86 and Release|x86, the defaults for VS2010. Now you got four. They tried to find a workaround for that by adding yet another set, Debug|Mixed Platforms and Release|Mixed Platforms. Now you got six.

Ouch. This is a bit of a mess. What is probably worst about it is that the configuration name is in no way associated with the Target Platform setting. You can change it but the configuration name doesn't change. This wasn't thought through real well.

Fix your problem with Build + Configuration Manager. Start with configuration = Debug, platform = x86. Note the Platform column, pick the project that has Any CPU. Click the combobox arrow, New and pick x86. Important: uncheck the "Create new solution platforms" checkbox. Tick the "Build" checkbox. Select configuration = Release and repeat the procedure.

That puts everything in the right spot. You can get rid of the bozo platforms by selecting Edit in the upper right platform combobox and using Remove. Oh, make a backup before you begin.

I don't think this will actually solve your problem, you should just remove the SQLite assembly reference and add it back.

Hans Passant
the amount of times this has annoyed me with visual studio. As this is exactly what I have to do when it doesn't build for certain platform, I know this is the right answer +1 :)
Sekhat