CopyAllFilesToSingleFolderForPackageDependsOn no longer supported by vs12 - asp.net-mvc-3

I am using the visual studio 2012 package feature for websites, and I have a custom target to collect some sub folders into the package destination prior to zipping the folder..
This used to work well in vs10 but with the new packager vs12 it not longer cares about any of these configurations and they haven't been migrated correctly
any way to do something similar so my package will eventually have these files?
This is what it used to look like in vs10:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<!-- Begin copy Contracts &Provider directories -->
<CopyAllFilesToSingleFolderForPackageDependsOn>
CustomCollectFiles;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForPackageDependsOn>
<DesktopBuildPackageLocation>..\Package\Release\projectname.zip</DesktopBuildPackageLocation>
<DeployIisAppPath>projectname</DeployIisAppPath>
<!-- End copy Contracts &Provider directories -->
</PropertyGroup>
<Target Name="CustomCollectFiles">
<ItemGroup>
<_CustomFiles Include="$(OutputPath)\Contracts\**\*" />
<FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
<DestinationRelativePath>bin\Contracts\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
<ItemGroup>
<_CustomFiles Include="$(OutputPath)\Providers\**\*" />
<FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
<DestinationRelativePath>bin\Providers\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
This is completely ignored in the new project. What's a good method to do something similar?

Found a solution, just rename CopyAllFilesToSingleFolderForPackageDependsOn to CopyAllFilesToSingleFolderForMsdeployDependsOn and the files should be included in the deployment package.
BTW this still isnt the best solution since you need to maintain both to support vs12 & vs 10

Yet another approach which also works and requires less maintenance..
<Target Name="CustomFolderDeploy" AfterTargets="CopyAllFilesToSingleFolderForPackage" BeforeTargets="MSDeployPublish">
<PropertyGroup>
<CustomFolder>$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\..\..\..\Lib\CustomFolder'))</CustomFolder>
</PropertyGroup>
<CreateItem Include="$(CustomFolder)\*.*">
<Output TaskParameter="Include" ItemName="CustomFiles" />
</CreateItem>
<Copy SourceFiles="#(CustomFiles)" DestinationFolder="$(MSBuildProjectDirectory)\obj\$(Configuration)\Package\PackageTmp\bin" SkipUnchangedFiles="True" ContinueOnError="False" />
</Target>

Related

How to set variables and properties that could be made configurable using the Project Properties' UI in Visual Studio, for a wix setup project?

