In running on prem with TFS 2017.
I'm trying to create a NuGet package from a .NET Standard project. It's a simple class library that adds some exception handling to Dapper - another NuGet package.
My csproj file is shown below, and when I run the build with the NuGet Packager step, if fails with the error of "The attribute "Version" in element
Note that I did modify the csproj file to include the xmlns attribute based on another error that I got. And I'm not using a .nuspec file (hoping that I don't need one).
Any insight / guidance / advice would be most appreciated.
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Authors>Erik Dahl</Authors>
<Company>MyCompany</Company>
<Product>My Product</Product>
<Description>Wrappers for Dapper methods that include sql text and parameters in any thrown exception.</Description>
<PackageTags>ORM DataAccess ADO</PackageTags>
<PackageProjectUrl>http://tfsserver:8080/tfs/DefaultCollection/myproject/_git/DapperExceptional?_a=preview&path=%2FREADME.md&version=GBmaster</PackageProjectUrl>
<RepositoryUrl>http://tfsserver:8080/tfs/DefaultCollection/myproject/_git/DapperExceptional</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Dapper" version="1.50.4" />
</ItemGroup>
</Project>
Here is the full error log for this step:
2018-02-21T18:37:45.4352545Z ##[section]Starting: NuGet Packager
2018-02-21T18:37:45.4362546Z ==============================================================================
2018-02-21T18:37:45.4362546Z Task : NuGet Packager
2018-02-21T18:37:45.4362546Z Description : Creates nupkg outputs from csproj or nuspec files
2018-02-21T18:37:45.4362546Z Version : 0.1.72
2018-02-21T18:37:45.4362546Z Author : Lawrence Gripper
2018-02-21T18:37:45.4362546Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=627416)
2018-02-21T18:37:45.4362546Z ==============================================================================
2018-02-21T18:37:45.4472543Z Preparing task execution handler.
2018-02-21T18:37:46.0603119Z Executing the powershell script: F:\buildagent\agent-BLD-A\_work\_tasks\NuGetPackager_333b11bd-d341-40d9-afcf-b32d5ce6f24b\0.1.72\NuGetPackager.ps1
2018-02-21T18:37:46.4763487Z Find-Files -SearchPattern F:\buildagent\agent-BLD-A\_work\3\s\**\*.csproj -RootFolder F:\buildagent\agent-BLD-A\_work\3\s
2018-02-21T18:37:46.4773474Z
2018-02-21T18:37:46.4773474Z
2018-02-21T18:37:46.5383600Z F:\buildagent\agent-BLD-A\externals\nuget\NuGet.exe pack "F:\buildagent\agent-BLD-A\_work\3\s\DapperExceptional\DapperExceptional.csproj" -OutputDirectory "F:\buildagent\agent-BLD-A\_work\3\s" -IncludeReferencedProjects
2018-02-21T18:37:47.4044371Z MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'.
2018-02-21T18:37:47.4054376Z Attempting to build package from 'DapperExceptional.csproj'.
2018-02-21T18:37:47.4584413Z ##[error]The attribute "version" in element <PackageReference> is unrecognized. F:\buildagent\agent-BLD-A\_work\3\s\DapperExceptional\DapperExceptional.csproj
2018-02-21T18:37:47.4834490Z ##[error]System.Exception: Unexpected exit code 1 returned from tool NuGet.exe
2018-02-21T18:37:47.4894439Z at Microsoft.TeamFoundation.DistributedTask.Task.Internal.InvokeToolCmdlet.ProcessRecord()
2018-02-21T18:37:47.4894439Z at System.Management.Automation.CommandProcessor.ProcessRecord()
2018-02-21T18:37:47.5304483Z ##[error]PowerShell script completed with 1 errors.
2018-02-21T18:37:47.5314488Z ##[section]Finishing: NuGet Packager
I was able to get this working without .nuspec -- but not with NuGet.exe. I used dotnet pack and that did the trick. I'm guessing I should leave this issue open -- thinking that this issue with NuGet.exe should be addressed. I tried a few different versions of NuGet.exe - including 4.5.1 and 4.6.0-preview3.
Hi, I m using Jenkins to build my project but m getting the following error
`
Build started 3/27/2018 2:30:27 PM.
Project "D:\PSAVWorkSpacesabcd\Dev\ReleaseAabcdabcdabcd.Droidabcd.Droid.csproj" on node 1 (SignForAndroid target(s)).
D:\PSAVWorkSpacesabcd\Dev\ReleaseAabcdabcdabcd.Droidabcd.Droid.csproj(113,47): error MSB4066: The attribute "Version" in element
Done Building Project "D:\PSAVWorkSpacesabcd\Dev\ReleaseAabcdabcdabcd.Droidabcd.Droid.csproj" (SignForAndroid target(s)) -- FAILED.
Build FAILED.
"D:\WorkSpacesabcdabcdabcd.Droidabcd.Droid.csproj" (SignForAndroid target) (1) ->
D:\WorkSpacesabcdabcdabcd.Droidabcd.Droid.csprojj(113,47): error MSB4066: The attribute "Version" in element
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.01
Build step 'Build a Visual Studio project or solution using MSBuild' marked build as failure
Finished: FAILURE`
can anyone help me with this
thankyou
@dahlsailrunner ,
This isn't a problem with the nuget task. This is a problem with nuget.exe itself. I would open an issue against their GH repo.
<PackageReference Include="Dapper" version="1.50.4" />
@dahlsailrunner maybe this was because of casing? I've only seen Version (uppercase V) in my projects.
Most helpful comment
I was able to get this working without .nuspec -- but not with NuGet.exe. I used dotnet pack and that did the trick. I'm guessing I should leave this issue open -- thinking that this issue with NuGet.exe should be addressed. I tried a few different versions of NuGet.exe - including 4.5.1 and 4.6.0-preview3.