Success compiling Audacity with VS2010

In your Audacity directory, convert win/audacity.sln by opening it in MS VS2010 (this needs to be an up-to-date version–use Windows Update service and make sure you are set to “update other products from Microsoft”). DO NOT attempt to build it yet!

After the conversion, in the /win/ folder you will find the newly-created-during-conversion file:
ny.props
Open this file with a text editor and replace it with the following:

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup
    Condition="'$(copyBeforeTargets)' == '' and '$(copyAfterTargets)' == '' and '$(ConfigurationType)' != 'Makefile'">
    <copyBeforeTargets>Midl</copyBeforeTargets>
    <copyAfterTargets>CustomBuild</copyAfterTargets>
  </PropertyGroup>
  <PropertyGroup>
    <copyDependsOn
      Condition="'$(ConfigurationType)' != 'Makefile'">_SelectedFiles;$(copyDependsOn)</copyDependsOn>
  </PropertyGroup>
  <ItemDefinitionGroup>
    <copy>
      <OutputName>$(OutDir)$(ProjectFileName)%(Filename)%(Extension)</OutputName>
      <CommandLineTemplate>copy /Y [inputs] %(OutputName)</CommandLineTemplate>
      <Outputs>%(OutputName)</Outputs>
      <ExecutionDescription>Copying %(Filename)</ExecutionDescription>
    </copy>
  </ItemDefinitionGroup>
</Project>

A close comparison will show the removal of some unwanted quotation marks.


Now you need to turn off DSound; there must be an easier way using #defines and pre-processor symbols, but I’m no compiler guru …

Choose the Solution you wish to build (Unicode Release, Unicode Debug, Release or Debug); open (if not already) the Solution Explorer window in MS VS2010 and right-click the Audacity Project. From the context menu choose Properties.

add to Audacity project property page C++ > Preprocessor > Preprocessor Definitions:
PA_NO_DS
add to portaudio-v19 project property page C++ > Preprocessor > Preprocessor Definitions:
PA_NO_DS
add to portmixer project property page C++ > Preprocessor > Preprocessor Definitions:
PA_NO_DS

portaudio-v19 remove 1 line; property page: Build Events > Pre-Build Events – Command Line:

IF "%DXSDK_DIR%" == "" echo #define PA_NO_DS >>"$(ProjectDir)/$(Configuration)/config.h"

portmixer remove 1 line; property page: Build Events > Pre-Build Events – Command Line:

IF "%DXSDK_DIR%" == "" echo #define PA_NO_DS >>"$(ProjectDir)/$(Configuration)/config.h"

portaudio-v19 remove 2 lines; property page: Build Events > POST-Build Events – Command Line:

if "%DXSDK_DIR%"=="" goto NoDX

cl %CFLAGS% /I "%DXSDK_DIR%/include" "%BASE%/src/hostapi/dsound/pa_win_ds.c"
cl %CFLAGS% /I "%DXSDK_DIR%/include" "%BASE%/src/hostapi/dsound/pa_win_ds_dynlink.c"

set LIBS="%DXSDK_DIR%/lib/x86dxguid.lib"

:NoDX

-------BECOMES—

if "%DXSDK_DIR%"=="" goto NoDX

set LIBS="%DXSDK_DIR%/lib/x86dxguid.lib"

:NoDX

portmixer remove 1 line; property page: Build Events > POST-Build Events – Command Line:

if "%DXSDK_DIR%"=="" goto NoDX

cl %CFLAGS% /I "%DXSDK_DIR%/include" "%BASE%/src/px_win_ds.c"

set LIBS="%DXSDK_DIR%/lib/x86/dxguid.lib"

:NoDX

-------BECOMES—

if "%DXSDK_DIR%"=="" goto NoDX

set LIBS="%DXSDK_DIR%/lib/x86/dxguid.lib"

:NoDX

The above procedure will need to be followed for every Solution you wish to build–a real hassle! So, if you ever SVN Checkout a complete HEAD you will need to go through all that all over again unless you save everything and only replace the changed files.

There are a few lines of code to comment out:
lib-srcportaudio-v19srcoswinpa_win_hostapis.c lines 75-77:

//#ifndef PA_NO_DS
//        PaWinDs_Initialize,
//#endif

lib-srcportmixersrcpx_mixer.c lines 54-57:

//#if defined(PX_USE_WIN_DSOUND)
//int OpenMixer_Win_DirectSound(px_mixer *Px, int index);
//#endif

and in the same file, lines 135-139:

//#if defined(PX_USE_WIN_DSOUND)
//      case paDirectSound:
//         good = OpenMixer_Win_DirectSound(Px, i);
//      break;
//#endif

That’s it, the wxWidgets libraries will not need to be re-built! Now build, run and enjoy the spiffy new IDE of MS VS2010.

The above instructions are working fine for Debug & Release but both Unicode solutions are still having a “trivial” problem.

That “trivial” little problem caused me to pull an all-nighter! But I have it all working now and I resolved the problem with DSound. As it turns out you must also compile wxWidgets with MS VC++ 2010. Last night before posting I only did a few cursory checks which worked okay but with extensive testing this morning I ended up having to recompile wxWidgets. There was an upside – wxWidgets compiles much better with 2010 than it does with 2008!

