Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/309.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用msbuild从解决方案发布一个web项目_C#_Msbuild_Teamcity_Webdeploy - Fatal编程技术网

C# 使用msbuild从解决方案发布一个web项目

C# 使用msbuild从解决方案发布一个web项目,c#,msbuild,teamcity,webdeploy,C#,Msbuild,Teamcity,Webdeploy,我正在尝试将解决方案中的一个web项目部署到服务器。我正在TeamCity上使用msbuild,如下所示: msbuild MySolution.sln /t:WebSite:Rebuild /p:DeployOnBuild=True /p:PublishProfile=Prod ... 但是,当我运行它时,msbuild仍然尝试构建我的WebService项目,即使我的WebSite项目并不依赖于它(但它也依赖于解决方案中的Services项目)。如何只发布一个项目,也就是网站 我还尝试使用

我正在尝试将解决方案中的一个web项目部署到服务器。我正在TeamCity上使用msbuild,如下所示:

msbuild MySolution.sln /t:WebSite:Rebuild /p:DeployOnBuild=True /p:PublishProfile=Prod ...
但是,当我运行它时,msbuild仍然尝试构建我的
WebService
项目,即使我的
WebSite
项目并不依赖于它(但它也依赖于解决方案中的
Services
项目)。如何只发布一个项目,也就是网站

我还尝试使用

msbuild WebSite/WebSite.csproj /p:DeployOnBuild=True ...
但它随后抱怨无法恢复包:

[07:47:17]WebSite\WebSite.csproj.teamcity: Build target: Build
[07:47:17][WebSite\WebSite.csproj.teamcity] RestorePackages
[07:47:17][RestorePackages] Exec
[07:47:17][Exec] C:\TeamCity\buildAgent\work\cab8a3d752df3a51\.nuget\NuGet.targets(90, 15): error MSB4064: The "LogStandardErrorAsError" parameter is not supported by the "Exec" task. Verify the parameter exists on the task, and it is a settable public instance property.
[07:47:17][Exec] C:\TeamCity\buildAgent\work\cab8a3d752df3a51\.nuget\NuGet.targets(89, 9): error MSB4063: The "Exec" task could not be initialized with its input parameters. 
[07:47:17][WebSite\WebSite.csproj.teamcity] Project WebSite\WebSite.csproj.teamcity failed.
当我禁用NuGet Package Restore时,CoreCompile(Csc)会失败,并出现我从未听说过且不应该发生的错误:

[07:54:43]WebSite\WebSite.csproj.teamcity: Build target: Build (13s)
[07:54:55][WebSite\WebSite.csproj.teamcity] CoreCompile
[07:54:55][CoreCompile] Csc
[07:54:56][Csc] Areas\Api\Services\TripService.cs(19, 104): error CS0241: Default parameter specifiers are not permitted
[07:54:56][Csc] Helpers\StatisticsUtility.cs(11, 35): error CS1031: Type expected
[07:54:56][Csc] Helpers\StatisticsUtility.cs(11, 53): error CS1002: ; expected
[07:54:56][Csc] Helpers\StatisticsUtility.cs(16, 28): error CS1519: Invalid token '(' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\StatisticsUtility.cs(16, 37): error CS1519: Invalid token ',' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\StatisticsUtility.cs(17, 27): error CS1519: Invalid token '(' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\StatisticsUtility.cs(17, 32): error CS1519: Invalid token ')' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\StatisticsUtility.cs(23, 17): error CS1519: Invalid token 'for' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\StatisticsUtility.cs(23, 26): error CS1519: Invalid token '<=' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\StatisticsUtility.cs(23, 45): error CS1519: Invalid token '-' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\StatisticsUtility.cs(23, 51): error CS1519: Invalid token '++' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\StatisticsUtility.cs(24, 34): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
[07:54:56][Csc] Helpers\StatisticsUtility.cs(24, 37): error CS1519: Invalid token '==' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\StatisticsUtility.cs(24, 51): error CS1519: Invalid token ')' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\StatisticsUtility.cs(24, 63): error CS1519: Invalid token '++' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\StatisticsUtility.cs(25, 41): error CS1519: Invalid token '>' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\StatisticsUtility.cs(25, 53): error CS1519: Invalid token ')' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\StatisticsUtility.cs(27, 36): error CS1519: Invalid token '=' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\StatisticsUtility.cs(27, 48): error CS1519: Invalid token ';' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\StatisticsUtility.cs(28, 36): error CS1519: Invalid token '=' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\StatisticsUtility.cs(29, 37): error CS1519: Invalid token '=' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\StatisticsUtility.cs(29, 48): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
[07:54:56][Csc] Helpers\StatisticsUtility.cs(29, 50): error CS1519: Invalid token ';' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\StatisticsUtility.cs(30, 33): error CS1519: Invalid token '=' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\StatisticsUtility.cs(30, 44): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
[07:54:56][Csc] Helpers\StatisticsUtility.cs(30, 50): error CS1519: Invalid token ';' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\StatisticsUtility.cs(32, 21): error CS0116: A namespace does not directly contain members such as fields or methods
[07:54:56][Csc] Helpers\StatisticsUtility.cs(35, 50): error CS1518: Expected class, delegate, enum, interface, or struct
[07:54:56][Csc] Helpers\StatisticsUtility.cs(38, 21): error CS0116: A namespace does not directly contain members such as fields or methods
[07:54:56][Csc] Helpers\StatisticsUtility.cs(40, 50): error CS1518: Expected class, delegate, enum, interface, or struct
[07:54:56][Csc] Helpers\StatisticsUtility.cs(42, 21): error CS1022: Type or namespace definition, or end-of-file expected
[07:54:56][Csc] Helpers\UrlHelperExtensions.cs(8, 59): error CS1031: Type expected
[07:54:56][Csc] Helpers\UrlHelperExtensions.cs(8, 80): error CS1002: ; expected
[07:54:56][Csc] Helpers\UrlHelperExtensions.cs(10, 55): error CS1519: Invalid token '(' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\UrlHelperExtensions.cs(10, 60): error CS1520: Class, struct, or interface method must have a return type
[07:54:56][Csc] Helpers\UrlHelperExtensions.cs(10, 82): error CS1002: ; expected
[07:54:56][Csc] Helpers\UrlHelperExtensions.cs(13, 23): error CS1518: Expected class, delegate, enum, interface, or struct
[07:54:56][Csc] Helpers\UrlHelperExtensions.cs(15, 60): error CS1518: Expected class, delegate, enum, interface, or struct
[07:54:56][Csc] Helpers\UrlHelperExtensions.cs(18, 23): error CS1518: Expected class, delegate, enum, interface, or struct
[07:54:56][Csc] Helpers\UrlHelperExtensions.cs(20, 25): error CS1518: Expected class, delegate, enum, interface, or struct
[07:54:56][Csc] Helpers\UrlHelperExtensions.cs(23, 28): error CS1518: Expected class, delegate, enum, interface, or struct
[07:54:56][Csc] Helpers\UrlHelperExtensions.cs(26, 28): error CS1518: Expected class, delegate, enum, interface, or struct
[07:54:56][Csc] Helpers\UrlHelperExtensions.cs(29, 24): error CS1518: Expected class, delegate, enum, interface, or struct
[07:54:56][Csc] Helpers\UrlHelperExtensions.cs(29, 84): error CS1518: Expected class, delegate, enum, interface, or struct
[07:54:56][Csc] Helpers\UrlHelperExtensions.cs(32, 28): error CS1518: Expected class, delegate, enum, interface, or struct
[07:54:56][Csc] Helpers\UrlHelperExtensions.cs(35, 9): error CS1022: Type or namespace definition, or end-of-file expected
[07:54:56][Csc] Helpers\UrlHelperExtensions.cs(23, 26): error CS0101: The namespace '<global namespace>' already contains a definition for '?'
[07:54:56][Csc] Helpers\UrlHelperExtensions.cs(26, 26): error CS0101: The namespace '<global namespace>' already contains a definition for '?'
[07:54:56][Csc] Helpers\UrlHelperExtensions.cs(29, 22): error CS0101: The namespace '<global namespace>' already contains a definition for '?'
[07:54:56][Csc] Helpers\UrlHelperExtensions.cs(29, 83): error CS0101: The namespace '<global namespace>' already contains a definition for '?'
[07:54:56][Csc] Helpers\UrlHelperExtensions.cs(32, 26): error CS0101: The namespace '<global namespace>' already contains a definition for '?'
[07:54:56][Csc] Controllers\SessionController.cs(13, 51): error CS0241: Default parameter specifiers are not permitted
[07:54:56][Csc] Helpers\JsonNetResult.cs(13, 44): error CS1031: Type expected
[07:54:56][Csc] Helpers\JsonNetResult.cs(13, 72): error CS1041: Identifier expected, 'object' is a keyword
[07:54:56][Csc] Helpers\JsonNetResult.cs(13, 91): error CS1002: ; expected
[07:54:56][Csc] Helpers\JsonNetResult.cs(16, 38): error CS1519: Invalid token '=' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\JsonNetResult.cs(16, 59): error CS1519: Invalid token ';' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\JsonNetResult.cs(17, 64): error CS1519: Invalid token '=' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\JsonNetResult.cs(17, 90): error CS1519: Invalid token ';' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\JsonNetResult.cs(18, 32): error CS1519: Invalid token '=' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\JsonNetResult.cs(18, 46): error CS1519: Invalid token ';' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\JsonNetResult.cs(19, 33): error CS1519: Invalid token ';' in class, struct, or interface member declaration
[07:54:56][Csc] Helpers\JsonNetResult.cs(22, 23): error CS1518: Expected class, delegate, enum, interface, or struct
[07:54:56][Csc] Helpers\JsonNetResult.cs(25, 37): error CS1518: Expected class, delegate, enum, interface, or struct
[07:54:56][Csc] Helpers\JsonNetResult.cs(32, 23): error CS1518: Expected class, delegate, enum, interface, or struct
[07:54:56][Csc] Helpers\JsonNetResult.cs(35, 37): error CS1518: Expected class, delegate, enum, interface, or struct
[07:54:56][Csc] Helpers\JsonNetResult.cs(40, 9): error CS1022: Type or namespace definition, or end-of-file expected
[07:54:56][Csc] Mailers\ITripMailer.cs(13, 132): error CS0241: Default parameter specifiers are not permitted
[07:54:56][Csc] Mailers\TripMailer.cs(54, 85): error CS0241: Default parameter specifiers are not permitted
[07:54:56][Csc] Services\Impl\AuthorizationService.cs(12, 70): error CS0241: Default parameter specifiers are not permitted
[07:54:56][Csc] Services\Impl\AuthorizationService.cs(43, 77): error CS0241: Default parameter specifiers are not permitted
[07:54:56][WebSite\WebSite.csproj.teamcity] Project WebSite\WebSite.csproj.teamcity failed.
[07:54:43]网站\WebSite.csproj.teamcity:构建目标:构建(13s)
[07:54:55][WebSite\WebSite.csproj.teamcity]
[07:54:55][CoreCompile]Csc
[07:54:56][Csc]Areas\Api\Services\TripService.cs(19,104):错误CS0241:不允许使用默认参数说明符
[07:54:56][Csc]Helpers\StatisticsUtility.cs(11,35):错误CS1031:预期的类型
[07:54:56][Csc]Helpers\StatisticsUtility.cs(11,53):错误CS1002:;预期
[07:54:56][Csc]Helpers\StatisticsUtility.cs(16,28):错误CS1519:类、结构或接口成员声明中的无效标记“(”
[07:54:56][Csc]Helpers\StatisticsUtility.cs(16,37):错误CS1519:类、结构或接口成员声明中的“”无效标记“”
[07:54:56][Csc]Helpers\StatisticsUtility.cs(17,27):错误CS1519:类、结构或接口成员声明中的无效标记“(”
[07:54:56][Csc]Helpers\StatisticsUtility.cs(17,32):错误CS1519:类、结构或接口成员声明中的“无效标记”)
[07:54:56][Csc]Helpers\StatisticsUtility.cs(23,17):错误CS1519:类、结构或接口成员声明中的“for”标记无效
[07:54:56][Csc]Helpers\StatisticsUtility.cs(23,26):错误CS1519:类、结构或接口成员声明中的令牌“”无效
[07:54:56][Csc]Helpers\StatisticsUtility.cs(25,53):错误CS1519:类、结构或接口成员声明中的“无效标记”)
[07:54:56][Csc]Helpers\StatisticsUtility.cs(27,36):错误CS1519:类、结构或接口成员声明中的标记“=”无效
[07:54:56][Csc]Helpers\StatisticsUtility.cs(27,48):错误CS1519:无效令牌“;”类、结构或接口成员声明中的
[07:54:56][Csc]Helpers\StatisticsUtility.cs(28,36):错误CS1519:类、结构或接口成员声明中的标记“=”无效
[07:54:56][Csc]Helpers\StatisticsUtility.cs(29,37):错误CS1519:类、结构或接口成员声明中的标记“=”无效
[07:54:56][Csc]Helpers\StatisticsUtility.cs(29,48):错误CS0270:无法在变量声明中指定数组大小(请尝试使用“新”表达式初始化)
[07:54:56][Csc]Helpers\StatisticsUtility.cs(29,50):错误CS1519:无效令牌“;”类、结构或接口成员声明中的
[07:54:56][Csc]Helpers\StatisticsUtility.cs(30,33):错误CS1519:类、结构或接口成员声明中的标记“=”无效
[07:54:56][Csc]Helpers\StatisticsUtility.cs(30,44):错误CS0270:无法在变量声明中指定数组大小(请尝试使用“新”表达式初始化)
[07:54:56][Csc]Helpers\StatisticsUtility.cs(30,50):错误CS1519:无效令牌“;”类、结构或接口成员声明中的
[07:54:56][Csc]Helpers\StatisticsUtility.cs(32,21):错误CS0116:命名空间不直接包含字段或方法等成员
[07:54:56][Csc]Helpers\StatisticsUtility.cs(35,50):错误CS1518:应为类、委托、枚举、接口或结构
[07:54:56][Csc]Helpers\StatisticsUtility.cs(38,21):错误CS0116:命名空间不直接包含字段或方法等成员
[07:54:56][Csc]Helpers\StatisticsUtility.cs(40,50):错误CS1518:应为类、委托、枚举、接口或结构
[07:54:56][Csc]Helpers\StatisticsUtility.cs(42,21):错误CS1022:类型或命名空间定义,或应为文件结尾
[07:54:56][Csc]Helpers\UrlHelperExtensions.cs(8,59):错误CS1031:应为类型
[07:54:56][Csc]Helpers\UrlHelperExtensions.cs(8,80):错误CS1002:;预期
[07:54:56][Csc]Helpers\UrlHelperExtensions.cs(10,55):错误CS1519:类、结构或接口成员声明中的标记“(”无效
[07:54:56][Csc]Helpers\UrlHelperExtensions.cs(10,60):错误CS1520:类、结构或接口方法必须具有返回类型
[07:54:56][Csc]Helpers\UrlHelperExtensions.cs(10,82):错误CS1002:;应为
[07:54:56][Csc]Helpers\UrlHelperExtensions.cs(13,23):错误CS1518:应为类、委托、枚举、接口或结构
[07:54:56][Csc]Helpers\UrlHelperExtensions.cs(15,60):错误CS1518:应为类、委托、枚举、接口或结构
[07:54:56][Csc]Helpers\UrlHelperExtensions.cs(18,23):错误CS1518:应为类、委托、枚举、接口或结构
[07:54:56][Csc]Helpers\UrlHelperExtensions.cs(20,25):错误CS1518:应为类、委托、枚举、接口或结构
[07:54:56][Csc]Helpers\UrlHelperExtensions.cs(23,28):错误CS1518:应为类、委托、枚举、接口或结构
[07:54:56][Csc]Helpers\UrlHelperExtensions.cs(26,28):错误CS1518:应为类、委托、枚举、接口或结构
[07:54:56][Csc]Helpers\UrlHelperExtensions.cs(29,24):错误CS1518:应为类、委托、枚举、接口或结构
[07:54:56][Csc]Helpers\UrlHelperExtensions.cs(29,84):错误CS1518:应为类、委托、枚举、接口或结构
[07:54:56][Csc]Helpers\UrlHelperExtensions.cs(32,28):错误CS1518:应为类、委托、枚举、接口或结构
[07:54:56][Csc]Helpers\UrlHelperExtensions.cs(35,9):错误CS1022:类型或命名空间定义,或预期文件结尾
[07:54:56][Csc]Helpers\UrlHelperExtensions.cs(23,26):错误CS0101:命名空间“”已包含“?”的定义
[07:54:56][Csc]Helpers\UrlHelperExtensions.cs(26,26):错误CS0101:命名空间“”
/p:DeployOnBuild=true
/p:PublishProfile='siteone - Web Deploy'
/p:Password=%password%
msbuild.exe PublishOnlyOne.sln /p:DeployOnBuild=true /p:PublishProfile=’siteone – Web Deploy’ /p:Password=%password%
<PropertyGroup>
<DeployOnBuild Condition=" '$(DeployProjA)'!='' ">$(DeployProjA)</DeployOnBuild>
</PropertyGroup>
msbuild.exe PublishOnlyOne.sln /p:DeployProjA=true /p:PublishProfile=’siteone – Web Deploy’ /p:Password=%password%
msbuild.exe YourSolutionName.sln /T:"Your_Poject_Name" /P:DeployOnBuild=true /P:PublishProfile=YourPublishProfile.pubxml
msbuild.exe YourSolutionName.sln /T:"Your_Poject_Name:Rebuild" /P:DeployOnBuild=true /P:PublishProfile=YourPublishProfile.pubxml
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>

    <IsPublishable>false</IsPublishable>
  </PropertyGroup>
...
</Project>
    <IsPublishable Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'>false</IsPublishable>