I am working on WiX Setup V3 project in Visual Studio 2019. I have to make this working in Visual Studio as well as from MSBuild (in Jenkins). I have authored custom target file which will be included in this project. Following is the markup of the custom target file. I cannot use the HeatDirectory task, since it lacks some flags like svb6. Hence I am using Exec command for Heat execution.
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<DefineConstants>HeatFldrPath=$(FilePath);ProductVersion=$(PVersion);BuildNumber=$(BldNum)</DefineConstants>
<OutputName>$(MSIName)</OutputName>
<OutputPath>$(MSIPath)</OutputPath>
<SuppressPdbOutput>True</SuppressPdbOutput>
</PropertyGroup>
<PropertyGroup>
<WixBinPath>$(SolutionDir)\Build\wix\</WixBinPath>
<WixToolPath>$(WixBinPath)\</WixToolPath>
<WixTargetsPath>$(WixToolPath)Wix.targets</WixTargetsPath>
<WixTasksPath>$(WixToolPath)wixtasks.dll</WixTasksPath>
</PropertyGroup>
<ItemGroup>
<WixExtension Include="WixUtilExtension">
<HintPath>lib\WixUtilExtension.dll</HintPath>
<Name>WixUtilExtension</Name>
</WixExtension>
<WixExtension Include="WixUIExtension">
<HintPath>lib\WixUIExtension.dll</HintPath>
<Name>WixUIExtension</Name>
</WixExtension>
<WixExtension Include="WixMsmqExtension">
<HintPath>lib\WixMsmqExtension.dll</HintPath>
<Name>WixMsmqExtension</Name>
</WixExtension>
<WixExtension Include="WixIIsExtension">
<HintPath>lib\WixIIsExtension.dll</HintPath>
<Name>WixIIsExtension</Name>
</WixExtension>
</ItemGroup>
<Target Name="HeatTarget" BeforeTargets="Build">
<Exec Command='"$(WixToolPath)\heat.exe" dir $(HeatFldrPath) -cg UserFeatureFiles -dr APP_DIR -gg -g1 -sfrag -sw -svb6 -srd -sreg -ke -var var.HeatFldrPath -out "Content\UserFiles.wxs"' />
</Target>
</Project>
I need to make this configurable for the following parameters:
Product Version (for use in Candle command)
Build Number (This will be added to the Product Version)
Heat Directory Path
MSI Name (This will have Version along with Build Number concatenated
to it)
MSI Path (I don't want this to be bin\$(Configuration)\en-us, rather
a custom directory I specify)
My custom targets file will be imported to the .wixproj file and nothing else will be changed in the .wixproj file.
If I use DefineConstants in my custom targets file, it works with MSBuild, but not with Visual Studio. I am having a hard time passing these as parameters and getting my MSI to build from both Visual Studio and MSBuild. I tried passing $(FilePath), $(PVersion) and $(BldNum) from project properties, but no luck. I cannot hard code these values in .targets or .wixproj file, since they have to be run from both Visual Studio and MSBuild. Also, I am not able to pass OutputName and OutputPath from Visual Studio. Can anyone please help me?
PFB the wixproj file.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build"
InitialTargets="EnsureWixToolsetInstalled"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == ''
">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>3.10</ProductVersion>
<ProjectGuid>{9ecbe76b-ecc4-4a17-bc8b-f2224421f616}</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>My.Custom.MSI</OutputName>
<OutputType>Package</OutputType>
<PublishDir>..\HeatFolder</PublishDir>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' ==
'Debug|x86' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug;HeatFldrPath=$(PublishDir)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' ==
'Release|x86' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<WixVariables>$(FilePath)=$(ProjectDir)HeatFolder;$(PVersion)="1.1.0.1"
</WixVariables>
<DefineConstants>HeatFldrPath=$(FilePath);ProductVersion=1.1.0.1;BuildNumber=$
(BldNum)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Full-
Release|x86' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Release;HeatFldrPath=$(PublishDir)</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="Content\GlobalCustomActions.wxs" />
<Compile Include="Content\GlobalExitDlg.wxs" />
<Compile Include="Content\GlobalFatalError.wxs" />
<Compile Include="Content\GlobalInstallDlg.wxs" />
<Compile Include="Content\GlobalLicenseAgreementDlg.wxs" />
<Compile Include="Content\GlobalSetupFolderDlg.wxs" />
<Compile Include="Content\GlobalWelcomeDlg.wxs" />
<Compile Include="Content\GlobalWixUI.wxs" />
<Compile Include="Content\Product.wxs" />
<Compile Include="Content\UserFiles.wxs" />
<Compile Include="Content\UserIIS.wxs" />
<Compile Include="Content\UserRegistry.wxs" />
</ItemGroup>
<ItemGroup>
<Folder Include="conf\" />
<Folder Include="Content\" />
<Folder Include="Images\" />
<Folder Include="lib\" />
</ItemGroup>
<ItemGroup>
<Content Include="AppPoolAttrs.xml" />
<Content Include="AppPoolUpgradeChanges.xml" />
<Content Include="conf\default.yml" />
<Content Include="Content\CustomActions.CA.dll" />
<Content Include="Content\GlobalProperties.wxi" />
<Content Include="Content\License.en-us.rtf" />
<Content Include="CustomWix.targets" />
<Content Include="Images\Banner.bmp" />
<Content Include="Images\DEST.ICO" />
<Content Include="Images\dialog.bmp" />
<Content Include="Images\dialog_cust.bmp" />
<Content Include="Images\dialog_template.bmp" />
<Content Include="Images\Exclam.ico" />
<Content Include="Images\folder.ico" />
<Content Include="Images\folderNew.ico" />
<Content Include="Images\New.ico" />
<Content Include="Images\warn.ico" />
<Content Include="lib\WixIIsExtension.dll" />
<Content Include="lib\WixMsmqExtension.dll" />
<Content Include="lib\WixUIExtension.dll" />
<Content Include="lib\WixUtilExtension.dll" />
<Content Include="packages.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Content\en-us.wxl" />
</ItemGroup>
<Import Project="CustomWiX.Targets"
Condition="Exists('CustomWiX.targets')" />
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)'
!= '' " />
<Import
Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets"
Condition=" '$(WixTargetsPath)' == '' AND
Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets')
" />
<Target Name="EnsureWixToolsetInstalled" Condition="
'$(WixTargetsImported)' != 'true' ">
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be
installed to build this project. To download the WiX Toolset, see
http://wixtoolset.org/releases/" />
</Target>
</Project>
I tried passing $(FilePath), $(PVersion) and $(BldNum) from project
properties, but no luck. I cannot hard code these values in .targets
or .wixproj file, since they have to be run from both Visual Studio
and MSBuild. Also, I am not able to pass OutputName and OutputPath
from Visual Studio.
The main issue is that when you set the variables in Project Properties UI, the values can only pass to the variables in the xxx.wixproj rather than CustomWiX.Targets file.
And this approach is local (modify only the properties of the xxx.wixproj file, which still be overridden by the custom target values).
In more detail, when it reloads the xxxx.wixproj which contains the custom target file, MSBuild will load the xml nodes line by line, since MSBuild properties support forward override values. Simply said, if the same value is defined later, the previous value is overwritten. And the same properties are defined in the custom target file which is imported under the those properties, so the properties in the custom targets file will always override the properties.
Besides, when you pass some variables in the project Properties UI, the values will overwrite the values in the xxx.wixprojrather than custom targets file. And then when you build again, the values in custom targets will still override the values you modified in project properties, so it won't work.
Differ from VS IDE, the msbuild command line can override the value with -p: XXX (property name)= XXXXXX, which is global, so this problem does not occur.
Suggestion
1) If you still want to modify those properties by overriding the value of the project properties, remove the same properties from the custom targets file and move them to wixproj so that they can be used directly.
2) Since the custom target file always overwrites the same properties, you can modify the specific properties directly in the custom target file without having to modify the wixproj file directly.
Update1
The wixvariables(Properties-->Build-->Define Variables) does not work in the xxxx.wixproj file but only for wix file like Product.wxsfile. If you define the property $(Filepath) in the Define Variables, it will never be used for MSBuild. So there is no way to set the properties in Property UI for msbuild Properties.
Besides, $ is used to call a property of MSBuild and MSBuild define a property only under PropertyGroup of xxx.xxxproj like <PropertyGroup><FilePath> xxx</FilePath><\PropertyGroup>.
Solution
You can customize your build by using Directory.Build.targets and remember keeping the name as the document said which is designed by that with the effect. Then you should put this file under the solution folder so that it can work for all the projects.xxx.props file will import on the top of the xxxx.xxproj, so it can not override the values and only the Directory.Build.targets which is imported at the bottom of the xx.xxproj file does.
Then you can define the variables in the file like:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<FilePath>xxxxx</FilePath>
</ProperGroup>
.........
</Project>
Hope it could help you.