Before you do anything else, checkout brand-new copies of both wxWidgets and Audacity. A word to the wise, the wxWidgets VC6 project cannot be promoted directly to VC10, you’ll first have to upgrade it to VC9 (VC++ 2008) but you did not build that solution you immediately upgrade that solution to VC++ 2010. You might as well check out the 2.8.12 version of wxWidgets it works just fine with Audacity. One more hint, put both your wxWidgets and Audacity folders in the root of your hard drive – one of the problems turned out to be caused by excessively long paths – the exact same paths work just fine in VC++ 2008 .

Don’t forget to reset your environmental variable for WXWIN so that it points to the new wxWidgets folder. The only problem I found building wxWidgets is that they still have not fixed the four post-build events so four of the DLL libraries are put in the wrong folder – they end up in lib/vc_lib and must be moved into lib/vc_dll. Once you have wxWidgets built you can start on Audacity.

Let’s revisit the entire process because most of what I posted has been changed. One word of warning – I have not tried to compile the locale project; like the Nyquist effects code it has a “.rules” file which might require some work.

Speaking of which, let us start with the Nyquist rules file; there is one minor change which is not required but will save a little time and disk space in the long run. Look at the line which starts with “FileExtensions”; you’ll note in the original that it lists three file extensions. In reality we only need the first one. It is located in the win/ directory. Here is a small part of it:
winny.rules

Outputs="[$OutputName]"
FileExtensions="*.ny;*.lsp;*.raw"
ExecutionDescription="Copying $(InputName)"

this will become:

Outputs="[$OutputName]"
FileExtensions="*.ny"
ExecutionDescription="Copying $(InputName)"

You must make the above change before you upgrade the project otherwise the rule is hardcoded and I found no way to change it afterwards.

Start VC++ 2010 from its own folder so that the welcome screen shows – you do not want to double-click on an existing solution. Open a Windows Explorer file browser on the win/ folder in your Audacity directory; look for a file called “audacity.sln”; drag that icon and drop it on VC++ 2010. A dialog will open in which you’ll make the choices needed to upgrade the old solution. You may accept all the defaults but personally I would not bother making backup copies nor would I bother viewing the resulting log. After the upgrade process completes the first thing you want to do is go to File > Open > File… and opened these three files: “ny.targets”, “ny.props” and “ny.targets” – all of these are in the win/ folder.

The original ny.props file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup
     Condition="'$(copyBeforeTargets)' == '' and '$(copyAfterTargets)' == '' and '$(ConfigurationType)' != 'Makefile'">
      <copyBeforeTargets>Midl</copyBeforeTargets>
      <copyAfterTargets>CustomBuild</copyAfterTargets>
   </PropertyGroup>
   <PropertyGroup>
      <copyDependsOn
        Condition="'$(ConfigurationType)' != 'Makefile'">_SelectedFiles;$(copyDependsOn)</copyDependsOn>
   </PropertyGroup>
   <PropertyGroup>
      <PluginDirectory>plug-ins</PluginDirectory>
   </PropertyGroup>
   <ItemDefinitionGroup>
      <copy>
         <QuotedOutputName>"$(OutDir)$(ParentName)$(PluginDirectory)%(Filename)%(Extension)"</QuotedOutputName>
         <OutputName>$(OutDir)$(ParentName)$(PluginDirectory)%(Filename)%(Extension)</OutputName>
         <CommandLineTemplate>copy /Y [inputs] %(QuotedOutputName)</CommandLineTemplate>
         <Outputs>%(OutputName)</Outputs>
         <ExecutionDescription>Copying %(Filename)</ExecutionDescription>
      </copy>
   </ItemDefinitionGroup>
</Project>

The replacement looks like:

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup
     Condition="'$(copyBeforeTargets)' == '' and '$(copyAfterTargets)' == '' and '$(ConfigurationType)' != 'Makefile'">
      <copyBeforeTargets>Midl</copyBeforeTargets>
      <copyAfterTargets>CustomBuild</copyAfterTargets>
   </PropertyGroup>
   <PropertyGroup>
      <copyDependsOn
        Condition="'$(ConfigurationType)' != 'Makefile'">_SelectedFiles;$(copyDependsOn)</copyDependsOn>
   </PropertyGroup>
   <PropertyGroup>
      <PluginDirectory>plug-ins</PluginDirectory>
   </PropertyGroup>
   <ItemDefinitionGroup>
      <copy>
         <QuotedOutputName>"$(OutDir)$(ParentName)$(PluginDirectory)%(Filename)%(Extension)"</QuotedOutputName>
         <OutputName>$(OutDir)$(ParentName)$(PluginDirectory)%(Filename)%(Extension)</OutputName>
         <CommandLineTemplate>copy /Y [inputs] %(QuotedOutputName)</CommandLineTemplate>
         <Outputs>%(OutputName)</Outputs>
         <ExecutionDescription>Copying %(Filename)</ExecutionDescription>
      </copy>
   </ItemDefinitionGroup>
</Project>

