Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

/platform:anycpu32bitpreferred is not a valid setting for option /target:library or /target:module

I created a Windows service project and later decided to change it's output type to class library so I could include the service class in another project which would create the .exe to be installed as a service. But now when I try to build the first project it fails with the error:

/platform:anycpu32bitpreferred is not a valid setting for option /target:library or /target:module

How can I fix this?

like image 371
mclaassen Avatar asked Aug 27 '14 13:08

mclaassen


People also ask

How to turn off prefer32bit?

Find the line <Prefer32Bit>true</Prefer32Bit> and change the value "true" to "false". There might be more than one depending how many different configurations have been set up. Removed true from one of the project. It worked. But not sure how this entry was added to that particular project. Can you please explain with more detail...

How do I target a 32-bit or 64-bit platform?

You can use any version of Visual Studio to target both 32-bit and 64-bit platforms. The Configuration Manager provides a way for you to quickly add a new platform to target with your project. If you select one of the platforms included with Visual Studio, the properties for your project are modified to build your project for the selected platform.

Why is my target platform not matching my test configuration profile?

So for OP sounds like the configuration is correct for the Debug build, but your target platform may not match the platform specified in your test configuration profile. If you experience this issue please check that the target platform in the build properties for your project match the configuration platform.

How can I fix <prefer32bit>true in my project?

How can I fix this? This is an older blog post, but it suggests editing the .csproj file directly and removing <Prefer32bit>true</Prefer32bit>, and then unloading and reloading the project in the solution. Show activity on this post.


1 Answers

Try to

unload project (right click in solution explorer)

edit <projectName>.csproj (right click in solution explorer)

remove <Prefer32Bit>true</Prefer32Bit>

reload project.

like image 182
Raphaël Althaus Avatar answered Oct 10 '22 01:10

Raphaël Althaus