I installed the VS2010 web publishing updates yesterday, and now whenever I try to load a WiX setup project (all showing as unloaded in solution explorer) I'm getting the error:
The imported project "PROJECTNAME.wpp.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.5\Web\Microsoft.Web.Publishing.targets
Where PROJECTNAME is the path to my setup wixproj file, without the .wixproj extension. I've checked through the project file and there is no reference to a wpp.targets file anywhere. I decided to try and create a blank targets file in that location and so added one with just this in it:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>
But got exactly the same error - a not found exception despite the file being there!
I then dug into the Microsoft.Web.Publishing.targets file and had a look for any ".wpp.targets" text, which gave me this:
<PropertyGroup Condition="'$(EnableWebPublishProfileFile)'=='true' And
'$(WebPublishProfileFile)' != '' And Exists($(WebPublishProfileFile)) ">
<WebPublishProfileCustomizeTargetFile Condition="'$(WebPublishProfileCustomizeTargetFile)'==''">
$([System.IO.Path]::ChangeExtension($(WebPublishProfileFile), '.wpp.targets'))
</WebPublishProfileCustomizeTargetFile>
...
So that looks to be setting up a filename of PROJECTNAME.wpp.targets, but only when the EnableWebPublishProfileFile property is set to true. I added this to my wixproj file's main propertygroup:
<EnableWebPublishProfileFile>False</EnableWebPublishProfileFile>
Again though, it made no difference at all to the error. I'm running out of ideas here now!
Further update
I've been trying to repo this on a blank project (so far without success), and the messing about has narrowed the error down to this line (186) in the Microsoft.Web.Publishing.targets file:
<Import Project="$(WebPublishPipelineCustomizeTargetFile)"
Condition="'$(WebPublishPipelineCustomizeTargetFile)' != ''"/>
This is set at the top of the file:
<WebPublishPipelineCustomizeTargetFile
Condition="'$(WebPublishPipelineCustomizeTargetFile)'==''">
$(WebPublishPipelineProjectDirectory)\*.wpp.targets
</WebPublishPipelineCustomizeTargetFile>
I'm not sure how this is getting changed to PROJECTNAME.wpp.targets though?
I tried overriding this in my project file, but once again, it makes no difference at all.
Next I added an Exists() condition to the line in the targets file, now some projects are working and others are not, instead failing (on build) with the error:
The "DisableEscapeMSBuildVariable" parameter is not supported by the "ImportParametersFile" task. Verify the parameter exists on the task, and it is a settable public instance property.
My journey continues...
I experienced the same issue when trying to open a standard web project.
The proj file was referencing the following import for v10.0 targets but throwing the import error in the question which referred to v10.5 targets.
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets" />
The same was true when I referenced a hard coded path - I still got v10.5 error
My solution was to simply back up and remove that version located at:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\10.5
I'm really not sure what other programs and projects need this version or why import paths were not followed but it go this project open for me seeming falling back to the correct version.
Related
While trying to compile a Xamarin Forms (2.3.4.247) project on Visual Studio for Mac Community (7.0.1 [build 24]) I keep getting the two following errors after coding some time, any clue on what caused it and how to fix it?
/Users/PathToProjectRoot/packages/Xamarin.Forms.2.3.4.247/build/portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20/Xamarin.Forms.targets(3,3): Error MSB4061: The "XamlCTask" task could not be instantiated from "/Users/PathToProjectRoot/packages/Xamarin.Forms.2.3.4.247/build/portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20/Xamarin.Forms.Build.Tasks.dll". Could not load file or assembly 'Xamarin.Forms.Build.Tasks' or one of its dependencies (MSB4061) (ProjectName)
/Users/PathToProjectRoot/packages/Xamarin.Forms.2.3.4.247/build/portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20/Xamarin.Forms.targets(3,3): Error MSB4060: The "XamlCTask" task has been declared or used incorrectly, or failed during construction. Check the spelling of the task name and the assembly name. (MSB4060) (ProjectName)
What I have tried
Updated all packages and and SDKs.
Cleaned/Rebuild solution.
Removed all packages, closed VS, reopened and got all packages restored.
Removed all the bin and obj folders to try a rebuild.
Check the 3 .csproj for any outdated imports previous to 2.3.4.247.
Create a new solution.
What has worked
Creating a new clean solution using Xamarin Forms works however this causes all the packages to be from an old version. I've already done this twice but I'd like to be able to stop doing this as it takes a crazy amount of time to transfer all files from the broken project to the new one.
What hasn't worked
Besides all the things I've tried, it may be useful to mention that creating a new project after having cleared all the previous ones within the same solution doesn't fix the issue.
This makes me think that it is a solution-level error rather than a project-level error.
What packages are installed
Xamarin.Android.Support.Animated.Vector.Drawable.25.3.1
Xamarin.Android.Support.Annotations.25.3.1
Xamarin.Android.Support.Compat.25.3.1
Xamarin.Android.Support.Core.UI.25.3.1
Xamarin.Android.Support.Core.Utils.25.3.1
Xamarin.Android.Support.Design.25.3.1
Xamarin.Android.Support.Fragment.25.3.1
Xamarin.Android.Support.Media.Compat.25.3.1
Xamarin.Android.Support.Transition.25.3.1
Xamarin.Android.Support.Vector.Drawable.25.3.1
Xamarin.Android.Support.v4.25.3.1
Xamarin.Android.Support.v7.AppCompat.25.3.1
Xamarin.Android.Support.v7.CardView.25.3.1
Xamarin.Android.Support.v7.MediaRouter.25.3.1
Xamarin.Android.Support.v7.Palette.25.3.1
Xamarin.Android.Support.v7.RecyclerView.25.3.1
Xamarin.Build.Download.0.4.5
Xamarin.Forms.2.3.4.247
What Android platforms are installed
android-23
android-25
What file causes the errors
Error is caused by the file Xamarin.Forms.targets containing the following lines:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="Xamarin.Forms.Build.Tasks.XamlGTask" AssemblyFile="Xamarin.Forms.Build.Tasks.dll"/>
<UsingTask TaskName="Xamarin.Forms.Build.Tasks.FixedCreateCSharpManifestResourceName" AssemblyFile="Xamarin.Forms.Build.Tasks.dll"/>
<UsingTask TaskName="Xamarin.Forms.Build.Tasks.XamlCTask" AssemblyFile="Xamarin.Forms.Build.Tasks.dll"/>
<!-- Some more lines here ... -->
<Target Name="XamlC">
<!-- /!\ Error flagged at next line's "<" -->
<XamlCTask
Assembly = "$(IntermediateOutputPath)$(TargetFileName)"
ReferencePath = "#(ReferencePath)"
Verbosity = "2"
OptimizeIL = "true"
DebugSymbols = "$(DebugSymbols)"
DebugType = "$(DebugType)"/>
</Target>
</Project>
Latest updates
[June 16]
After trying to create a new solution several times, I'm now unable to create one that's able to build. Whatever version my packages are on, I keep getting those two errors.
See the Build output here.
This issue was caused by the # character within the project's path. Removing it resolved the issue.
Wired ... But closing visual studio and reopen solved the problem in my case
I had the same issue, it was caused by C:\User\name\.nuget folder being a symbolic link (created with MKLINK), which pointed to a directory on a bigger drive. When I set NUGET_PACKAGE environment variable to the actual location of the package directory, the issue is solved.
I was facing a similar issue like yours. I updated many dependencies and removed a few.
I'm using this version of VS
I tried all the answers and didn't work.
I followed the "Just In Case" approach (mentioned in this answer thread previously.) of killing the VS instance and reopening it. Then when I executed the project all errors vanished.
In my case, I didnt have # in the path and I tried clean and rebuild,deleting obj,bin,packages folders, closed and opened many times etc but didnt work.
My nuget packages folder is referenced at this path 'C:/Users/xyz/.nuget/packages/'
I tried to change the path of this nuget packages folder using a nuget.config file and placed it in the solution folder as specified in the below link and it worked.
Is it possible to change the location of packages for NuGet?
For me this piece of code worked among all the answers in the above link.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="globalPackagesFolder" value="C:\Projects\MyProj\.nuget\packages" />
<add key="repositoryPath" value="C:\Projects\MyProj\.nuget\packages" />
</config>
</configuration>
I am attempting to publish a nopCommerce 3.80 build using Visual Studio. I need to use the 'Publish -> File System' method. The problem I am having is that when I attempt to publish to the file system, an error is thrown:
The "CollectFilesinFolder" task failed unexpectedly.
System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
I determined that the problem is that I have a node_modules directory in my theme's directory that contains paths well over the 248 character limit.
If I delete the node_modules directory first, then I can publish just fine; however, this does not work for me because I run gulp in the Pre-build Event and I do not have the time to install the packages each time I go to build the project.
I found some suggestions online that suggest:
Make the node_modules directory hidden
Use .wpp.targets file to exclude the directory (link)
Add <ExcludeFoldersFromDeployment>node_modules</ExcludeFoldersFromDeployment> to the .csproj file (link)
I have tried all of the above (and then some), and none of these solutions have worked for me. Maybe because I am using the 'Publish -> File System' method (and not 'Web Deploy')? Maybe Visual Studio 2015 requires a different solution?
Can anyone explain (in detail) how I can exclude the node_modules directory from 'Publish -> File System' without sabotaging my ability to use Gulp in the Pre-build Event?
Note: This project is not a .NET 4.6 web application (which has NPM and Gulp pre-configured). So there is no *.json config file for me to exclude the node directory in...
UPDATE
I think the .wpp.targets file would be a great solution. I have tried the following:
Nop.Web.wpp.targets
<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ExcludeFromPackageFolders Include="node_modules;bower_components">
<FromTarget>Nop.Web.wpp.targets</FromTarget>
</ExcludeFromPackageFolders>
</ItemGroup>
</Project>
But I get the original error plus the following error:
The element 'ItemGroup' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003' has invalid child element 'ExcludeFromPackageFolders' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'. List of possible elements expected: 'Item, Reference, SDKReference, COMReference, COMFileReference, Xdcmake, Bscmake, ClCompile, ClInclude, Midl, ResourceCompile, PreLinkEvent, CustomBuildStep, Manifest, ProjectConfiguration, ProjectCapability, NativeReference, ProjectReference, Compile, EmbeddedResource, Content, Page, Resource, ApplicationDefinition, None, BaseApplicationManifest, Folder, Import, Service, WebReferences, WebReferenceUrl, FileAssociation, BootstrapperFile, PublishFile, TargetPlatform, Analyzer, CodeAnalysisDependentAssemblyPaths, CodeAnalysisDictionary, CodeAnalysisImport, AppxManifestSchema, StoreManifestSchema, AppxHashUri, PRIResource, AppxSystemBinary, AppxReservedFileName, AppxManifestFileNameQuery, AppxManifestImageFileNameQuery, AppxManifest, StoreAssociationFile, AppxManifestMetadata, PlatformVersionDescription, _AppxBundleContent, _AppxBundleMainPackageMapGeneratedFiles, _AppxBundleMainPackageMapInputs, _AppxBundleResourceFileMaps, _AppxBundleResourcePack, _AppxBundleSplitResourcesGeneratedFiles, _AppxBundleSplitRes.... Nop.Web C:\nopCommerce\src\Presentation\Nop.Web\Nop.Web.wpp.targets 5
I am trying to create a deployment package in Visual Studio 2013. I have specified that the package should be placed at C:\Deployment\bin\WebSite.zip - the absolutely simplest location. All the project files build but the publish fails with this error:
Transformed Web.config using C:\Services\IdentityServer\Thinktecture.IdentityServer.v2\src\OnPremise\WebSite\Web.Siloed.config into obj\Siloed\TransformWebConfig\transformed\Web.config.
Auto ConnectionString Transformed Areas\Admin\Views\Web.config into obj\Siloed\CSAutoParameterize\transformed\Areas\Admin\Views\Web.config.
Auto ConnectionString Transformed Views\Web.config into obj\Siloed\CSAutoParameterize\transformed\Views\Web.config.
Auto ConnectionString Transformed obj\Siloed\TransformWebConfig\transformed\Web.config into obj\Siloed\CSAutoParameterize\transformed\Web.config.
Copying all files to temporary location below for package/publish:
obj\Siloed\Package\PackageTmp.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(2584,5): Error : Copying file ..\..\..\Deployment\bin\um.zip to obj\Siloed\Package\PackageTmp\.ebextensions\um.zip failed. Could not find a part of the path '..\..\..\Deployment\bin\um.zip'.
I have no idea where this path '......\Deployment\bin\um.zip' is coming from. I specified that the deployment package should be created at C:\Deployment\bin\WebSite.zip, not um.zip.
So, I checked out C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(2584,5) and the code looks like this:
<!--Force Copy Of all file to the $(WPPAllFilesInSingleFolder) if needed-->
<CopyPipelineFiles PipelineItems="#(FilesForPackagingFromProject)"
SourceDirectory="$(WebPublishPipelineProjectDirectory)"
TargetDirectory="$(WPPAllFilesInSingleFolder)"
SkipMetadataExcludeTrueItems="True"
UpdateItemSpec="True"
DeleteItemsMarkAsExcludeTrue ="True"
Condition="'#(FilesForPackagingFromProject)' != ''">
<Output TaskParameter="ResultPipelineItems" ItemName="_FilesForPackagingFromProjectTempory"/>
</CopyPipelineFile>
I have tried editing the "PipelineItems" and "SourceDirectory" and have even hardcoded them. But the same message, "Could not find part of the path....", is being displayed every time I run the Publishing. The "Could not find part of the path...." points to the new paths I specified in "PipelineItems" and "SourceDirectory. The .zip file never seems to get created anywhere. I have seached my entire computer for um.zip and WebSite.zip with not luck.
Any help would be greatly appreciated as I am completely out of ideas.
Turns out this um.zip is somehow part of build but it is not getting created. Anyway, I was lucky enough to find a previous deployment package that was generated and I just manually built the new deployment package based off the old one. Deployed fine so I guess that is how I will proceed.
I've created an MSBuild proj file that contains the following header:
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0" TargetFrameworkVersion="4.5" VisualStudioVersion="VersionLatest">
This proj file is used to trigger an MSBuild on a number of SSDT projects, couples with a Deploy.
For most developers, this is fine. However, one dev encounters a Deploy72002 exception when trying to run the build. According to this answer, this is due to the VisualStudioVersion not being set. Sure enough, adding
set VisualStudioVersion="12.0"
in the batch file prior to the MSBuild call fixes the problem.
However, I was under the impression (I can't find the source now) that setting VisualStudioVersion="VersionLatest" in the xml of the proj file was sufficient to make it use the highest version of VS installed. I've even tried setting it from VersionLatest to 12.0, and also moving it from the root node, into a node of it's own in <PropertyGroup>.
I'd rather not have a hardcoded reference to 12.0 in the batch file. Am I missing something obvious to make VersionLatest work?
Try this: run MsBuild with the command line option to generate a preprocessed single file. Do the same on a working computer with the same version. Diff the files produced.
It might be picking up different contents for some .props or .targets file. These have been known to change due to installing or updating some or another. I recall following a msdn article to fix such a file when I looked up a problem.
I'm using Vs2010 and Wix 3.6.0917.0, for the record. I use the $(SolutionDir) property quite a bit in my .wixproj file, since I only ever build the installer as part of a solution build or as part of a team build, and never by itself. However, while building from the command line works just fine (both from cmd on the desktop and when building on build agents), when I attempt to reload the .wixproj file into the IDE, I get errors because all the $(SolutionDir) variables are resolving to the project directory, not the solution directory. Consider:
C:\workspace\projectCollection\teamProject\branch\solution.sln
C:\workspace\projectCollection\teamProject\branch\source\installer\installer.wixproj
and assume a shared custom targets file:
C:\workspace\projectCollection\teamProject\branch\build\shared.targets
which is referenced inside installer.wixproj with:
<Import Project="$(SolutionDir)build\shared.targets">
Command line builds work fine...
C:\workspace\projectCollection\teamProject\branch\> MSBuild /t:build /property:Platform=x64;Configuration=Debug solution.sln
0 Errors
0 Warnings
Build succeeded!
But load into vs2010 and you see...
The imported project
"C:\workspace\projectCollection\teamProject\branch\source\installer\build\shared.targets" was not found.
Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
C:\workspace\projectCollection\teamProject\branch\source\installer\installer.wixproj
You can see here that the resolved result of $(SolutionDir)build\shared.targets is getting the project directory and not the solution directory. What gives?
My guess would be that $(SolutionDir) resolves to nothing when the wixproj is being loaded into VS2010. In this case the imported file becomes "build\shared.targets". Since the path is relative it is assumed to be relative to the project directory. Using ".." or some other path could get you around the problem.
I verified this failed with WiX 3.5.2222.0 in VS2010. A C# console application project (csproj) worked as expected.
Have you filed a bug against WiX for this?
I looked at the WiX vs2010 addin code a little bit and the Solution properties are only created when doing a build and not when the project is loaded.