msbuild unable to find files in my Assets folder

I am trying to build my first uwp application. I am new to c# as well. I am using visual studio build tools 2019. I think I have done everything right but when I run msbuild, I get the following error:
"C:\Projects\C\UapHello\uaphello.csproj" (default target) (1) ->
(_ValidateAppxPackage target) ->
Package.appxmanifest(41,9): error APPX0703: Manifest references file 'Assets\Square150x150Logo.png' which is not part
of the payload. [C:\Projects\C\UapHello\uaphello.csproj]
Package.appxmanifest(42,9): error APPX0703: Manifest references file 'Assets\Square44x44Logo.png' which is not part o
f the payload. [C:\Projects\C\UapHello\uaphello.csproj]
Package.appxmanifest(27,6): error APPX0703: Manifest references file 'StoreLogo.png' which is not part of the payload
. [C:\Projects\C\UapHello\uaphello.csproj]
Package.appxmanifest(45,27): error APPX0703: Manifest references file 'Assets\SplashScreen.png' which is not part of
the payload. [C:\Projects\C\UapHello\uaphello.csproj]
I am pretty sure these files exist in said folder.
I am including my csproj and appmanifest:
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"
xmlns:desktop4="http://schemas.microsoft.com/appx/manifest/desktop/windows10/4"
xmlns:iot2="http://schemas.microsoft.com/appx/manifest/iot/windows10/2"
IgnorableNamespaces="uap mp uap5 iot2 desktop4">
<Identity
Name="IggyMakesThings"
Publisher="CN=IggyMakesThings, O=IggyMakesThings, L=Redmond, S=Washington, C=US"
Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="11a54d62-0d60-4e17-820d-1fa537715b3a" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.17763.0" />
</Dependencies>
<Properties>
<DisplayName>uaphello</DisplayName>
<PublisherDisplayName>IggyMakesThings</PublisherDisplayName>
<Logo>StoreLogo.png</Logo>
</Properties>
<Resources>
<Resource Language="x-generate"/>
</Resources>
<Applications>
<Application Id="App"
Executable="uaphello.exe"
EntryPoint="UAPHello.App">
<uap:VisualElements
DisplayName="UAPSample"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png"
Description="UAP C# Sample"
BackgroundColor="#000000">
<uap:SplashScreen Image="Assets\SplashScreen.png" />
<uap:DefaultTile>
<uap:ShowNameOnTiles>
<uap:ShowOn Tile="square150x150Logo" />
</uap:ShowNameOnTiles>
</uap:DefaultTile>
</uap:VisualElements>
</Application>
</Applications>
</Package>
And csproj:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">Win32</Platform>
<ProjectGuid>{$guid1$}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<RootNamespace>uaphello</RootNamespace>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.17763.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
</PropertyGroup>
<PropertyGroup>
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<PlatformTarget>x64</PlatformTarget>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'">
<PlatformTarget>x86</PlatformTarget>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.2.8" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
</Project>
Please help
I think something missing in your .csproj file caused this issue.
Steps to reproduce same issue:
1.Create a new Blank App(Universal Windows)
2.In VS, for those .png resources:Exclude from the project
3.Copy the solution to build server where only has build tools
4.Restore the nuget packages and build the project with command like:
msbuild path/xxx.csproj(or xxx.sln) /p:Platform=X64 /p:AppxBundle=Always
5.Get the error below:
You can follow my simple steps to locate the cause of the issue.
In my opinion:
You might do some similar operation like mine. Maybe Exclude from Project, maybe delete the ItemGroup content in xx.csproj file, or what.
The result is deleting the ItemGroup for those .png files in xx.csproj. If you create a new Blank App(UWP), and check its content of .csproj file you would see:
<ItemGroup>
<Content Include="Properties\Default.rd.xml" />
<Content Include="Assets\LockScreenLogo.scale-200.png" />
<Content Include="Assets\SplashScreen.scale-200.png" />
<Content Include="Assets\Square150x150Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Assets\StoreLogo.png" />
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
</ItemGroup>
But these content is missing in your .csproj file.
These four files which are used in your appmanifest are indeed in your asserts folder.
But without the content ref in .csproj file, the build process can't find them properly.Square150x150Logo.png,Square44x44Logo.png,StoreLogo.png,SplashScreen.png
As a workaround:
So you can edit your xx.csproj file, and add the ItemGroup into it.
But I'm not certainly sure it will work. Since after my checking your .csproj file. Maybe the .png files are not the only things you excluded or removed!!
I'm not sure how many changes you've made to the project, so if above not helps, just create a new project and copy your core code into the new project.

