Different behaviour of StyleCop/MSBuild integration

May 2, 2011 at 3:38 PM

On 32-bit systems the following will work:

<Import Project="$(ProgramFiles)\MSBuild\Microsoft\StyleCop\v4.4\Microsoft.StyleCop.targets" />
On 64-bit systems the following will work:
<Import Project="$(MSStyleCopTargetsPath)\Microsoft.StyleCop.targets" />

As long as all developer machines are using 32bit or 64bit everything will be OK. But if there is a mix if 32/64 bit developer machines ... What will be the best approach solving that or what is the best workaround? Defining own environment variable for example? Is this a bug or feature? Why should be there a difference?

It simply seems that $(MSStyleCopTargetsPath) is not defined under 32bit ...

Regards,
Harald-René Flasch (aka hfrmobile)

Coordinator
May 2, 2011 at 3:56 PM

Hi,

Do you know where the MSStyleCopTargetsPath is being defined? On searching the source I can't find it anywhere.

May 7, 2011 at 7:35 PM

$(MSStyleCopTargetsPath) is a VS variable (not a environment variable e.g. %MSStyleCopTargetsPath%) and I assumed that it is defined by StyleCop installer? ... (but only when running on 64bit ...?)

The advantage of such a variable would be that we do not need to adjust version number when upgrading to a newer StyleCop version  (if where a large number of projects and lot of different teams it would be take some effort to do that)

Coordinator
May 7, 2011 at 7:47 PM
I can't find this variable defined anywhere by stylecop. Anyone else any ideas?



On 7 May 2011, at 20:35, "hfrmobile" <notifications@codeplex.com> wrote:

From: hfrmobile

$(MSStyleCopTargetsPath) is a VS variable (not a environment variable e.g. %MSStyleCopTargetsPath%) and I assumed that it is defined by StyleCop installer? ... (but only when running on 64bit ...?)

The advantage of such a variable would be that we do not need to adjust version number when upgrading to a newer StyleCop version (if where a large number of projects and lot of different teams it would be take some effort to do that)

Developer
May 7, 2011 at 10:17 PM

If I get time to spend on re-integrating my setup-cleanup branch (to eliminate the need to run cmd scripts before opening the solution) then I'll have a look at this, if nobody else has figured it out.  (Probably still a few days out before I can hit these.)

May 7, 2011 at 10:26 PM

OK, thanks a lot!

May 14, 2011 at 5:27 PM

Just found the following in a WP7 project: $(MSBuildExtensionsPath)

But: https://connect.microsoft.com/VisualStudio/feedback/details/109232/msbuild-msbuildextensionspath-returns-invalid-path-on-x64

(closed: By Design ....... ^^)