The target "PipelineTransformPhase" does not exist in the project - azure

I'm trying to create an azure package via tfs build server.
my project is an Azure MVC web api project. when i trigger a build I get the error "The target "PipelineTransformPhase" does not exist in the project."
But I've added the Microsoft.WebApplication.targets file to the appropriate folder in my build server.
this is the line mentioned in my csproj file
Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' == ''" />
even without condition I get the same error.
could someone help to resolve this issue .
many thanks in advance

First, read these SO posts, they might have your answer:
Package / Publish error on Azure
MSBuild target package not found
Is it possible that the .targets file was never found? (If you're on a machine without Visual Studio it won't be there). That would produce an error somewhat like:
The imported project
"...\WebApplications\Microsoft.WebApplication.targets" was not found.
Confirm that the path in the <Import> declaration is correct, and that
the file exists on disk.
I'll assume that isn't the problem. I would run the build with logging enabled and look at where your targets are coming from (or not coming from in this case). It might add some light to your problem. You can use the /fl switch something like my example below to get a detailed (not diagnostic -- which you could do) log from a build:
msbuild /fl /flp:logfile=<yourpath>\yourLog.log;verbosity=detailed
The lines you should be most interested in are around targets. Lines like
Target "Clean" in file "..." from project "..." (entry point): and
Overriding target "Clean" in project "..." with target "Clean" from project "..."

Related

Azure Build Pipeline: VSBuild fails on The CodeDom provider

My build pipeline (Microsoft-hosted agent) has been running every morning for a couple of months but this morning it suddenly failed on the VSBuild task. The error is described as:
"##[error]ASPNETCOMPILER(0,0): Error ASPCONFIG: The CodeDom provider type "Microsoft.VisualC.CppCodeProvider, CppCodeProvider, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" could not be located."
See image of failed build here
How do i fix this?
Not sure if you use private agent. As I know this error could result from the fact that PrecompileBeforePublish property is set to true somewhere in your project.(csproj or publish profile).
As one workaround you can pass /p:PrecompileBeforePublish=false as argument to your VSBuild Task. But this may make first response of your application slow.
Or you can register it into GAC using command like this:
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\xxxx\VSEditon\Common7\IDE\PublicAssemblies\CppCodeProvider.dll"
Cause after VS2017, the C++ project support for xsd.exe is deprecated, we need to manually add its assembly into GAC as described here.
I managed to solve this by just skipping build on the assets project that failed. This was done using the Configuration Manager in Visual Studio (found in Build->Configuration Manager). I just removed the check mark. See attached images for clarification.
Skip project build
Configuration Manager

.Net Core Website publish Microsoft.WebSite.Publishing.targets

I am on .Net Core 2.0.
I create a new solution containing a webapp and a website. The website project contains an index.html and web.config file.
I have no issue publishing the web application, but the website causes me some trouble.
I added a publish profile configured for FileSystem publish method.
When I run dotnet publish on the default .publishproj generated, I get the following error message
error MSB4019: The imported project
"C:\ProgramFiles\dotnet\sdk\2.0.0\Microsoft\
VisualStudio\v10.5\Web\Microsoft.Web
Site.Publishing.targets" was not found. Confirm that the path in the
<Import> declaration is correct, and that the file exists on disk.
Ok, so I change the website.publishproj value to where the targets file is located.
<!--<Import
Project="$(_WebPublishTargetsPath)\Web\Microsoft.WebSite.Publishing.targets"
/>-->
<Import Project="C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\
Microsoft.WebSite.Publishing.targets" />
Then I get
error MSB3030: Could not copy the file
"C:\Users\Administrator\AppData\Local\Temp\WebSitePublish\WebSite2-
1026028577\obj\Debug\website.exe" because it was not found.
[C:\Users\Administrator\Documents\visual studio
2017\WebSites\WebSite2\website.publishproj]
I can publish the website using visual studio without any issue. What am I missing?
It looks like you are trying to use the dotnet CLI tooling to publish "classic" website projects which is not supported. Use msbuild from the developer command prompt instead.

Can't compile project after adding SFML.NET by Nuget

