NUnit run failing in MSBuild after Upgrade - System.IO.FileLoadException: Could not load file or assembly nunit.framework - msbuild

I recently upgraded my solution to Visual Studio 2013 and updated the references to NUnit 2.6.3 in the test libraries from 2.6.2. Everything works fine in Visual Studio but my MSBuild scripts that drive the deployment system are completely borked.
The Build files are in a build directory which contains an MSBuild folder with MSBuild.Community.Targets files which are referenced and an NUnit directory containing nunit-console.exe and various dependent files. I upgraded these to 2.6.3 also.
I just get this error...
' System.IO.FileLoadException: Could not load file or assembly
'nunit.framework, Version=2.6.0.12051, Culture=neutral,
PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040) '
I don't get this at all - This worked fine before and all the code was referencing 2.6.2 so I have no idea where 2.6.0 is coming from or how on earth I tell it to look for 2.6.3 (which is right there!!)
Here's my build file (if it helps any)...
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="DeployAndPackage" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- IMPORTS -->
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildProjectDirectory)\MSBuild\MSBuild.Community.Tasks.targets" />
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll"/>
<!-- PROPERTIES -->
<PropertyGroup Label="BuildOptions">
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">Any CPU</Platform>
<OutputPath Condition=" '$(OutputPath)' == '' ">bin\</OutputPath>
<ProjectConfiguration Condition=" '$(Configuration)' == '' ">Debug</ProjectConfiguration>
<ProjectConfiguration Condition=" '$(Configuration)' == 'Test' ">Debug</ProjectConfiguration>
<ProjectConfiguration Condition=" '$(Configuration)' == 'Staging' ">Release</ProjectConfiguration>
<ProjectConfiguration Condition=" '$(Configuration)' == 'Live' ">Release</ProjectConfiguration>
</PropertyGroup>
<PropertyGroup Label="DirectoryPaths">
<RootDir>$(MSBuildProjectDirectory)\..\</RootDir>
<TestsDir>$(RootDir)Tests\</TestsDir>
<DatabaseDir>$(RootDir)SiansPlan.Database\</DatabaseDir>
<RelativePackageDir>$(RootDir)pkg\</RelativePackageDir>
<Solution>$(RootDir)SiansPlan.sln</Solution>
<SP_Auth>$(RootDir)SiansPlan.Authentication\SiansPlan.Authentication.csproj</SP_Auth>
<SP_Database>$(DatabaseDir)SiansPlan.Database.sqlproj</SP_Database>
<SP_Entities>$(RootDir)SiansPlan.Entities\SiansPlan.Entities.csproj</SP_Entities>
<SP_Domain>$(RootDir)SiansPlan.Domain\SiansPlan.Domain.csproj</SP_Domain>
<SP_Providers>$(RootDir)SiansPlan.Providers\SiansPlan.Providers.csproj</SP_Providers>
<SP_ApiDir>$(RootDir)SiansPlan.Api\</SP_ApiDir>
<SP_Api>$(SP_ApiDir)SiansPlan.Api.csproj</SP_Api>
<SP_Web>$(RootDir)SiansPlan.Web\SiansPlan.Web.csproj</SP_Web>
<SP_SpaDir>$(RootDir)SiansPlan.Spa\</SP_SpaDir>
<SP_Spa>$(SP_SpaDir)SiansPlan.Spa.csproj</SP_Spa>
<SP_Test_Support>$(TestsDir)SiansPlan.TestSupport\SiansPlan.TestSupport.csproj</SP_Test_Support>
<SP_Entities_Tests>$(TestsDir)SiansPlan.Entities.Tests\SiansPlan.Entities.Tests.csproj</SP_Entities_Tests>
<SP_Auth_Tests>$(TestsDir)SiansPlan.Authentication.Tests\SiansPlan.Authentication.Tests.csproj</SP_Auth_Tests>
<SP_Domain_Tests>$(TestsDir)SiansPlan.Domain.Tests\SiansPlan.Domain.Tests.csproj</SP_Domain_Tests>
<SP_Api_Tests>$(TestsDir)SiansPlan.Api.Tests\SiansPlan.Api.Tests.csproj</SP_Api_Tests>
</PropertyGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>2ae13924-f2dd-48b1-9acb-755e0ee2b0d1</ProjectGuid>
</PropertyGroup>
<!-- BUILD -->
<Target Name="Compile">
<MSBuild Projects="$(SP_Auth)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Database)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Entities)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Domain)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Providers)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Api)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Web)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Spa)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Test_Support)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Entities_Tests)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Auth_Tests)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Domain_Tests)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
<MSBuild Projects="$(SP_Api_Tests)" Targets="Rebuild" Properties="Configuration=$(ProjectConfiguration);Platform=$(Platform);OutputPath=bin\" />
</Target>
<!-- TEST -->
<Target Name="RunTests" DependsOnTargets="Compile">
<CreateItem Include="$(RootDir)Tests\*.Tests\bin\*.Tests.dll">
<Output TaskParameter="Include" ItemName="TestAssemblies" />
</CreateItem>
<NUnit Assemblies="#(TestAssemblies)" ToolPath="$(MSBuildProjectDirectory)\NUnit" DisableShadowCopy="true" />
</Target>
<!-- TRANSFORM -->
<Target Name="Transform">
<TransformXml Source="$(SP_ApiDir)\Web.config"
Transform="$(SP_ApiDir)\Web.$(Configuration).config"
Destination="$(SP_ApiDir)\Web.transformed.config"
StackTrace="False" />
<TransformXml Source="$(SP_SpaDir)\Web.config"
Transform="$(SP_SpaDir)\Web.$(Configuration).config"
Destination="$(SP_SpaDir)\Web.transformed.config"
StackTrace="False" />
</Target>
<!-- DEPLOY & PACKAGE -->
<Target Name="DeployAndPackage" DependsOnTargets="RunTests">
<CallTarget Targets="Transform"/>
<ItemGroup>
<SqlFiles Include="$(DatabaseDir)Upgrades\*.sql" />
</ItemGroup>
<RemoveDir Directories="$(RelativePackageDir)" />
<MakeDir Directories="$(RelativePackageDir)" />
<MakeDir Directories="$(RelativePackageDir)sql\" />
<Copy SourceFiles="#(SqlFiles)" DestinationFolder="$(RootDir)pkg\sql" />
</Target>
</Project>
The full output of the 'RunTests' part of the build is...
RunTests:
C:\Development\Clients\SiansPlan\source\build\NUnit\nunit-console.exe
/nologo /noshadow
C:\Development\Clients\SiansPlan\source\build..\Tests\SiansPlan.Api.Tests\bin\SiansPlan.Api.Tests.dll
C:\Development\Clients\SiansPlan\source\build..\Tests\SiansPlan.Api.Tests\bin\SiansPlan.Domain.Tests.dll
C:\Development\Clients\SiansPlan\source\build..\Tests\SiansPlan.Authentication.Tests\bin\SiansPlan.Authentication.Tests.dll
C:\Development\Clients\SiansPlan\source\build..\Tests\SiansPlan.Domain.Tests\bin\SiansPlan.Domain.Tests.dll
C:\Development\Clients\SiansPlan\source\build..\Tests\SiansPlan.Entities.Tests\bin\SiansPlan.Entities.Tests.dll
C:\Development\Clients\SiansPlan\source\build..\Tests\SiansPlan.Logging.Tests\bin\SiansPlan.Domain.Tests.dll
C:\Development\Clients\SiansPlan\source\build..\Tests\SiansPlan.Logging.Tests\bin\SiansPlan.Logging.Tests.dll
ProcessModel: Default DomainUsage: Multiple Execution Runtime:
net-4.5 Unhandled Exception: System.IO.FileLoadException: Could
not load file or assembly 'nunit.framework, Version=2.6.0.12051,
Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'nunit.framework, Version=2.6.0.12051, Culture=neutral,
PublicKeyToken=96d09a1eb7f44a77'
Any ideas would be most welcome as I'm at head banging against desk stage. I've asked my desk bear, my rubber duck and Soundwave and none of them have been much use, frankly!

