Mukil Deepthi
Mukil Deepthi

Reputation: 6482

C# VisualStudio project rebuild giving /platform:anycpu32bitpreferred can only be used with /t:exe, /t:winexe and /t:appcontainerexe

I have a windows application and using cheetah for config transformations i.e app.config.debug, app.config.test, etc.,

When the project is built in debug mode , it works fine but when teamcity change the mode to test configuration and try to rebuild getting the following error:

/platform:anycpu32bitpreferred can only be used with /t:exe, /t:winexe and /t:appcontainerexe

Can anyone please help me how to fix this?

Thanks

Upvotes: 12

Views: 6177

Answers (3)

Silverion
Silverion

Reputation: 201

Open the project file with the text editor. 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.

Upvotes: 20

Chris Schaller
Chris Schaller

Reputation: 16679

For me the issue was that the project listed in the error had the wrong configuration setup. So while the Configuration Platform for the current build was set to x86, the target platform in the properties for the x86 configuration was set to AnyCPU.

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.

Upvotes: 0

Mukil Deepthi
Mukil Deepthi

Reputation: 6482

Removed true from one of the project. It worked. But not sure how this entry was added to that particular project.

Upvotes: 0

Related Questions