我想发布dotnet核心程序不使用Visual Studio。我使用了dotnet build /p:DeployOnBuild=true /p:PublishProfile=FTP
(FTP配置文件在Visual Studio中没有任何问题)。但是,运行此命令后,FTP网站中没有文件。我不知道此命令的详细信息。因此,我使用FolderProfile代替了[[FTP,它很好用。 Micorsoft Docs没有通过dotnet cli发布ftp的示例。这样的我的FTP配置文件:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FTP</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>**.**.**.**\api</SiteUrlToLaunchAfterPublish>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<ProjectGuid>28bdbda4-4eb1-4b10-b5bd-d150e6d9****</ProjectGuid>
<publishUrl>ftp://**.**.**.**</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
<FtpPassiveMode>True</FtpPassiveMode>
<FtpSitePath></FtpSitePath>
<UserName>webadmin</UserName>
<_SavePWD>True</_SavePWD>
<TargetFramework>netcoreapp2.2</TargetFramework>
<SelfContained>false</SelfContained>
<EnvironmentName>Test</EnvironmentName>
</PropertyGroup>
</Project>
dotnet cli是否有用于ftp发布的解决方案?
命令dotnet build -v n /p:DeployOnBuild=true /p:PublishProfile=FTP
:结尾为:
1>Project "FTPTest.sln" on node 1 (Restore target(s)). 1>ValidateSolutionConfiguration: Building solution configuration "Debug|Any CPU". Restore: Committing restore... Assets file has not changed. Skipping assets file writing. Path: FTPTest\obj\project.assets.json Restore completed in 51.54 ms for FTPTest.csproj. NuGet Config files used: C:\Users\*******\AppData\Roaming\NuGet\NuGet.Config C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config Feeds used: https://api.nuget.org/v3/index.json C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\ 1>Done Building Project "FTPTest.sln" (Restore target(s)). 1:2>Project "FTPTest.sln" on node 1 (default targets). 1>ValidateSolutionConfiguration: Building solution configuration "Debug|Any CPU". 1:2>Project "FTPTest.sln" (1:2) is building 2>GenerateTargetFrameworkMonikerAttribute: Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files. _CoreGenerateRazorAssemblyInfo: Skipping target "_CoreGenerateRazorAssemblyInfo" because all output files are up-to-date with respect to the input files. CoreGenerateAssemblyInfo: Skipping target "CoreGenerateAssemblyInfo" because all output files are up-to-date with respect to the input files. CoreCompile: Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files. _CopyOutOfDateSourceItemsToOutputDirectory: Skipping target "_CopyOutOfDateSourceItemsToOutputDirectory" because all output files are up-to-date with respect to the input files. _CopyOutOfDateSourceItemsToOutputDirectoryAlways: GenerateBuildDependencyFile: Skipping target "GenerateBuildDependencyFile" because all output files are up-to-date with respect to the input files. GenerateBuildRuntimeConfigurationFiles: Skipping target "GenerateBuildRuntimeConfigurationFiles" because all output files are up-to-date with respect to the input files. CopyFilesToOutputDirectory: FTPTest -> .\bin\Debug\netcoreapp2.2\**********.dll _DeletePublishIntermediateOutputPath: ......some details...... Publish: FTPTest -> .\obj\Release\netcoreapp2.2\PubTmp\Out\ No web.config found. Creating '.\obj\Release\netcoreapp2.2\PubTmp\Out\web.config' 2>Done Building Project ".\*******.csproj" (default targets). 1>Done Building Project "********.sln" (default targets). Build succeeded. 0 Warning(s) 0 Error(s)