Obscure answer for an obscure problem - It seems I had an old library that was hanging around (Domain.Tests in Logging was a bit of a giveaway) which was causing it to fall over.
cleanfail

Related

WiX Toolset v4: Dynamically set Target/Ouput Name of installer

After upgrading a WiX installer project (.wixproj) file to v4, the MSBuild step in the project to set the TargetName of the installer file output is no longer working.
I would like to dynamically append the assembly version of the application to be installed to the TargetName of the msi file name i.e. MyApplication.X.X.X.X.msi.
Below is a snippet of the .wixproj file in its current state (I have removed some code for the sake of brevity):
<Project InitialTargets="SetVersion;BeforeBuild;CopyLinkedContentFiles">
<Import Project="Sdk.props" Sdk="WixToolset.Sdk" Version="4.0.0-rc.1" />
[...]
<Target Name="SetVersion">
<GetAssemblyIdentity AssemblyFiles="$(SolutionDir)\bin\$(Platform)\$(Configuration)\MyApp.exe">
<Output TaskParameter="Assemblies" ItemName="Assembly" />
</GetAssemblyIdentity>
<CreateProperty Value="$(SolutionName).%(Assembly.Version)">
<Output TaskParameter="Value" PropertyName="TargetName" />
</CreateProperty>
<PropertyGroup>
<DefineConstants>BuildVersion=%(Assembly.Version)</DefineConstants>
</PropertyGroup>
</Target>
<Target Name="CopyLinkedContentFiles" BeforeTargets="Build">
<Copy SourceFiles="%(Content.Identity)" DestinationFiles="%(Content.Link)" SkipUnchangedFiles="true" OverwriteReadOnlyFiles="true" Condition="'%(Content.Link)' != ''" />
</Target>
<Import Project="Sdk.targets" Sdk="WixToolset.Sdk" Version="4.0.0-rc.1" />
[...]
</Project>
The .wixproj previous had the following code to adjust the TargetName:
<Target Name="SetVersion">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\OCS.Service\</SolutionDir>
</PropertyGroup>
<GetAssemblyIdentity AssemblyFiles="$(SolutionDir)\bin\$(Platform)\$(Configuration)\MyApp.exe">
<Output TaskParameter="Assemblies" ItemName="AssemblyVersion" />
</GetAssemblyIdentity>
<PropertyGroup>
<DefineConstants>BuildVersion=%(AssemblyVersion.Version)</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<TargetName>$(SolutionName).%(AssemblyVersion.Version)</TargetName>
</PropertyGroup>
</Target>
The latter solution worked as expected prior to upgrading to v4, however, upon building the project and inspecting the output of the build, the change to the TargetName have not been applied.