The original ny.targets file looks like:

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <PropertyPageSchema
      Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml" />
    <AvailableItemName
      Include="copy">
      <Targets>_copy</Targets>
    </AvailableItemName>
  </ItemGroup>
  <UsingTask
    TaskName="copy"
    TaskFactory="XamlTaskFactory"
    AssemblyName="Microsoft.Build.Tasks.v4.0">
    <Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>
  </UsingTask>
  <Target
    Name="_copy"
    BeforeTargets="$(copyBeforeTargets)"
    AfterTargets="$(copyAfterTargets)"
    Condition="'@(copy)' != ''"
    DependsOnTargets="$(copyDependsOn);ComputecopyOutput"
    Outputs="@(copy->'%(Outputs)')"
    Inputs="@(copy);%(copy.AdditionalDependencies);$(MSBuildProjectFile)">
    <ItemGroup
      Condition="'@(SelectedFiles)' != ''">
      <copy
        Remove="@(copy)"
        Condition="'%(Identity)' != '@(SelectedFiles)'" />
    </ItemGroup>
    <ItemGroup>
      <copy_tlog
        Include="%(copy.Outputs)"
        Condition="'%(copy.Outputs)' != '' and '%(copy.ExcludedFromBuild)' != 'true'">
        <Source>@(copy, '|')</Source>
      </copy_tlog>
    </ItemGroup>
    <Message
      Importance="High"
      Text="%(copy.ExecutionDescription)" />
    <WriteLinesToFile
      Condition="'@(copy_tlog)' != '' and '%(copy_tlog.ExcludedFromBuild)' != 'true'"
      File="$(IntDir)$(ProjectName).write.1.tlog"
      Lines="^%(copy_tlog.Source);@(copy_tlog->'%(Fullpath)')" />
    <copy
      Condition="'@(copy)' != '' and '%(copy.ExcludedFromBuild)' != 'true'"
      CommandLineTemplate="%(copy.CommandLineTemplate)"
      OutputName="%(copy.OutputName)"
      QuotedOutputName="%(copy.QuotedOutputName)"
      AdditionalOptions="%(copy.AdditionalOptions)"
      Inputs="@(copy)" />
  </Target>
  <PropertyGroup>
    <ComputeLinkInputsTargets>
            $(ComputeLinkInputsTargets);
            ComputecopyOutput;
          </ComputeLinkInputsTargets>
    <ComputeLibInputsTargets>
            $(ComputeLibInputsTargets);
            ComputecopyOutput;
          </ComputeLibInputsTargets>
  </PropertyGroup>
  <Target
    Name="ComputecopyOutput"
    Condition="'@(copy)' != ''">
    <ItemGroup>
      <copyDirsToMake
        Condition="'@(copy)' != '' and '%(copy.ExcludedFromBuild)' != 'true'"
        Include="%(copy.Outputs)" />
      <Link
        Include="%(copyDirsToMake.Identity)"
        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
      <Lib
        Include="%(copyDirsToMake.Identity)"
        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
      <ImpLib
        Include="%(copyDirsToMake.Identity)"
        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
    </ItemGroup>
    <MakeDir
      Directories="@(copyDirsToMake->'%(RootDir)%(Directory)')" />
  </Target>
</Project>

the new one looks like:

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <PropertyPageSchema
      Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml" />
    <AvailableItemName
      Include="copy">
      <Targets>_copy</Targets>
    </AvailableItemName>
  </ItemGroup>
  <UsingTask
    TaskName="copy"
    TaskFactory="XamlTaskFactory"
    AssemblyName="Microsoft.Build.Tasks.v4.0">
    <Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>
  </UsingTask>
  <Target
    Name="_copy"
    BeforeTargets="$(copyBeforeTargets)"
    AfterTargets="$(copyAfterTargets)"
    Condition="'@(copy)' != ''"
    DependsOnTargets="$(copyDependsOn);ComputecopyOutput"
    Outputs="@(copy->'%(Outputs)')"
    Inputs="@(copy);%(copy.AdditionalDependencies);$(MSBuildProjectFile)">
    <ItemGroup
      Condition="'@(SelectedFiles)' != ''">
      <copy
        Remove="@(copy)"
        Condition="'%(Identity)' != '@(SelectedFiles)'" />
    </ItemGroup>
    <ItemGroup>
      <copy_tlog
        Include="%(copy.Outputs)"
        Condition="'%(copy.Outputs)' != '' and '%(copy.ExcludedFromBuild)' != 'true'">
        <Source>@(copy, '|')</Source>
      </copy_tlog>
    </ItemGroup>
    <Message
      Importance="High"
      Text="%(copy.ExecutionDescription)" />
    <WriteLinesToFile
      Condition="'@(copy_tlog)' != '' and '%(copy_tlog.ExcludedFromBuild)' != 'true'"
      File="$(IntDir)$(ProjectName).write.1.tlog"
      Lines="^%(copy_tlog.Source);@(copy_tlog->'%(Fullpath)')" />
    <copy
      Condition="'@(copy)' != '' and '%(copy.ExcludedFromBuild)' != 'true'"
      CommandLineTemplate="%(copy.CommandLineTemplate)"
      OutputName="%(copy.OutputName)"
      QuotedOutputName="%(copy.QuotedOutputName)"
      AdditionalOptions="%(copy.AdditionalOptions)"
      Inputs="@(copy)" />
  </Target>
  <PropertyGroup>
    <ComputeLinkInputsTargets>
            $(ComputeLinkInputsTargets);
            ComputecopyOutput;
          </ComputeLinkInputsTargets>
    <ComputeLibInputsTargets>
            $(ComputeLibInputsTargets);
            ComputecopyOutput;
          </ComputeLibInputsTargets>
  </PropertyGroup>
  <Target
    Name="ComputecopyOutput"
    Condition="'@(copy)' != ''">
    <ItemGroup>
      <copyDirsToMake
        Condition="'@(copy)' != '' and '%(copy.ExcludedFromBuild)' != 'true'"
        Include="%(copy.Outputs)" />
      <Link
        Include="%(copyDirsToMake.Identity)"
        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
      <Lib
        Include="%(copyDirsToMake.Identity)"
        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
      <ImpLib
        Include="%(copyDirsToMake.Identity)"
        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
    </ItemGroup>
    <MakeDir
      Directories="@(copyDirsToMake->'%(RootDir)%(Directory)')" />
  </Target>