Need help in understanding CustomFilesToInclude property in MSbuild

I have a issue in copying html files to deploy location using MSBuild.
Please help me in understanding the following:
<Target Name="CustomCollectFiles">
<ItemGroup>
<FilesForPackagingFromProject Include="#(CustomFilesToInclude)">
<DestinationRelativePath>%(CustomFilesToInclude.Dir)\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
<Target Name="CustomCollectFiles">
<ItemGroup>
<FilesForPackagingFromProject Include="#(CustomFilesToInclude)">
<DestinationRelativePath>%(CustomFilesToInclude.Dir)\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
<FilesForPackagingFromProject Include="#(CustomFilesToIncludeSkipExistingCheck)">
<DestinationRelativePath>%(CustomFilesToIncludeSkipExistingCheck.Dir)\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
<Error Text="Custom file exists in project files already: %(CustomFilesToInclude.FullPath)"
Condition="Exists('$(MainProjectRootDir)\%(CustomFilesToInclude.Dir)\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<PropertyGroup>
<CopyAllFilesToSingleFolderForPackageDependsOn>
DefineCustomFiles;
CustomCollectFiles;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForPackageDependsOn>
</PropertyGroup>
I've never used MSDeploy.
But I'd say it just adds DestinationRelativePath metadata to item and injects targets DefineCustomFiles and CustomCollectFiles to be called before existing CopyAllFilesToSingleFolderForPackageDependsOn targets.
I see it can be used by Microsoft.Web.Publishing.targets.
The code sample you've provided is not complete to say what's going on.
It looks like this: http://sedodream.com/2010/03/10/WebDeploymentToolIncludingOtherFiles.aspx