How to execute MSBuild target recursively?

I attempt to execute the following target but ends up with circular dependency error. I do have a stop condition $(Value) > 0 in target Recursive:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Target Name="Recursive" Condition="$(Value) > 0">
<PropertyGroup>
<Value>$([MSBuild]::Subtract($(Value), 1))</Value>
</PropertyGroup>
<MSBuild Projects="$(MSBuildProjectFile)" Targets="Display" />
</Target>
<Target Name="Display">
<Message Text="Value: $(Value)" />
<MSBuild Projects="$(MSBuildProjectFile)" Targets="Recursive" />
</Target>
<PropertyGroup>
<Value>10</Value>
</PropertyGroup>
<Target Name="Build">
<MSBuild Projects="$(MSBuildProjectFile)" Targets="Display" />
</Target>
</Project>
Your stop condition is fine, but you forgot to pass the recalculated Value property into the next recursion. Change your Recursive target like this:
<Target Name="Recursive" Condition="$(Value) > 0">
<PropertyGroup>
<Value>$([MSBuild]::Subtract($(Value), 1))</Value>
</PropertyGroup>
<MSBuild Projects="$(MSBuildProjectFile)" Targets="Display"
Properties="Value=$(Value)" />
</Target>

Transforming multiple config files for multiple projects via MsBuildProj file

