Closed colltoaction closed 7 years ago
@tinchou the Kudu script generator doesn't yet know how to handle Preview3, but you should be able to use a custom deployment script. The key is to use 'dotnet restore' instead of 'nuget restore' and 'dotnet publish' instead of 'msbuild'. See sample here.
We will fix Kudu to handle this soon.
Awesome! I'll use my own script for now, and keep us posted with any updates about built-in support :)
That first sample I pointed to was non-VS created. Here is a sample with a VS 2017 RC project: https://github.com/davidebbo-test/MvcCoreVS2017RC
@tinchou, the new projectkudu/KuduScript#56 is out
you can now use SCM_SCRIPT_GENERATOR_ARGS=--aspNetCore "csproj file path" --solutionFile "solution file path"
instead of providing a deploy.cmd
, please refer to this documentation for usage
Just tried it but I'm facing an issue with an old project. YYY is the old (ASP.NET 4) one and XXX is the one I'm trying to deploy (ASP.NET Core 1).
I didn't specify a solution file, but just --aspNetCore "XXX\XXX.csproj"
This is the error message:
remote: Generating deployment script.
remote: Project file path: .\XXX\XXX.csproj
remote: Generated deployment script files
remote: Running deployment command...
remote: Handling ASP.NET Core Web Application deployment.
remote: D:\home\site\repository\YYY\YYY.csproj(824,3): error MSB4019: The imported project "D:\Program Files (x86)\dotne
t\sdk\1.0.0-preview3-004056\Extensions\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" wa
s not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
remote: ...................................................................................
remote: Failed exitCode=1, command=dotnet restore
remote: An error has occurred during web site deployment.
remote:
remote: Error - Changes committed to remote repository but deployment to website failed.
UPDATE
I created a new solution file removing the old project (not actually needed for this deployment). I also added the --solutionFile
switch, but dotnet restore
stills fails because it doesn't use the project name. The flag works fine because the log now shows:
remote: Project file path: .\XXX\XXX.csproj
remote: Solution file path: .\ZZZ.sln
@tinchou can you please provide a repro, including both the test repo and the exact app setting you set?
It worked fine for me using:
SCM_SCRIPT_GENERATOR_ARGS
to --aspNetCore src\MvcCoreVS2017RC\MvcCoreVS2017RC.csproj --solutionFile MvcCoreVS2017RC.sln
Step 4: add an empty MVC 4 project.
That's odd. @piotrpMSFT / @vijayrkn / @rrelyea any idea what's going on here? I can actually repro on my local machine by simply calling dotnet restore
at the root of the solution. It fails with:
D:\gitapps\MvcCoreVS2017RC\WebApplication1\WebApplication1.csproj(213,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\1.0.0-preview3-004056\Extensions\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
So it's looking for Extensions\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets
in the dotnet sdk folder, and there is no such file.
Maybe in its current alpha state, the tooling doesn't allow mixing Core and non-Core in the same solution?
It actually doesn't matter if the csproj is in the solution or not.
Also, my local dotnet allows me to specify a sln file but not the one on Azure
On Fri, Nov 25, 2016, 00:40 David Ebbo notifications@github.com wrote:
That's odd. @piotrpMSFT https://github.com/piotrpMSFT / @vijayrkn https://github.com/vijayrkn / @rrelyea https://github.com/rrelyea any idea what's going on here? I can actually repro on my local machine by simply calling dotnet restore at the root of the solution. It fails with:
D:\gitapps\MvcCoreVS2017RC\WebApplication1\WebApplication1.csproj(213,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\1.0.0-preview3-004056\Extensions\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the
declaration is correct, and that the file exists on disk. So it's looking for Extensions\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets in the dotnet sdk folder, and there is no such file.
Maybe in its current alpha state, the tooling doesn't allow mixing Core and non-Core in the same solution?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/projectkudu/kudu/issues/2236#issuecomment-262875075, or mute the thread https://github.com/notifications/unsubscribe-auth/ABeg9A0_pIusRUQXfMBVpCl6xFXiiLfgks5rBliVgaJpZM4K3YNZ .
2017 RC template projects don't deploy on Azure either.
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling .NET Console Application deployment.
MSBuild auto-detection: using msbuild version '14.0' from 'D:\Program Files (x86)\MSBuild\14.0\bin'.
Nothing to do. None of the projects in this solution specify any packages for NuGet to restore.
Controllers\HomeController.cs(5,17): error CS0234: The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [D:\home\site\repository\WebApplication1\src\WebApplication1\WebApplication1.csproj]
Program.cs(6,17): error CS0234: The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [D:\home\site\repository\WebApplication1\src\WebApplication1\WebApplication1.csproj]
Startup.cs(5,17): error CS0234: The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [D:\home\site\repository\WebApplication1\src\WebApplication1\WebApplication1.csproj]
Startup.cs(6,17): error CS0234: The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [D:\home\site\repository\WebApplication1\src\WebApplication1\WebApplication1.csproj]
Startup.cs(7,17): error CS0234: The type or namespace name 'Extensions' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [D:\home\site\repository\WebApplication1\src\WebApplication1\WebApplication1.csproj]
Startup.cs(8,17): error CS0234: The type or namespace name 'Extensions' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [D:\home\site\repository\WebApplication1\src\WebApplication1\WebApplication1.csproj]
Startup.cs(9,17): error CS0234: The type or namespace name 'Extensions' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [D:\home\site\repository\WebApplication1\src\WebApplication1\WebApplication1.csproj]
Controllers\HomeController.cs(9,35): error CS0246: The type or namespace name 'Controller' could not be found (are you missing a using directive or an assembly reference?) [D:\home\site\repository\WebApplication1\src\WebApplication1\WebApplication1.csproj]
Controllers\HomeController.cs(11,16): error CS0246: The type or namespace name 'IActionResult' could not be found (are you missing a using directive or an assembly reference?) [D:\home\site\repository\WebApplication1\src\WebApplication1\WebApplication1.csproj]
Controllers\HomeController.cs(16,16): error CS0246: The type or namespace name 'IActionResult' could not be found (are you missing a using directive or an assembly reference?) [D:\home\site\repository\WebApplication1\src\WebApplication1\WebApplication1.csproj]
Controllers\HomeController.cs(23,16): error CS0246: The type or namespace name 'IActionResult' could not be found (are you missing a using directive or an assembly reference?) [D:\home\site\repository\WebApplication1\src\WebApplication1\WebApplication1.csproj]
Controllers\HomeController.cs(30,16): error CS0246: The type or namespace name 'IActionResult' could not be found (are you missing a using directive or an assembly reference?) [D:\home\site\repository\WebApplication1\src\WebApplication1\WebApplication1.csproj]
Startup.cs(25,16): error CS0246: The type or namespace name 'IConfigurationRoot' could not be found (are you missing a using directive or an assembly reference?) [D:\home\site\repository\WebApplication1\src\WebApplication1\WebApplication1.csproj]
Startup.cs(28,39): error CS0246: The type or namespace name 'IServiceCollection' could not be found (are you missing a using directive or an assembly reference?) [D:\home\site\repository\WebApplication1\src\WebApplication1\WebApplication1.csproj]
Startup.cs(35,31): error CS0246: The type or namespace name 'IApplicationBuilder' could not be found (are you missing a using directive or an assembly reference?) [D:\home\site\repository\WebApplication1\src\WebApplication1\WebApplication1.csproj]
Startup.cs(35,56): error CS0246: The type or namespace name 'IHostingEnvironment' could not be found (are you missing a using directive or an assembly reference?) [D:\home\site\repository\WebApplication1\src\WebApplication1\WebApplication1.csproj]
Startup.cs(35,81): error CS0246: The type or namespace name 'ILoggerFactory' could not be found (are you missing a using directive or an assembly reference?) [D:\home\site\repository\WebApplication1\src\WebApplication1\WebApplication1.csproj]
Startup.cs(15,24): error CS0246: The type or namespace name 'IHostingEnvironment' could not be found (are you missing a using directive or an assembly reference?) [D:\home\site\repository\WebApplication1\src\WebApplication1\WebApplication1.csproj]
Failed exitCode=1, command="D:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "D:\home\site\repository\WebApplication1\src\WebApplication1\WebApplication1.csproj" /nologo /verbosity:m /t:Build /p:Configuration=Release;OutputPath="D:\local\Temp\8d4194d4cd2ab8f\app_data\jobs\continuous\deployedJob";UseSharedCompilation=false /p:SolutionDir="D:\home\site\repository\WebApplication1\\"
An error has occurred during web site deployment.
\r\nD:\Program Files (x86)\SiteExtensions\Kudu\59.51122.2559\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"
@jsgoupil you didn't follow @watashiSHUN's instructions properly.
When you do that the deployment will output Handling ASP.NET Core Web Application deployment
. Run git clean -xfd
and remove the deployment files at scm
if you don't see any changes with the SCM_SCRIPT_GENERATOR_ARGS
setting.
@tinchou Indeed I did not read all the pages and comments to actually deploy a simple application on Azure.
Anyway, it doesn't work.
You can't expect people who want to deploy on Azure to come read this thread or even know about the Kudu project. There are too many steps to get up and running with .NET Core.
--aspNetCore "WebApplication1\src\WebApplication1\WebApplication1.csproj" --solutionFile "WebApplication1\WebApplication1.sln"
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET Core Web Application deployment.
MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
Failed exitCode=1, command=dotnet restore
An error has occurred during web site deployment.
\r\nD:\Program Files (x86)\SiteExtensions\Kudu\59.51122.2559\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"
Now... I moved the SLN file to the root of the directory... and it starts working.
That's way too constraining. Can't you support a path in --solutionFile
Well, MSBuild support for .NET Core is alpha, so I think it's great that we already have support in Kudu. This thread is to discuss bugs in this deployment option, so welcome and thanks for reporting!
I too think that is too constraining. I think the sln
path that is specified should be passed on to dotnet restore
.
Indeed, this is a point in time thing. We already simplified things from requiring a full custom script to only needed this app setting. Next step is to make it fully automatic, and that's in the work.
I'm seeing a similar issue as @jsgoupil
I forked the https://github.com/davidebbo-test/MvcCoreVS2017RC by @davidebbo to https://github.com/martinnormark/MvcCoreVS2017RC and added an extra solution file to the root in https://github.com/martinnormark/MvcCoreVS2017RC/commit/ba930150cb59ba3695bd618bace34c74d5aa033f
The error I'm getting is this:
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET Core Web Application deployment.
MSBUILD : error MSB1011: Specify which project or solution file to use because this folder contains more than one project or solution file.
Failed exitCode=1, command=dotnet restore
An error has occurred during web site deployment.
\r\nD:\Program Files (x86)\SiteExtensions\Kudu\59.51122.2559\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"
@martinnormark, I just tried your repo on my local machine and it worked, your issue is about multiple solution files which has been brought up by @tinchou couple days ago:
I too think that is too constraining. I think the sln path that is specified should be passed on to dotnet restore.
and the fixes are made two days ago: this commit, it's being reviewed right now
if your project really needs two solution files right now, you can always go back to the custom deploy.cmd: and specify dotnet restore oneOfSeveralSolutionFilePath
the latest Kudu is deployed to Azure
@martinnormark your repo should work as is. custom deploy.cmd
is no longer required
@tinchou @jsgoupil SCM_SCRIPT_GENERATOR_ARGS
is also no longer needed to deploy a regular dotnet preview3 projects in azure (unless its a special case, for example: repository with multiple solution files)
Closing since the mainline scenario should now directly work. If you find specific repos that don't quite work, please open separate issues to help tracking. Thanks!
I can confirm that after removing the non-Core projects from my solution everything works as expected automagically :).
Thanks!
I have a project I just converted from
project.json
tocsproj
. I read the latest issues and tried to set up the environment with aglobal.json
containing:I also
git clean -xdf
'd the repo and deleteddeploy.cmd
to have a fresh environment. When I deploy packages are restored fine but it seemsmsbuild
isn't finding them. E.g. my controllers can't findaspnet
's types:The name of my Web App ends with
gs
and is next todummy321
.Thanks!