Publish error on fresh umbraco install - visual-studio

I'm very new to umbraco and this is my first install so apologies if i ask some pretty beginner questions.
So I've just installed umbraco using nugent. I build the program and then press 'control & F5' to run it.
After Umbraco is installed I went back to my solution explorer in visual studio and made sure to 'include in project' all the new files and folders that were created.
Now I want to deploy this to my IIS server I have sitting on my server. But when I deploy I get the following web.config error
Could not open Source file: Could not find a part of the path 'c:\users\josha\documents\visual studio 2015\Projects\Umbraco - SecondAttempt\Umbraco - SecondAttempt\Umbraco\Install\Views\Web.config;\umbraco\Install\Views\Web.config'. Umbraco___SecondAttempt 0
I'm not sure If I'm not doing this correctly since I'm so new to this but I followed a few tutorials and didn't think I set up anything incorrectly.

I still had this issue for 7.5
The solution:
Inside project dir, if the file ProjectName.wpp.targets does not exist, create it. Make sure that the content will include:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<AutoParameterizationWebConfigConnectionStrings>False</AutoParameterizationWebConfigConnectionStrings>
</PropertyGroup>
</Project>
The file doesn't even have to be included in the project. That's it.

Related

Where do I put files in a nuget package so that they will be restored?

I'm working on setting up nuget packages for dacpacs for some large database schemas we have. Here's a sample of the metadata:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>xxxx.DACPAC</id>
<version>1.0.0</version>
<title>xxxxDatabase dacpac</title>
<authors>xxxxxxxxx</authors>
<owners>xxx</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<projectUrl>xxx-database.git</projectUrl>
<iconUrl>http://github.com/contoso/UsefulStuff/nuget_icon.png</iconUrl>
<description>DACPAC for xxxx Database</description>
<releaseNotes>Initial release</releaseNotes>
<copyright>Copyright ©2019 xxxx</copyright>
<tags>dacpac database xxxxxx</tags>
</metadata>
</package>
The .nupkg looks like this
and the content directory like this:
This works fine. I then create a solution with an ssdt project and a skeleton c# project. I use the c# project to hold the dacpacs. I can nuget them, then in the ssdt project add database refs pointing to the dacpacs. The dacpacs are not in git (part of my goal is to keep them out).
I commit the repo then clone it to an empty directory. Good so far.
Next, i use nuget to restore the packages in visual studio. However the dacpacs are not restored! I think that's because they are in the "content" directory in the package and from what I can find, those files are not restored by nuget.
So, my question is, where to put these files so that they will be restored? Which nupkg directory? Content doesn't work. Tried tools to no avail. Thought I should ask before another blind attempt.
So, my question is, where to put these files so that they will be
restored? Which nupkg directory? Content doesn't work. Tried tools to
no avail. Thought I should ask before another blind attempt.
Nuget Restore is to download the mssing packages. And the content in xx.nupkg will only be added to projects at install time of one package. Nuget restore can't get the content files back, that's not restore's job. So it has nothing to do with which directory we put the files in, it's just one not supported job for nuget restore...
As a workaround: You can use Update-Package -reinstall in Package Manager Console to reinstall the package. And the content files will be added back to project. More details see this document. Hope it helps :)

Error MSB4061: The "XamlCTask" task could not be instantiated

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>

How can I fix missing nuget references after moving project in Visual Studio 2015

I had a project structure like this:
WebApp
-- WebApp
-- WebApp.sln
WebApp.Tests
-- WebApp.Tests.csproj
I moved WebApp.Tests into WebApp using a move (simple click & drag into the WebApp folder). I edited WebApp.sln to fix the project reference so that it will load.
When I build, Nuget complains that packages are missing and to do a restore.
I downloaded and used nuget.exe restore on my solution and it reported everything was there.
Based on other Stack Overflow answers, I have tried the following:
Edit the test project reference hint paths. I changed from ..\WebApp\packages\PACKAGE to ..\packages\PACKAGE
Reload Visual Studio (multiple times)
Delete contents of packages folder and bin/obj folders of the projects
Use the package manager console to reinstall packages on the Test Project
All of these failed to fix the problem. When I used the package manager to try to reinstall the packages with the command, it gave me the same error that project building does - I must restore the packages first.
Is there any quick way to fix my project? I really don't want to go through each package and uninstall/reinstall manually. Also, how could I have prevented this problem in the first place? Is there a built-in way to move project locations?
There was XML similar to this at the end of my project file:
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\WebApp\packages\SPECIFICPACKAGE')" Text="$([System.String]::Format('$(ErrorText)', '..\WebApp\packages\SPECIFICPACKAGE'))" />
</Target>
By changing the ..\Webapp\packages to ..\packages like the rest of the file, my solution compiles just fine now.
I had the same issue where I physically moved a project folder into the src folder and got the missing packages error. My fix was to open up the .csproj file in notepad and replace every instance of
this:
..\packages\
with this:
..\..\packages\
It solved the issue...

Cannot load WiX projects after installing the VS2010 Web Publishing Updates

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.

MSBuild target PipelinePreDeployCopyAllFilesToOneFolder cannot be found when deploying

Deploying a Web Application Project from VS2010 RTM causes an error in MSBuild. It complains that the PipelinePreDeployCopyAllFilesToOneFolder target cannot be found.
Is there any way to further diagnose this?
Thank you.
I had the same problem and when I looked in the .csproj file for my web application I had the following lines...
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="'$(Solutions.VSVersion)' == '8.0'" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" Condition="'$(Solutions.VSVersion)' == '9.0'" />
I guess this happened since I had recently upgraded from VS2008 to VS2010. So it looks like the during the conversion process it got all screwed up. To fix it I just replaced those lines with ...
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
After that everything worked as it should.
I've seen the answer given by brodie in several places online, which is strange to me because this task (PipelinePreDeployCopyAllFilesToOneFolder) is not even contained in this target (Microsoft.WebApplication.targets):
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
If you actually go and find this file (on an x64 machine it's in C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets, or the version 12.0 equivalent if you're using VS2013) and open it in a text viewer, you'll see it's not there..
It's actually contained in the file that Sayed Ibrahim Hashimi mentions, which is the Microsoft.Web.Publishing.targets file (C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets).
So to get this into your MSBuild/.csproj file, include the following:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets" />
Do you have Visual Studio 2010 installed on the machine where you are trying to build? If so then look for a file located at %Program Files(x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets it should have that target. If it doesn't then those files may have been corrupted and probably reparing your VS 2010 install should fix it.
I think the Web Deployment targets/tasks are shipped with VS itself and not the .NET framework, so you need VS installed (or you can manually configure the machine)/
Even though this is an old post It still provided some great help!
My setup is using a remote host for Automation of a project built in VS2013.
The remote host doesn't contain all the VS2013 targets when you solely install MSBuild 12.0 and this resulted in the 'Microsoft.Web.Publishing.targets' file not existing.
To get around this target error I had to copy the files from my local VS2013 path and copy this to the remote host in the equivalent location.

Resources