</Project>

The old ny.xml code looks like:

<?xml version="1.0" encoding="utf-8"?>
<ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:transformCallback="Microsoft.Cpp.Dev10.ConvertPropertyCallback">
  <Rule
    Name="copy"
    PageTemplate="tool"
    DisplayName="Copy Nyquist file"
    Order="200">
    <Rule.DataSource>
      <DataSource
        Persistence="ProjectFile"
        ItemType="copy" />
    </Rule.DataSource>
    <Rule.Categories>
      <Category
        Name="General">
        <Category.DisplayName>
          <sys:String>General</sys:String>
        </Category.DisplayName>
      </Category>
      <Category
        Name="Command Line"
        Subtype="CommandLine">
        <Category.DisplayName>
          <sys:String>Command Line</sys:String>
        </Category.DisplayName>
      </Category>
    </Rule.Categories>
    <StringListProperty
      Name="Inputs"
      Category="Command Line"
      IsRequired="true"
      Switch=" ">
      <StringListProperty.DataSource>
        <DataSource
          Persistence="ProjectFile"
          ItemType="copy"
          SourceType="Item" />
      </StringListProperty.DataSource>
    </StringListProperty>
     <StringProperty
       Name="OutputName"
       HelpContext="0"
       DisplayName="Output File"
       Description="Specifies a name to override the default file name"
       Switch=""[value]"" />
     <StringProperty
       Name="QuotedOutputName"
       HelpContext="0"
       DisplayName="Quoted Output File"
       Description="Specifies a name to override the default file name"
       Switch=""[value]"" />
    <StringProperty
      Name="CommandLineTemplate"
      DisplayName="Command Line"
      Visible="False"
      IncludeInCommandLine="False" />
    <DynamicEnumProperty
      Name="copyBeforeTargets"
      Category="General"
      EnumProvider="Targets"
      IncludeInCommandLine="False">
      <DynamicEnumProperty.DisplayName>
        <sys:String>Execute Before</sys:String>
      </DynamicEnumProperty.DisplayName>
      <DynamicEnumProperty.Description>
        <sys:String>Specifies the targets for the build customization to run before.</sys:String>
      </DynamicEnumProperty.Description>
      <DynamicEnumProperty.ProviderSettings>
        <NameValuePair
          Name="Exclude"
          Value="^copyBeforeTargets|^Compute" />
      </DynamicEnumProperty.ProviderSettings>
      <DynamicEnumProperty.DataSource>
        <DataSource
          Persistence="ProjectFile"
          HasConfigurationCondition="true" />
      </DynamicEnumProperty.DataSource>
    </DynamicEnumProperty>
    <DynamicEnumProperty
      Name="copyAfterTargets"
      Category="General"
      EnumProvider="Targets"
      IncludeInCommandLine="False">
      <DynamicEnumProperty.DisplayName>
        <sys:String>Execute After</sys:String>
      </DynamicEnumProperty.DisplayName>
      <DynamicEnumProperty.Description>
        <sys:String>Specifies the targets for the build customization to run after.</sys:String>
      </DynamicEnumProperty.Description>
      <DynamicEnumProperty.ProviderSettings>
        <NameValuePair
          Name="Exclude"
          Value="^copyAfterTargets|^Compute" />
      </DynamicEnumProperty.ProviderSettings>
      <DynamicEnumProperty.DataSource>
        <DataSource
          Persistence="ProjectFile"
          ItemType=""
          HasConfigurationCondition="true" />
      </DynamicEnumProperty.DataSource>
    </DynamicEnumProperty>
    <StringListProperty
      Name="Outputs"
      DisplayName="Outputs"
      Visible="False"
      IncludeInCommandLine="False" />
    <StringProperty
      Name="ExecutionDescription"
      DisplayName="Execution Description"
      Visible="False"
      IncludeInCommandLine="False" />
    <StringListProperty
      Name="AdditionalDependencies"
      DisplayName="Additional Dependencies"
      IncludeInCommandLine="False"
      Visible="false" />
    <StringProperty
      Subtype="AdditionalOptions"
      Name="AdditionalOptions"
      Category="Command Line">
      <StringProperty.DisplayName>
        <sys:String>Additional Options</sys:String>
      </StringProperty.DisplayName>
      <StringProperty.Description>
        <sys:String>Additional Options</sys:String>
      </StringProperty.Description>
    </StringProperty>
  </Rule>
  <ItemType
    Name="copy"
    DisplayName="Copy Nyquist file" />
  <FileExtension
    Name="*.ny"
    ContentType="copy" />
  <ContentType
    Name="copy"
    DisplayName="Copy Nyquist file"
    ItemType="copy" />
</ProjectSchemaDefinitions>

the replacement will look like:

<?xml version="1.0" encoding="utf-8"?>
<ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:transformCallback="Microsoft.Cpp.Dev10.ConvertPropertyCallback">
  <Rule
    Name="copy"
    PageTemplate="tool"
    DisplayName="Copy Nyquist file"
    Order="200">
    <Rule.DataSource>
      <DataSource
        Persistence="ProjectFile"
        ItemType="copy" />
    </Rule.DataSource>
    <Rule.Categories>
      <Category
        Name="General">
        <Category.DisplayName>
          <sys:String>General</sys:String>
        </Category.DisplayName>
      </Category>
      <Category
        Name="Command Line"
        Subtype="CommandLine">
        <Category.DisplayName>
          <sys:String>Command Line</sys:String>
        </Category.DisplayName>
      </Category>
    </Rule.Categories>
    <StringListProperty
      Name="Inputs"
      Category="Command Line"
      IsRequired="true"
      Switch=" ">
      <StringListProperty.DataSource>
        <DataSource
          Persistence="ProjectFile"
          ItemType="copy"
          SourceType="Item" />
      </StringListProperty.DataSource>
    </StringListProperty>
     <StringProperty
       Name="OutputName"
       HelpContext="0"
       DisplayName="Output File"
       Description="Specifies a name to override the default file name"
       Switch=""[value]"" />
     <StringProperty
       Name="QuotedOutputName"
       HelpContext="0"
       DisplayName="Quoted Output File"
       Description="Specifies a name to override the default file name"
       Switch=""[value]"" />
    <StringProperty
      Name="CommandLineTemplate"
      DisplayName="Command Line"
      Visible="False"
      IncludeInCommandLine="False" />
    <DynamicEnumProperty
      Name="copyBeforeTargets"
      Category="General"
      EnumProvider="Targets"
      IncludeInCommandLine="False">
      <DynamicEnumProperty.DisplayName>
        <sys:String>Execute Before</sys:String>
      </DynamicEnumProperty.DisplayName>
      <DynamicEnumProperty.Description>
        <sys:String>Specifies the targets for the build customization to run before.</sys:String>
      </DynamicEnumProperty.Description>
      <DynamicEnumProperty.ProviderSettings>
        <NameValuePair
          Name="Exclude"
          Value="^copyBeforeTargets|^Compute" />
      </DynamicEnumProperty.ProviderSettings>
      <DynamicEnumProperty.DataSource>
        <DataSource
          Persistence="ProjectFile"
          HasConfigurationCondition="true" />
      </DynamicEnumProperty.DataSource>
    </DynamicEnumProperty>
    <DynamicEnumProperty
      Name="copyAfterTargets"
      Category="General"
      EnumProvider="Targets"
      IncludeInCommandLine="False">
      <DynamicEnumProperty.DisplayName>
        <sys:String>Execute After</sys:String>
      </DynamicEnumProperty.DisplayName>
      <DynamicEnumProperty.Description>
        <sys:String>Specifies the targets for the build customization to run after.</sys:String>
      </DynamicEnumProperty.Description>
      <DynamicEnumProperty.ProviderSettings>
        <NameValuePair
          Name="Exclude"
          Value="^copyAfterTargets|^Compute" />
      </DynamicEnumProperty.ProviderSettings>
      <DynamicEnumProperty.DataSource>
        <DataSource
          Persistence="ProjectFile"
          ItemType=""
          HasConfigurationCondition="true" />
      </DynamicEnumProperty.DataSource>
    </DynamicEnumProperty>
    <StringListProperty
      Name="Outputs"
      DisplayName="Outputs"
      Visible="False"
      IncludeInCommandLine="False" />
    <StringProperty
      Name="ExecutionDescription"
      DisplayName="Execution Description"
      Visible="False"
      IncludeInCommandLine="False" />
    <StringListProperty
      Name="AdditionalDependencies"
      DisplayName="Additional Dependencies"
      IncludeInCommandLine="False"
      Visible="false" />
    <StringProperty
      Subtype="AdditionalOptions"
      Name="AdditionalOptions"
      Category="Command Line">
      <StringProperty.DisplayName>
        <sys:String>Additional Options</sys:String>
      </StringProperty.DisplayName>
      <StringProperty.Description>
        <sys:String>Additional Options</sys:String>
      </StringProperty.Description>
    </StringProperty>
  </Rule>
  <ItemType
    Name="copy"
    DisplayName="Copy Nyquist file" />
  <FileExtension
    Name="*.ny"
    ContentType="copy" />
  <ContentType
    Name="copy"
    DisplayName="Copy Nyquist file"
    ItemType="copy" />
</ProjectSchemaDefinitions>

The next chore will be to fix portmixer and portaudio-19 so that they will compile. Let’s start with portmixer; with Solution Explorer open click on the little triangle to open up the contents do the same to open the Source Files. You will note that px_win_ds.c has a little red dot on its icon:
pm.png
right-click on that file bring up the context menu and select Properties:
yes.png
Click on that bold black **Yes**and change it to No. Click Apply, but leave the dialog open. Now click the portmixer project– you now have the project Properties. Use the little triangle twisty to open up Configuration Properties; toward the very bottom open the Build Events and select Post-Build Events. In the right-hand panel you will see the Command Line field:
post-build.png
I put some circles on this in red pointing out the features I mentioned above. Over in the top right-hand corner of that picture you will see the drop-down gadget for the Command Line editor; when you click it you can get to the Edit… menu which brings up the Command Line dialog at the very bottom of the picture.

I’m going to close this out now and continue it in a second post…

part the second…let us skip back a few lines in the previous post to the point where it says “The next chore will be to fix portmixer…”.

