Hello,
I want to create nuget package from an asp.core MVC project.
The project look like this
MyProject
–.Nuget
-----MyProject.Nuspec
–Content
----Img
------myimage.gif
–Script
----myscript.js
–.gitlab-ci.yml
–MyProject.csproj
–MyProject.sln
In this project, I add a .nuget folder with a .nuspec file
Here is the content
<?xml version="1.0"?>
<package>
<metadata>
<id>myProject</id>
<version>$version$</version>
<authors>MyName</authors>
<owners>MyName</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>myProject</description>
<releaseNotes>First implementation with nuget</releaseNotes>
<copyright>Copyright © ME</copyright>
<dependencies>
<dependency id="jQuery" version="[3.2.1]" />
<dependency id="bootbox" version="[4.3.0]" />
</dependencies>
</metadata>
<files>
<file src="..\Content\img\myimage.gif" target="content\Content\img" />
<file src="..\Script\*.js" target="content\Scripts" />
</files>
</package>
And here is the content of the yml for continuous integration
image : microsoft/dotnet:latest
before_script:
- 'dotnet restore myProject.sln'
stages:
- build
- test
- deploy
job1:
stage: build
script:
- 'dotnet msbuild MyProject.sln /t:Clean,ReBuild /p:Configuration=Debug;Platform="Any CPU"'
- 'dotnet msbuild MyProject.sln /t:ReBuild /p:Configuration=Release;Platform="Any CPU"'
- 'dotnet pack "MyProject.csproj" /p:NuspecFile=".Nuget/*.nuspec" -v n --include-source --include-symbols --no-build'
- 'dotnet nuget push *.nupkg -k myApi -s https://www.myget.org/F/myfeed/api/v2/package'
only:
- master
The build is ok, The pack command seems to work well, but the nuget push generate an error
error: File does not exist (*.nupkg).
I try on my computer, the command generate an nupkg in the bin/Debug folder. So, I change the push line with this
- ‘dotnet nuget push /bin/Debug/*.nupkg -k myApi -s https://www.myget.org/F/myfeed/api/v2/package’
Same error.
I put a lot of dir cmd in my yml in order to see where the nupkg could be generated. I couldn’t find anyone.
Any help is welcome
Thanks
Damien