After adding SFML.NET through Nuget Packge manager I got the following error:
Error 4 The "UnzipNuspec" task was not found. Check the following: 1.) The name of the
task in the project file is the same as the name of the task class. 2.) The task class is
"public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is
correctly declared with <UsingTask> in the project file, or in the *.tasks files located
in the "C:\Windows\Microsoft.NET\Framework\v4.0.30319" directory.
I'm using Visual Studio 2012.
As pointed out in other similar questions, I've tried to close and open MSVS, it didn't helped.
I also checked out the build tools path in the registry, and it points to right directory.
I tried to install and uninstall Nuget packeage.
I found out that error possibly somehow connected to it's dependency : Baseclass.Contrib.Nuget.Output, but I can't find out how to fix it.
It's a bug in their build script.
Go to the packages folder for your solution and locate the following file:
Baseclass.Contrib.Nuget.Output.1.0.6\build\net40\Baseclass.Contrib.Nuget.Output.targets
Around line 84 in that file you'll find a couple of <Using Namespace=... /> tags. Add this after those, before the <Code...> tag:
<Using Namespace="System.Threading" />
I've reported this on their github issues list as well.

Adding cache worker role causes build error

I have an Azure cloud service project to which I am adding a cache worker role. While local build goes through fine, I get the following error on my server builds :
CloudServices38 : The entrypoint dll is not defined for worker role <cachename>
What is wrong? How do I fix this?
Make sure all the Azure DLLs are marked Copy Local = True in the properties window. Also, package your projects, then unzip them. Once you build the package, you will have a file YourProject.cspkg. Change the extension from .cspkg to .zip and extract the files. In these files you should see a file with the extension .cssx YourProject_.cssx. Change the extension from .cssx to .zip and extract again. You project that is deployed will be in the folder YourProject\sitesroot\0 - verufy all the files you are expecting (i.e. content and everything that is in the bin directory on your local build.
You need to run a Build and a Publish separately. I ran into the same problem on my project and this fixed it.
1) Visual Studio Build (or MSBuild) action with arguments /t:Build (clean here)
2) Visual Studio Build (or MSBuild) action with arguments /t:Publish (do not clean here)
Note: I had to run these actions separately (not /Build;Publish) otherwise I got an error about the cloud service entry point.
Pieced this together from this question and from here and here.

VS2012 MSBuild: Publish a Web Application Project with Existing Publish Profile

In the Visual Studio 2012 Build menu, there's a Publish command. In this you can establish profiles which are saved as .pubxml files in the Properties folder of the Project. I have one such profile that's a simple file copy operation - it just compiles the site and dumps it to a folder.
How can I use msbuild at the command line to publish a compiled web application to a folder?
What I've tried
I've tried the example from this question:
After Publish event in Visual Studio
And the changes and examples given here:
http://www.digitallycreated.net/Blog/59/locally-publishing-a-vs2010-asp.net-web-application-using-msbuild
The latter seems to get closest, but it causes every library Project the .csproj I'm attempting to publish from to throw an error:
Project "MainProj.csproj" (1) is building "ReferencedProj.csproj" (2) on node 1 (default targets).
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(609,5): error : The OutputPath property is not set for project 'ReferencedProj.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Staging' Platform='AnyCPU'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project. [ReferencedProj.csproj]
Done Building Project "ReferencedProj.csproj" (default targets) -- FAILED.
This approach is very similar to what's suggested in this answer:
https://stackoverflow.com/a/7077178/176877
The crucial difference may be that I'm in Visual Studio 2012, rather than VS2008 or 2010.
Old question, but in case this helps anyone, this simple, stripped back approach worked fine for me:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
...
<BuildDependsOn>
$(BuildDependsOn);
PublishOtherProject;
</BuildDependsOn>
</PropertyGroup>
<Target Name="PublishOtherProject">
<MSBuild Projects="pathtomyproject.csproj" Properties="DeployOnBuild=true;PublishProfile=nameOfPublishProfile" />
</Target>
The key line being:
<MSBuild Projects="pathtomyproject.csproj" Properties="DeployOnBuild=true;PublishProfile=nameOfPublishProfile" />

Resources