Ich hatte dieses Problem, wenn ich meinen Build-Server mit dem neuen Roslyn-Compiler zu kompilieren (um C# 6 Funktionen zu verwenden) und nach der Installation required stuff (Das .NET 4.6 Framework, Die Microsoft Build Tools 2015, .NET Framework 4.6 Targeting Pack) Ich habe Fehler beim Fehlen C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets
, als ich versuchte, Projekt ("Package"
Msbuild Ziel) zu veröffentlichen.
So habe ich /p:VisualStudioVersion=12.0
Parameter MSBuild-Befehl, so das Ziel von C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\WebApplications\Microsoft.WebApplication.targets
Sie veröffentlichen würde genommen werden und dann habe ich den Fehler in Frage (Web deployment task failed. (Unknown ProviderOption:DefiningProjectFullPath. Known ProviderOptions are:skipInvalid.)
)
Ich habe zwei Lösungen für dieses Problem:
- Kopieren Sie
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets
von Ihrem lokalen Rechner, um den Server zu erstellen und entfernen Sie /p:VisualStudioVersion=12.0
Parameter von MSBuild Befehl argumens. Das neue MSBuild (unter C:\Program Files (x86)\MSBuild\14.0\bin\amd64\MSBuild.exe'
) würde standardmäßig VisualStudioVersion
als 14.0
festlegen und das neue MSBuild-Ziel verwenden, das mit neuem Compiler funktioniert.
- Wenn Sie keinen Zugriff auf den Build-Server haben, dann installieren Sie das NuGet-Paket MSBuild.Microsoft.VisualStudio.Web (Sie müssen es in mindestens einem Projekt in Lösung installieren) und entfernen Sie dann das Befehlsargument
/p:VisualStudioVersion=12.0
von MSBuild und fügen Sie den folgenden Text hinzu.csproj Datei von Projekt, die veröffentlicht werden können:
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != '' And Exists('$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets')" />
<Import Project="..\..\packages\MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0\tools\VSToolsPath\WebApplications\Microsoft.WebApplication.targets" Condition="('$(VSToolsPath)' == '' Or !Exists('$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets')) And Exists('..\..\packages\MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0\tools\VSToolsPath\WebApplications\Microsoft.WebApplication.targets')" />
Dies wird zunächst prüfen, ob Sie Microsoft.WebApplication.targets
auf Build-Server (in ...VisualStudio\v14.0\
Verzeichnis) haben, und wenn es nicht die eine Lösung aus (inklusive importiert in packages
Verzeichnis)
wenn es wird nicht funktionieren, wenn Sie diese Datei in Ihrem CSPROJ haben:
<PropertyGroup>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
Related: http://stackoverflow.com/questions/21849681/web- Deployment-Task-Failed-in-Web-Bereitstellung –