I am trying to run multiple commands on a list of files based on a pattern (all files of form *.config under sub directories of a given directory), like so:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="BuildSolution" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="TransformXml"
AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.Tasks.dll" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<TransformConfiguration>Release</TransformConfiguration>
<PublishFolder>$(OutDir)_PublishedWebsites</PublishFolder>
</PropertyGroup>
<Target Name="BuildSolution">
<MSBuild Projects="$(MSBuildProjectDirectory)\SolutionName.sln"
ContinueOnError="false"
Properties="PublishProfile=$(TransformConfiguration);DeployOnBuild=true" />
</Target>
<ItemGroup>
<ConfigFiles Include="$(PublishFolder)\**\*.config" />
</ItemGroup>
<Target Name="TransformWebConfig" AfterTargets="BuildSolution"
Condition="'#(ConfigFiles)'!=''"
Outputs="%(ConfigFiles.Identity)">
<PropertyGroup>
<ConfigFile>%(ConfigFiles.Identity)</ConfigFile>
<BackupFile>$([System.IO.Path]::ChangeExtension($(ConfigFile),".Source.config"))</BackupFile>
<TransformFile>$([System.IO.Path]::ChangeExtension($(ConfigFile),$(TransformConfiguration) + ".Source.config"))</TransformFile>
</PropertyGroup>
<Message Text="$(ConfigFile)" />
<Message Text="$(BackupFile)" />
<Message Text="$(TransformFile)" />
<Copy SourceFiles="$(ConfigFile)"
DestinationFiles="$(BackupFile)" />
<Exec Command="attrib -r $(ConfigFile)" />
<TransformXml Source="$(BackupFile)"
Transform="$(TransformFile)"
Destination="$(ConfigFile)"
StackTrace="false" />
</Target>
</Project>
However, the batch processing of the matching files is not performed.
From outputs I have added I see that the property $(PublishFolder) points to the correct directory, however, the item #(ConfigFiles) is left empty.
I also tried manually listing the directory names and configuration file names like so:
<ItemGroup>
<Sites Include="Site1" />
<Sites Include="Site2" />
</ItemGroup>
<ItemGroup>
<ConfigFiles Include="Web" />
<ConfigFiles Include="NLog" />
</ItemGroup>
<Target Name="TransformWebConfig" AfterTargets="BuildSolution">
<PropertyGroup>
<SiteConfigFile>$(PublishFolder)\%(Sites.Identity)\%(ConfigFiles.Identity)</SiteConfigFile>
</PropertyGroup>
<Message Text="$(SiteConfigFile)" />
<Copy SourceFiles="$(SiteConfigFile).config"
DestinationFiles="$(SiteConfigFile).Source.config"/>
<Exec Command="attrib -r $(SiteConfigFile).config" />
<TransformXml Source="$(SiteConfigFile).Source.config"
Transform="$(SiteConfigFile).$(TransformConfiguration).config"
Destination="$(SiteConfigFile).config"
StackTrace="false" />
</Target>
However, in this case, the transform is only applied on one file in one site.
Any idea what to do to get this working?
Similar questions and MSDN references I have gone through:
MSBUild: Copy files with a name based on the original (following a pattern)
MSBuild multiple outputpath
How to invoke the same msbuild target twice with different parameters from within msbuild project file itself
msbuild array iteration
http://msdn.microsoft.com/en-us/library/ms171454.aspx
Edit:
Moving the ItemGroup under the task enabled reading the file list after the files were created, however, now only the first file from the list is transformed:
<ItemGroup>
<ConfigFiles Include="$(PublishFolder)\**\Web.config;$(PublishFolder)\**\NLog.config"
Exclude="$(PublishFolder)\**\Packages.config;$(PublishFolder)\**\*.*.config;$(PublishFolder)\**\bin\*.config" />
</ItemGroup>
<PropertyGroup>
<ConfigFile>%(ConfigFiles.Identity)</ConfigFile>
<BackupFile>$([System.IO.Path]::ChangeExtension($(ConfigFile),".Source.config"))</BackupFile>
<TransformFilePrefix>$([System.String]::Concat($(TransformConfiguration), ".config"))</TransformFilePrefix>
<TransformFile>$([System.IO.Path]::ChangeExtension($(ConfigFile), $(TransformFilePrefix)))</TransformFile>
</PropertyGroup>
<Message Text="$(PublishFolder)" />
<Message Text="#(ConfigFiles)" />
<Message Text="$(ConfigFile)" />
<Message Text="$(BackupFile)" />
<Message Text="$(TransformFile)" />
<Copy SourceFiles="$(ConfigFile)"
DestinationFiles="$(BackupFile)" />
<Exec Command="attrib -r $(ConfigFile)" />
<TransformXml Source="$(BackupFile)"
Transform="$(TransformFile)"
Destination="$(ConfigFile)"
StackTrace="false" />
Found the solution:
Create one target for creating the item group:
<Target Name="ListWebConfigs" AfterTargets="BuildSolution">
<ItemGroup>
<ConfigFiles Include="$(PublishFolder)\**\Web.config;$(PublishFolder)\**\NLog.config"
Exclude="$(PublishFolder)\**\Packages.config;$(PublishFolder)\**\*.*.config;$(PublishFolder)\**\bin\*.config" />
</ItemGroup>
<Message Text="$(PublishFolder)" />
<Message Text="#(ConfigFiles)" />
</Target>
Then another for the actual transforms:
<!-- \x to prevent MSBuild from skipping "because all output files are up-to-date" -->
<Target Name="TransformWebConfig" AfterTargets="ListWebConfigs" Inputs="#(ConfigFiles)" Outputs="%(ConfigFiles.Identity)\x">
<PropertyGroup>
<ConfigFile>%(ConfigFiles.Identity)</ConfigFile>
<BackupFile>$([System.IO.Path]::ChangeExtension($(ConfigFile),".Source.config"))</BackupFile>
<TransformFilePrefix>$([System.String]::Concat($(TransformConfiguration), ".config"))</TransformFilePrefix>
<TransformFile>$([System.IO.Path]::ChangeExtension($(ConfigFile), $(TransformFilePrefix)))</TransformFile>
</PropertyGroup>
<Message Text="$(PublishFolder)" />
<Message Text="#(ConfigFiles)" />
<Message Text="$(ConfigFile)" />
<Message Text="$(BackupFile)" />
<Message Text="$(TransformFile)" />
<Copy SourceFiles="$(ConfigFile)" DestinationFiles="$(BackupFile)" />
<Exec Command="attrib -r $(ConfigFile)" />
<TransformXml Source="$(BackupFile)"
Transform="$(TransformFile)"
Destination="$(ConfigFile)"
StackTrace="false" />
</Target>