Issue applying a manifest to a wix generated msi using mt.exe

I'm trying to apply a manifest to a WiX generated msi to create an exe that will immediately display a UAC prompt upon running the installer. Unfortunately I'm getting the following error upon building my installer project:
Values of attribute "level" not equal in different manifest snippets. mt.exe
I need to elevate the execution to allow custom actions that run during InstallUISequence to have admin privileges (to look up IIS app pools and web apps). I'm using Visual Studio 2012 on Windows 8.
Below is my wixproj file which shows my bootstrapper setup:
<?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>3.5</ProductVersion>
<ProjectGuid>{d51029e8-4a79-4812-96e1-bf6b600d5d34}</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>WixInstallerExampleWebInstaller</OutputName>
<OutputType>Package</OutputType>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<ItemGroup>
<Compile Include="IisSettingsDlg.wxs" />
<Compile Include="Product.wxs" />
<Compile Include="UserInterface.wxs" />
<Compile Include="WixInstallerExampleWeb.wxs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\WixInstallerExampleWeb\WixInstallerExampleWeb.csproj">
<Name>WixInstallerExampleWeb</Name>
<Project>{d23a374d-764c-40ba-b566-4d7c55319236}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLLOCATION</RefTargetDir>
<PackageThisProject>True</PackageThisProject>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<WixExtension Include="WixUtilExtension">
<HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath>
<Name>WixUtilExtension</Name>
</WixExtension>
<WixExtension Include="WixNetFxExtension">
<HintPath>$(WixExtDir)\WixNetFxExtension.dll</HintPath>
<Name>WixNetFxExtension</Name>
</WixExtension>
<WixExtension Include="WixIIsExtension">
<HintPath>$(WixExtDir)\WixIIsExtension.dll</HintPath>
<Name>WixIIsExtension</Name>
</WixExtension>
<WixExtension Include="WixUIExtension">
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
<Name>WixUIExtension</Name>
</WixExtension>
</ItemGroup>
<ItemGroup>
<Content Include="EULA.rtf" />
<Content Include="IisManager.CA.dll" />
<Content Include="uac.manifest" />
</ItemGroup>
<ItemGroup>
<BootstrapperFile Include="Microsoft.Windows.Installer.3.1" >
<ProductName>Windows Installer 3.1</ProductName>
</BootstrapperFile>
</ItemGroup>
<Import Project="$(WixTargetsPath)" />
<Target Name="Bootstrapper"
Inputs="$(OutDir)$(TargetFileName)"
Outputs="$(OutDir)\Setup.exe"
Condition=" '$(OutputType)'=='package' " >
<GenerateBootstrapper ApplicationName="application name"
ApplicationFile="$(TargetFileName)"
BootstrapperItems="#(BootstrapperFile)"
ComponentsLocation="Relative"
OutputPath="$(OutputPath)"
Culture="en-US"
Path="C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bootstrapper" />
</Target>
<Target Name="PatchSetupExe" DependsOnTargets="Bootstrapper">
<Exec Command='"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\bin\mt.exe" -manifest "$(ProjectDir)uac.manifest" -updateresource:"$(ProjectDir)$(OutputPath)Setup.exe;#1"' IgnoreExitCode='false' />
</Target>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets" />
<PropertyGroup>
<BuildDependsOn>$(BuildDependsOn);Bootstrapper;PatchSetupExe</BuildDependsOn>
</PropertyGroup>
<Target Name="BeforeBuild">
<MSBuild Projects="%(ProjectReference.FullPath)" Targets="Package" Properties="Configuration=$(Configuration);Platform=AnyCPU" Condition="'%(ProjectReference.PackageThisProject)'=='True'" />
<Copy SourceFiles="%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\TransformWebConfig\transformed\web.config" OverwriteReadOnlyFiles="true" DestinationFolder="%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\" Condition="'%(ProjectReference.PackageThisProject)'=='True'" />
<PropertyGroup>
<LinkerBaseInputPaths>%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\</LinkerBaseInputPaths>
<DefineConstants>BasePath=%(ProjectReference.RootDir)%(ProjectReference.Directory);</DefineConstants>
</PropertyGroup>
<HeatDirectory OutputFile="%(ProjectReference.Filename).wxs" Directory="%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\" DirectoryRefId="INSTALLLOCATION" ComponentGroupName="%(ProjectReference.Filename)_Project" SuppressCom="true" SuppressFragments="true" SuppressRegistry="true" SuppressRootDirectory="true" AutoGenerateGuids="false" GenerateGuidsNow="true" ToolPath="$(WixToolPath)" Condition="'%(ProjectReference.PackageThisProject)'=='True'" PreprocessorVariable="var.BasePath" />
</Target>
<PropertyGroup>
<PreBuildEvent />
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent />
</PropertyGroup>
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Wix.targets.
<Target Name="AfterBuild">
</Target>
-->
</Project>
And here is my manifest file I'm trying to apply:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="Setup" type="win32" />
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
I found one solution. Download Resource Hacker. Open your resulting executable file and browse it until you find your manifest file. You can edit it diretly in UI or you can script it in command line:
ResHacker.exe -modify old.exe,new.exe,manifestToUse.manifest,ROOTNODE,SUBNODE*
*Those NODEs are the path corresponding with resource (manifest) you are trying to update - it is the path in tree in Resource Hacker UI.
Another Hack is to modify the manifest information of the burn.exe of WiX. But this seems to be a very bad solution and I am not sure if there are any side effects. But in my case I could solve it that way because in my build process I use the WiX binaries (not the WiX setup) within my source control version system which then will not affect any other WiX projects on my machine.
I used Visual Studio´s Resource Editor to edit the manifest of burn.exe.

