Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
284 views
in Technique[技术] by (71.8m points)

Building a nuget .Net Framework web application package using msbuild and TeamCity?

What is the method to create a web application nuget package with TeamCity?

I'm totally confused after .NET became a thing. What I'm attempting to do, is to create a nuget package with a .Net Framework 4.8 webapplication in it.

The ways things worked before, seems to be outdated or deprecated. In TeamCity, the meta runners that were used previously are either deprecated or not functioning very well.

When I'm googling f.ex. msbuild https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package-msbuild I get stuff about .Net Core and .Net Standard, nothing about .Net Framework. And the stuff is often 10 years old or more.

I might have gone stupid after how nuget works in .NET, since everything is tied to projects and you can actually avoid having code shipped (the cs files) with the web application.

question from:https://stackoverflow.com/questions/66048245/building-a-nuget-net-framework-web-application-package-using-msbuild-and-teamci

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The closest I've gotten so far, is by making a comprehensive .nuspec file, then run in the project directory of the web application after the project has been built with all necessary dependencies.

However, the build output will log warnings:

    WARNING: NU5100: The assembly 'binAntlr3.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.

The nuget pack command

nuget pack <path to nuspec file> 

The nuspec file:

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

Rather comprehensive ...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...