Before you change that Yes into a No, this might be a good time to try compiling Audacity before you make any changes to the property pages. In the previous message I dealt with known bugs of Microsoft’s updater dealing with “rules” files; the problems were reported in the beta almost 2 years ago and the beta testers were assured that they would be fixed “immediately if not sooner” but it appears nothing has been done. They did say that the problem was way down on their to-do list because it only affected a tiny fraction of users.

The rest of the problems I had only exhibited because I had the Microsoft DirectX SDK installed. If you do not have it installed you might not need to make the following changes. If you do have the problem you might see errors that look like this:

Error	13	error C1083: Cannot open source file: 'ILAGSDXSDK_DIR/src/hostapi/dsound/pa_win_ds.c': No such file or directory	D:SVNwinProjectsportaudio-v19c1
Error	14	error C1083: Cannot open source file: 'ILAGSDXSDK_DIR/src/hostapi/dsound/pa_win_ds_dynlink.c': No such file or directory	D:SVNwinProjectsportaudio-v19c1
Error	15	error MSB3073: The command "set BASE="../../../lib-src/portaudio-v19"
set CFLAGS=/Od /I "ºSE%/include" /I "ºSE%/src/common" /I "ºSE%/src/os/win" /D "WIN32" /D "_DEBUG" /D "_LIB" /D "_MBCS" /GF /FD /EHsc /RTC1 /MDd /Gy  /Fo"Debug" /Fd"Debug" /W3 /nologo /c /ZI /wd4996 /FI "D:SVNwinProjectsportaudio-v19/Debug/config.h" /errorReport:prompt
set LIBS=
if "%DXSDK_DIR%"=="" goto NoDX
cl ÏLAGS% /I "%DXSDK_DIR%/include" "ºSE%/src/hostapi/dsound/pa_win_ds.c"
cl ÏLAGS% /I "%DXSDK_DIR%/include" "ºSE%/src/hostapi/dsound/pa_win_ds_dynlink.c"
set LIBS="%DXSDK_DIR%/lib/x86dxguid.lib"
:NoDX
if "%ASIOSDK_DIR%"=="" goto NoASIO
cl ÏLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "ºSE%/src/hostapi/asio/pa_asio.cpp"
cl ÏLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "ºSE%/src/hostapi/asio/iasiothiscallresolver.cpp"
cl ÏLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%ASIOSDK_DIR%/common/asio.cpp"
cl ÏLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%ASIOSDK_DIR%/host/asiodrivers.cpp"
cl ÏLAGS% /I "%ASIOSDK_DIR%/common" /I "%ASIOSDK_DIR%/host" /I "%ASIOSDK_DIR%/host/pc" "%ASIOSDK_DIR%/host/pc/asiolist.cpp"
:NoASIO
lib /OUT:"D:SVNwinDebugportaudio-v19.lib" "Debug*.obj" %LIBS%
:VCEnd" exited with code -1.	C:Program Files (x86)MSBuildMicrosoft.Cppv4.0Microsoft.CppCommon.targets	113

(I tightened up the spacing by removing blank lines from the error message).

If you refer back to the large picture at the bottom of the previous post you will see where we need to start to fix the compile problems with portmixer; follow the instructions in the previous post which start out with “The next chore…” and open the Properties page for portmixer. You will need to change all of the solutions which you wish to compile (Debug, Release, Unicode Debug and Unicode Release); the process is quite similar for each but you cannot just copy one change to all four solutions.

Referring back to the picture, the text of the original Post-Build Event is:

set BASE="../../../lib-src/portmixer"
set CFLAGS=/Od /I "%BASE%/../portaudio-v19/include" /I "%BASE%/include" /D "WIN32" /D "_DEBUG" /D "_LIB" /D "PX_USE_WIN_MME" /D "_MBCS" /GF /FD /EHsc /RTC1 /MDd /Gy /Fo"$(IntDir)" /Fd"$(IntDir)" /W3 /nologo /c /ZI /wd4996 /FI "$(ProjectDir)/$(Configuration)/config.h" /errorReport:prompt
set LIBS=

if "%DXSDK_DIR%"=="" goto NoDX

cl %CFLAGS% /I "%DXSDK_DIR%/include" "%BASE%/src/px_win_ds.c"

set LIBS="%DXSDK_DIR%/lib/x86/dxguid.lib"

:NoDX

lib /OUT:"$(TargetPath)" "$(IntDir)*.obj" %LIBS%

The first problem is the line that reads:
set LIBS=
in which it is setting a variable called LIBS equal to nothing; this seems to be just fine in 2008 but 2010 seems to choke on it so just get rid of it.

The next problem has to do with the first “if” statement:
if “%DXSDK_DIR%”==“” goto NoDX
what this line says is “if you have an environmental variable set to point to a DirectX SDK folder, do the next two statements”. The problem with this is that the file “px_win_ds.c” is set to “Exclude From Build” and this setting is contrary to the commandline instruction:
cl %CFLAGS% /I “%DXSDK_DIR%/include” “%BASE%/src/px_win_ds.c”
which tells the compiler to compile it. This was just fine in 2008 but 2010 chokes on it. There are two solutions you can turn the “Exclude From Build” setting from Yes to No and there will be no conflict or you can get rid of all lines leaving just the last line. Remember, you will need to do this for each Solution you want to build.

