BenoitM
BenoitM

Reputation: 97

.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?

Upvotes: 1

Views: 882

Answers (1)

Martin Ullrich
Martin Ullrich

Reputation: 100581

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.

Upvotes: 2

Related Questions