MSBuild Expansion Pack: AssemblyInfo - Not behaving as expected

I am trying to get MSBuild to automatically update a project's AssemblyVersion and AssemblyFileVersion.
Specifically, just the build and revision number.
So, if my source file starts out as
[assembly: AssemblyVersion("1.2.3.4")]
and my build and revision numbers are 13 and 14, I want this to become:
[assembly: AssemblyVersion("1.2.13.14")]
However, I am not getting the expected outcome. Instead, I am getting something like this - presumably because it is the 28th of November at the time I did the build.
[assembly: AssemblyVersion("1.0.1128.01")]
Relevant info from my .csproj file below.
<Import Project="$(MSBuildExtensionsPath64)\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks"/>
<Import Project="$(MSBuildExtensionsPath64)\ExtensionPack\4.0\MSBuild.ExtensionPack.VersionNumber.targets"/>
<PropertyGroup>
<BuildDependsOn>
AssemblyVersion;
$(BuildDependsOn)
</BuildDependsOn>
</PropertyGroup>
<ItemGroup>
<AssemblyVersionFiles Include="$(MSBuildProjectDirectory)\Properties\AssemblyInfo.cs"/>
</ItemGroup>
<Target Name="AssemblyVersion" Inputs="#(AssemblyVersionFiles)" Outputs="UpdatedAssemblyVersionFiles">
<Message Text="Setting AssemblyVersion..." Importance="High" />
<AssemblyInfo
AssemblyInfoFiles="%(AssemblyVersionFiles.FullPath)"
AssemblyBuildNumber="12"
AssemblyBuildNumberType="NoIncrement"
AssemblyRevision="13"
AssemblyRevisionType="NoIncrement"
/>
</Target>
At this point I'm just about ready to scrap the extensions altogether, split my assembly and file versions out into two separate files, and use powershell to read and overwrite their values. Might be a more desireable solution as it'll only be able to take place on the build machine so I won't have to worry about developers getting odd build results if they don't have the expansion pack installed.
Still, I don't like to be beaten, so I'd love to find out how to make this work.
Any thoughts?
Full .csproj file below:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{452FDE9A-EAFE-44EF-A7AD-34F287AE1664}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AssemblyInfoTest</RootNamespace>
<AssemblyName>AssemblyInfoTest</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!--<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>-->
<Import Project="$(MSBuildExtensionsPath64)\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks"/>
<Import Project="$(MSBuildExtensionsPath64)\ExtensionPack\4.0\MSBuild.ExtensionPack.VersionNumber.targets"/>
<PropertyGroup>
<BuildDependsOn>
AssemblyVersion;
$(BuildDependsOn)
</BuildDependsOn>
</PropertyGroup>
<ItemGroup>
<AssemblyVersionFiles Include="$(MSBuildProjectDirectory)\Properties\AssemblyInfo.cs"/>
</ItemGroup>
<Target Name="AssemblyVersion" Inputs="#(AssemblyVersionFiles)" Outputs="UpdatedAssemblyVersionFiles">
<Message Text="Setting AssemblyVersion..." Importance="High" />
<AssemblyInfo
SkipVersioning="true"
AssemblyInfoFiles="%(AssemblyVersionFiles.FullPath)"
AssemblyBuildNumber="12"
AssemblyBuildNumberType="NoIncrement"
AssemblyRevision="13"
AssemblyRevisionType="NoIncrement"
/>
</Target>
</Project>
Answer to this questions was: Scrap the extensions, use a powershell script to update the AssemblyInfo file directly before the build as part of CI.
Pity. Would have liked to get this working from the ground up. But the extensions just weren't worth the effort of bashing my head against them to make them work.