Quick way to determine which projects in a VS solution target a specific version?

I have a visual studio solution with a large number of projects in it, some of which target .NET v2.0, and some of which target v3.5.
I know I can right click on each project in turn to see which version it targets, but this would take for ever.
Does anyone know a quicker way I can determine which projects target v2.0 and which target v3.5?
EDIT:
I was hoping to be able to use the TargetFrameworkVersion node to determine the version, but some of the project files don't have this node, e.g.
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{E11A268C-9F62-4970-9338-129C35AD2354}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BusinessEntities</RootNamespace>
<AssemblyName>Business Entities</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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|AnyCPU' ">
<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.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="SomeClass.cs" />
<Compile Include="SomeOtherClass.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
...but if I right click on the project in VS, it says that the target version is .NET v2.0. Also just to be clear, I need to repeat this process for a number of solutions, so doing it the manual way is a really undesirable option.
Thanks
There is a link might be helpful.
You have to write your own code to parse project files to get the framework versions.
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
The other option is to use command line for the solution folder.
Use MS DOS command:
findstr "<TargetFrameworkVersion>" *.csproj
The result will be displayed on the screen.
UPDATE:
Because older progjects don't contain this line. We can use another command, which search files don't contain the line.
findstr /v "<TargetFrameworkVersion>" *.csproj

Resources