I also had a problem with the expansion of the BASE and CFLAGS variables because of the length of my folder names (all my folder names where the default folder names as installed by Microsoft and/or Audacity; my Audacity folder is in the root of my hard drive and is called audacity2010, so I could not get my folder names much smaller even though I did try naming my Audacity folder D:A – that did not help). The problem is not with the length of the line presented to the compiler, the problem is with 2010’s expansion of the variables – these exact same folder names (in fact considerably longer) work just fine in 2008.

What I ended up having to do was get rid of the BASE and CFLAGS variables completely and replace each variable with a fully qualified path:

if "%DXSDK_DIR%"=="" goto NoDX

cl /Od /I "D:Alib-srcportaudio-v19include" /I "D:Alib-srcportmixerinclude" /D "WIN32" /D "_DEBUG" /D "_LIB" /D "PX_USE_WIN_MME" /D "_MBCS" /GF /FD /EHsc /RTC1 /MDd /Gy /Fo"$(IntDir/)" /Fd"$(IntDir)/" /W3 /nologo /c /ZI /wd4996 /I "C:Program Files (x86)Microsoft DirectX SDK (June 2010)include" "D:Alib-srcportmixersrcpx_win_ds.c"

set LIBS="C:Program Files (x86)Microsoft DirectX SDK (June 2010)Libx86dxguid.lib"

:NoDX

lib /OUT:"$(TargetPath)" "$(IntDir)*.obj" %LIBS%

You will see in the above fully qualified paths that look like:
“D:Alib-srcportaudio-v19include”
and you can see that I made my Audacity folder’s name “A”; I eventually changed my personal build to where that folder’s name is “audio/Audacity/SVN2010” and even with that somewhat lengthy addition I had no trouble compiling. My guess is that you can have that compile line somewhere out in the neighborhood of 512 characters - at least that’s what I recall from 20 years ago – the last time I dealt with commandline compiling !
*EDIT 11 October 2013
It has been a while now and it seems that VC++ 2010 is a little bit happier with expanding strings but I had to use:

$(ProjectDir)......lib-src

everywhere for the folder reference to lib-src.
*End Edit

If you look at the very end of the original commandline compile (cl) statement and compare it to my version you will see that there are a few differences. In the original version the compiler supplied the slashes inherent in expanding “$(IntDir)” but 2010 requires the user to supply the slashes; there are two places needing that treatment.

Another problem is with commandline switch /FI “$(ProjectDir)/$(Configuration)/config.h”, which tells the compiler to pre-compile the config.h header; this worked in 2008 but does not work in 2010 (I do not know why, I’m guessing it’s because of the way the variables ProjectDir and Configuration are expanded). It’s no big deal to just not pre-compile the header file so I just got rid of it.

Finally, you’ll note in the original, at the very end of the line:
/errorReport:prompt
which deals with the automatic transmittal of usage information to Microsoft – I just got rid of it.

If you wish to change the other solutions you cannot just copy all of this and paste it into each solution – the commandline switches are different!

Okay, right-click on the project portmixer in the Solution Explore and from the context menu choose Build (should be at the very top). If all goes well you will not have any errors. If you do have errors go back and examine each step along the way.

You must do the same thing for portaudio–19 but it is a tiny bit more complicated. In this case there are three files which are “turned off”:
pa.png
follow the same procedure as outlined above to change the “Exclude From Build” from yes to no. Follow the same procedure as outlined above to expand the BASE and CFLAGS variables completely and replace both with fully qualified paths. Do not forget to remove the line that looks like:
set LIBS=
and don’t forget that you need to do the whole process for each Solution!

Now compile the portaudio-19 project; if you get an error it is probably a problem with finding an included header file. You may need to edit one of the source files.
lib-src/portaudio-v19/src/hostapi/dsound/pa_win_ds.c at line 105:
//#include “pa_win_wdmks_utils.h”
#include “…/…/os/win/pa_win_wdmks_utils.h”

Now that you have those two problem projects resolved right-click on the Audacity project and build it. Everything should go fine; good luck!.

Questions always welcome.

My suspicion about a problems with the locale project are born out. It seems that as it is not scheduled to be build by the converted solution there is no attempt to create po.targets, po.props nor po.xml from the original rules file. Attempting to build locale yields the same sort of “missing quotation marks” error as ny.rules delivered. I will play around with this at some time, but as .PO files created by 2008 should work just fine in a 2010 solution I am not going to obsess over it.

I realize I am “talking to myself” here but the topic is getting read and I want there to be a record for when the Developers want to get out of the dark ages !

Today I successfully compile the Unicode builds-Debug & Release with the beta developers’ preview of MS VS 11 (the release after 2010 which will probably be MS VS 2012). It had all the same problems that VS2010 had and all the “fixes” worked. I really like the 2010/2012 IDE when compared to 2008. I have not delved deeply into the changes for 2012 but will do so in the next few days. Since that is off-topic here PM me for a review !

I’ve not commented before as I’ve never used VS2010 so have nothing to add, but I think this is a very worthwhile thread that will probably have more relevance in the future.

Some more nit-picks…

You will see 5 Projects which alway get re-built even when you have not touched them: twolame, libvorbis, libsbdfile, libid3tag & the copying of Nyquist plug-ins.