How to add content from a target in a csproj file?

I would like to add content to my web application depending on the configuration. I have declared the target in the initials target and the target looks like this :
<Target Name="ApplicationNameDefinition" Outputs="$(MashupName)">
<MSBuild.ExtensionPack.Framework.TextString TaskAction="StartsWith" String1="$(ConfigurationName)" String2="Config1">
<Output TaskParameter="Result" PropertyName="isConfig1" />
</MSBuild.ExtensionPack.Framework.TextString>
<MSBuild.ExtensionPack.Framework.TextString TaskAction="StartsWith" String1="$(ConfigurationName)" String2="Config2">
<Output TaskParameter="Result" PropertyName="isConfig2" />
</MSBuild.ExtensionPack.Framework.TextString>
<MSBuild.ExtensionPack.Framework.TextString TaskAction="StartsWith" String1="$(ConfigurationName)" String2="Config3">
<Output TaskParameter="Result" PropertyName="isConfig3" />
</MSBuild.ExtensionPack.Framework.TextString>
<MSBuild.ExtensionPack.Framework.TextString TaskAction="StartsWith" String1="$(ConfigurationName)" String2="Config4">
<Output TaskParameter="Result" PropertyName="isConfig4" />
</MSBuild.ExtensionPack.Framework.TextString>
<Error Condition=" !$(isConfig1) And !$(isConfig2) And !$(isConfig3) And !$(isConfig4) " Text="Configuration $(ConfigurationName) Inconnue" />
<PropertyGroup>
<MashupName Condition="$(isConfig1)">App1</MashupName>
<MashupName Condition="$(isConfig2)">App2</MashupName>
<MashupName Condition="$(isConfig3)">App3</MashupName>
<MashupName Condition="$(isConfig4)">App4</MashupName>
</PropertyGroup>
<Error Condition="'$(MashupName)'==''" Text="Configuration $(MashupName) Inconnue" />
<ItemGroup >
<Content Condition=" '$(MashupName)'!='' " Include="App_Themes\$(MashupName)\**" />
</ItemGroup>
However, the content is not added to the project. Any Idea ?
Thanks.
Actually this works in msbuild, but not in Visual Studio which has some cache with csproj files...