【问题标题】:Building a nuget .Net Framework web application package using msbuild and TeamCity?使用 msbuild 和 TeamCity 构建 nuget .Net Framework Web 应用程序包?
【发布时间】:2021-05-08 21:47:37
【问题描述】:
使用 TeamCity 创建 Web 应用程序 nuget 包的方法是什么?
在 .NET 成为一件事之后,我完全感到困惑。
我正在尝试做的是创建一个包含 .Net Framework 4.8 Web 应用程序的 nuget 包。
以前的工作方式似乎已经过时或已弃用。
在 TeamCity 中,以前使用的元运行器要么已弃用,要么运行不佳。
当我在谷歌搜索 f.ex 时。构建
https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package-msbuild
我得到关于 .Net Core 和 .Net Standard 的资料,没有关于 .Net Framework 的资料。而且这些东西通常有 10 年或更长时间。
在了解 nuget 在 .NET 中的工作方式之后,我可能会变得愚蠢,因为一切都与项目相关联,您实际上可以避免将代码(cs 文件)与 Web 应用程序一起发布。
【问题讨论】:
标签:
msbuild
nuget
teamcity
.net-framework-4.8
【解决方案1】:
到目前为止,我得到的最接近的方法是制作一个全面的 .nuspec 文件,然后在构建项目并使用所有必要的依赖项之后在 Web 应用程序的项目目录中运行。
但是,构建输出会记录警告:
WARNING: NU5100: The assembly 'bin\Antlr3.Runtime.dll' is not inside the 'lib' folder and hence it won't be added as a reference when the package is installed into a project. Move it into the 'lib' folder if it needs to be referenced.
nuget pack 命令
nuget pack <path to nuspec file>
nuspec 文件:
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>MyPackageId</id>
<version>1.0.0.0</version>
<title>My application title</title>
<authors>my authors</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Some description</description>
<releaseNotes>Summary of changes made in this release of the package.
</releaseNotes>
<copyright>My copyright</copyright>
<tags>framework application</tags>
</metadata>
<files>
<file src="bin\**\*.*" target="bin"/>
<file src="Content\**\*.*" target="Content"/>
<file src="Resources\**\*.*" target="Resources" exclude="**\*.cs"/>
<file src="Scripts\**\*.*" target="Scripts" />
<file src="Views\**\*.*" target="Views" />
<file src ="favicon.ico" target=""/>
<file src ="Global.asax" target=""/>
<file src ="Log4Net.config" target=""/>
<file src ="StrongNameKeyFile.snk" target=""/>
<file src ="Web.config" target=""/>
</files>
</package>
相当全面...