The first 4 will look like this:
--------------------------------------
------ Build started: Project: libsndfile, Configuration: Unicode Release Win32 ------
Build started 11/23/2011 8:26:11 PM.
InitializeBuildStatus:
Creating “Unicode Releaselibsndfile.unsuccessfulbuild” because “AlwaysCreate” was specified.
ClCompile:
All outputs are up-to-date.
All outputs are up-to-date.
Lib:
All outputs are up-to-date.
libsndfile.vcxproj → D:audacity2010winUnicode Releaselibsndfile.lib
FinalizeBuildStatus:
Deleting file “Unicode Releaselibsndfile.unsuccessfulbuild”.
Touching “Unicode Releaselibsndfile.lastbuildstate”.

Build succeeded.
--------------------------------------
The message:
“AlwaysCreate” was specified.
is triggered by badly formed header paths &/or missing/moved files. Here are the directions for removing these annoyances:

twolame Project
Solution Explorer:
remove & re-add:
win32/configwin.h
win32/winutil.h

Configuration properties changes:
C/C++ General Additional Include Directories add:
…/…/…/lib-src/twolame/libtwolame;…/…/…/lib-src/twolame/win32
--------------------------------------

libvorbis Project
Solution Explorer:
remove & re-add:
lib/backends.h

remove unfound
lib/bitbuffer.h

Configuration properties changes:
C/C++ General Additional Include Directories add:
…lib-srclibvorbislib
--------------------------------------

libsbdfile Project
Solution Explorer:
remove unfound
float_cast.h
--------------------------------------

libid3tag Project
Solution Explorer:
remove unfound
acconfig.h
--------------------------------------

After making the fixes, build each project for each configuration then build audacity twice for each configuration. Once to set the "“untouched” status to true then one to prove the solution.

For the Nyquist copy annoyance:

Audacity Project
Nyquist copying
After successfully building & running each of the configuration solutions:
Configuration properties changes:
Copy Nyquist file
Execute before Run
Execute After Clean

This will cause all the plug-ins to be copied the first time – a lot of copy file output will show up; then after switching to “before Run” & “after Clean” they will only be copied when you do a Clean on a Solution.

Here is another problem for anyone who wants to use mod-script-pipe:

warning MSB8012:
TargetPath(D:audacity2010winUnicode Releasemod-script-pipe.dll)
does not match the Linker’s OutputFile property value
(D:audacity2010winUnicode Releasemodulesmod-script-pipe.dll).
This may cause your project to build incorrectly. To correct this, please make sure that
$(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0Microsoft.CppBuild.targets 990

The fix:

mod-script-pipe Project
Configuration Properties
General Output Directory:
modules

Linker General OutputFile:
$(OutDir)$(ProjectName).dll

Hello,

I am using VS2010 Pro and attempting to compile audacity. I have worked through a few compile errors, but this one is stumping me. I am from C# land, so I am not sure how to proceed:


Error 1 error MSB4023: Cannot evaluate the item metadata “%(Extension)”. The item metadata “%(Extension)” cannot be applied to the path ““C:audacityCodewinDebugAudacity.vcxprojanalyze.ny””. Illegal characters in path. C:audacityCodewinny.targets 65 6 Audacity

I have posted it on stackoverflow.com if anyone plays that game.

http://stackoverflow.com/questions/10092052/error-compiliing-audacity-msb4023-item-metadata-cannot-be-applied

Can anyone advise me?

EDIT: For what it is worth, I took the easy way out. Installed VC++ 2008 Express and used that.

Thanks guys!

I see that you have now discovered that Audacity does not officially support VS2010.

For the benefit of other readers finding this thread:

It is strongly recommended that you use VS2008. The (free) VS2008 Express version is just fine for building Audacity. The core developers have no intention of moving to MSVC 2010, due (a) to the ‘This is for evaluation purposes only’ MSVC 2010 Express splash screen and (b) bugs in MSVC 2010 Express that are not present in MSVC 2008 Express.

Edgar, a couple of things:

  1. In your second post, you present an “old” and “new” version of three files, ny.props, ny.targets and ny.rules, but I can’t discern any difference between the old ones and the new ones. I may be blind, but, for all three files, the old and new appear to be exactly the same. It may be a copy-paste error on your part. And, unfortunately, you don’t talk about it is you modified.

  2. I believe the reason why the post-build scripts don’t work is because variables should be expanded using the $(MY_VARIABLE) pattern instead of the %MY_VARIABLE% pattern. Did you ever give that a try?

  3. I also have the same issue as bullyellis (i.e. Cannot evaluate the item metadata “%(Extension)”.) I surmise that’s actually caused by problem 1.

  4. Thanks for you effort. I followed your instructions (though perhaps not in the right order, and not to the letter because I did experiments to try to understand the nature of the errors) and I’m stuck at 3. because I’m not clear about the meaning of that error nor how to fix it.

And, yes, I realize I’m posting in a year old thread but I feel that it’s worth it add this post.

Hi! Sorry for the delay in replying but I’ve been out-of-town for a month with no good access. Getting it to work back then was a time consuming nightmare and I am not about to devote any additional time given the Developers lack of interest. I am still using MSVS 2010 to compile my personal version and 2008 to compile the official version or any spin-offs I need.

I’m back home now and can look at my source code…
ny.props and ny.targets are brand-new files that do not exist in the 2008 version.

The current ny.rules is exactly the same as mine but if you go back and pull an older revision of the source (e.g. revision r11361) you will find that it differs at line 12…
old:

FileExtensions="*.ny;*.lsp;*.raw"

new:

FileExtensions="*.ny;"

At this time I am not certain that removing those two file extensions was “required” but suspect it was otherwise I would never have noticed it.