Appveyor seems to ignore infomational version - nuget-package

I'm trying to get my NuGet package to be versioned by AssemblyInformationalVersion while keeping AssemblyVersion same. I use tag $version$ in my .nuspec.
However, if I build NuGet using appveyor, it keeps up using AssemblyVersion.
My appveyor.yaml:
version: 1.0.{build}
pull_requests:
do_not_increment_build_number: true
configuration: Release
assembly_info:
patch: true
file: '**\AssemblyInfo.*'
assembly_file_version: '{version}'
assembly_informational_version: '{version}'
before_build:
nuget restore
build:
publish_nuget: true
parallel: true
verbosity: minimal
deploy:
provider: NuGet
api_key: <SKIPPED>
My .nuspec excerpt
<metadata>
....
<version>$version$</version>
....
</metadata>
UPD:
I checked that informational version set correctly to files:
Also, I don't know if it related, but it seems to ignore my <files> directive and put everything into lib instead of analyzers\dotnet\cs

This often happens if AssemblyInfo.* file does not contain AssemblyInformational tag. In this case AppVeyor has nothing to patch.

Related

Azure DevOps AssemblyInfo task errors with The specified version string does not conform to the required format - major[.minor[.build[.revision]]]

I'm trying to use the following Azure DevOps task in my build.
https://marketplace.visualstudio.com/items?itemName=bleddynrichards.Assembly-Info-Task
My task looks like this:
- task: Assembly-Info-NetCore#3
inputs:
Path: '$(Build.SourcesDirectory)'
FileNames: '**/*.csproj'
InsertAttributes: true
FileEncoding: 'auto'
WriteBOM: false
VersionNumber: '1.0.$(Build.BuildNumber)'
FileVersionNumber: '1.0.$(Build.BuildNumber)'
PackageVersion: '1.0.$(Build.BuildNumber)'
LogLevel: 'verbose'
FailOnWarning: false
DisableTelemetry: false
When the task runs, I see it works:
Assembly neutral language:
Assembly version: 1.0.20220223.2
Assembly file version: 1.0.20220223.2
Informational version:
When I tried to build the app, I get the following error:
AssemblyInfo.cs(15,59): warning CS7035: The specified version string does not conform to the recommended format - major.minor.build.revision...specific csproj
There is a hard limit on the max size of each component of the version number for assemblyversion(possibly AssemblyFileVersion too), UInt16.MaxValue/65535, and anything above that will cause a compile error.
This is detailed here -> https://learn.microsoft.com/en-us/dotnet/api/system.reflection.assemblyversionattribute?view=net-6.0 in the remark section.
I had a similar thing and had to rework the build number format to get it to work.

How to configure a Microsoft-hosted agent to build an EXE preferring 32-bit?

I have a Windows Service project hosted on DevOps repository and the .csproj file of this project has the "Prefer32Bit" option enabled, and VS already outputs an EXE that runs as 32-bit process.
However, the EXE outputted from DevOps build agent doesn't prefer 32-bit (I checked this with CorFlags.exe).
I tried adding the OSArchitecture build variable as in this page, but it didn't work.
Any suggestions?
Assuming that you are using the VSBuild task, please try modifying the platform to x86:
# Visual Studio build
# Build with MSBuild and set the Visual Studio version property
- task: VSBuild#1
inputs:
#solution: '**\*.sln'
#vsVersion: 'latest' # Optional. Options: latest, 16.0, 15.0, 14.0, 12.0, 11.0
#msbuildArgs: # Optional
#platform: # Optional
#configuration: # Optional
#clean: false # Optional
#maximumCpuCount: false # Optional
#restoreNugetPackages: false # Optional
#msbuildArchitecture: 'x86' # Optional. Options: x86, x64
#logProjectEvents: true # Optional
#createLogFile: false # Optional
#logFileVerbosity: 'normal' # Optional. Options: quiet, minimal, normal, detailed, diagnostic
Reference: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/build/visual-studio-build?view=azure-devops#yaml-snippet
The problem is that I configured Prefer 32-bit in the Debug (not the Release) build configuration.

An assembly specified in the application dependencies manifest was not found

So I have a .NET Core 2.2 web application.
I added the EPPlus library to it and now, when it is released to Azure (App Service) it won't start and I get the error:
HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure
I narrowed this down by running a console in Azure and the command: "dotnet my.project.dll" - and got the actual error:
An assembly specified in the application dependencies manifest
(my.project.deps.json) was not found:
package: 'Microsoft.Win32.SystemEvents', version: '4.5.0'
path: 'runtimes/win/lib/netcoreapp2.0/Microsoft.Win32.SystemEvents.dll'
The Microsoft.Win32.SystemEvents.dll is present in the main wwwroot folder the application is deployed to.
But the whole runtimes/win/libs/ folder I don't think exists at all.
The my.project.deps.json files has the section which looks like this:
"Microsoft.Win32.SystemEvents/4.5.0": {
"dependencies": {
"Microsoft.NETCore.Platforms": "2.2.0"
},
"runtime": {
"lib/netstandard2.0/Microsoft.Win32.SystemEvents.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.6.26515.6"
}
},
"runtimeTargets": {
"runtimes/win/lib/netcoreapp2.0/Microsoft.Win32.SystemEvents.dll": {
"rid": "win",
"assetType": "runtime",
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.6.26515.6"
}
}
}
If I delete the whole "runtimeTargets" section, then the application works! (Well, I have to do the same for a few more dll's too: System.Drawing.Common and System.Security.Cryptography.Pkcs)
But the file gets regenerated fully whenever it is published and released - so it is not a viable solution.
I also don't know what that section of the file does. It might be important to leave it in. Though it all works so it can't be that vital...
It is built and published through TeamCity - I'm not an expert on the process but I think the command being run amounts to this:
dotnet publish my.proj.csproj --configuration RELEASE --no-restore --no-build
Other things tried: < PublishWithAspNetCoreTargetManifest>false< / PublishWithAspNetCoreTargetManifest>
had no effect
Anyone have any ideas?
As it turns out, it was my fault :(
Team City was created a NuGet package from the published output. But the /runtimes folder was not included in the package so was never released as part of the site.
I edited the nuspec file to include it /runtimes and all works OK.
I've had same issue. After the build I copied all files to the "production" directory by DOS command copy so then the files from "runtimes" subfolder were missing. Copying all files including all subdirectories (by using xcopy) fixed the issue.

Azure DevOps setting up multiple feeds for restoring packages

Trying to setup a Azure DevOps pipeline and currently Restore packages is failing for my ServiceStack package because the version I need is not in the default nuget.org feed. The version I want is in a MyGet.org feed.
How and where do I setup the additional MyGet feed in the dev.azure.com portal for this additional package so Azure DevOps can restore it?
https://www.myget.org/F/servicestack
NuGet Config files used:
D:\a\1\Nuget\tempNuGet_1.config
Feeds used:
https://api.nuget.org/v3/index.json
Installed:
78 package(s) to D:\a\1\s\SomeApi\SomeApi.csproj
Done executing task "RestoreTask" -- FAILED.
1>Done building target "Restore" in project "SomeApi.csproj" -- FAILED.
1>Done Building Project "D:\a\1\s\SomeApi\SomeApi.csproj" (Restore target(s)) -- FAILED.
Build FAILED.
"D:\a\1\s\SomeApi\SomeApi.csproj" (Restore target) (1) ->
(Restore target) ->
D:\a\1\s\SomeApi\SomeApi.csproj : error NU1102: Unable to find package ServiceStack with version (>= 5.4.1)## Heading ##
D:\a\1\s\SomeApi\SomeApi.csproj : error NU1102: - Found 181 version(s) in nuget.org [ Nearest version: 5.4.0 ]
0 Warning(s)
1 Error(s)
Azure DevOps setting up multiple feeds for restoring packages
You could right click your solution on the Solution Explorer, then add a nuget.config file with following content:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="MyGetCustomFeed" value="https://dotnet.myget.org/xxx/v3/index.json" />
</packageSources>
<packageSourceCredentials>
<MyGetCustomFeed>
<add key="Username" value="xxx" />
<add key="ClearTextPassword" value="xxxx" />
</MyGetCustomFeed>
</packageSourceCredentials>
</configuration>
Then submit this file to your repos, and in the nuget restore task select this file:
Hope this helps.
Where ever you're running nuget restore should reference a local copy of NuGet.config. Example restore using a custom NuGet.config in Docker:
$ RUN dotnet restore --configfile ../NuGet.Config
Alternatively if the NuGet.Config is next to your .sln it should automatically be used.

Symfony2: Unrecognized options "method_access_control" under "jms_security_extra" error

So I'm trying to configure security access for some of my methods here, through JMSSecurityExtraBundle. I simply followed the instructions here : JMSSecurityBundle Doc.
I ended up having this in my config.yml file:
jms_security_extra:
secure_controllers: true
secure_all_services: false
method_access_control:
'MyBundle:.*:postEntityDelete': 'hasRole("ROLE_SUPER_ADMIN")'
Now I'm simply getting that error:
InvalidConfigurationException: Unrecognized options "method_access_control" under "jms_security_extra"
How can I have gone wrong on so little? Where's the catch and how do I solve this problem?
Thanks in advance!
Edit:
Deps :
[JMSSecurityExtraBundle]
git=https://github.com/schmittjoh/JMSSecurityExtraBundle.git
target=/bundles/JMS/SecurityExtraBundle
[metadata]
git=https://github.com/schmittjoh/metadata.git
version=1.1.0 ; <- make sure to get 1.1, not 1.0
[JMSAopBundle]
git=https://github.com/schmittjoh/JMSAopBundle.git
target=/bundles/JMS/AopBundle
[cg-library]
git=https://github.com/schmittjoh/cg-library.git
[JMSDiExtraBundle]
git=https://github.com/schmittjoh/JMSDiExtraBundle.git
target=/bundles/JMS/DiExtraBundle
Deps.lock:
symfony v2.0.13
twig v1.7.0
monolog 1.0.2
doctrine-common 2.1.4
doctrine-dbal 2.1.6
doctrine 2.1.6
swiftmailer v4.1.7
assetic v1.0.3
twig-extensions 446d870272cd87a720e95242eade38a2acf56eaa
metadata 1.0.0
SensioFrameworkExtraBundle cb61b92ed55241d93ed9726bc3f5f47c7d2ce8fe
JMSSecurityExtraBundle e752f888c51425f71382c056961f10f2be642102
SensioDistributionBundle 20b66a408084ad8752f98e50f10533f5245310bf
SensioGeneratorBundle b1ccb78c1743f30817b0fce9bb5c6baff6ed7bf8
AsseticBundle v1.0.1
What version of symfony and of the bundle are you using? The documentation you linked is following the master branch. There are links in the upper left to change versions. 1.0 doesn't seem to have that configuration option.
the deps file should contain:
[JMSSecurityExtraBundle]
git=http://github.com/schmittjoh/JMSSecurityExtraBundle.git
target=/bundles/JMS/SecurityExtraBundle
version=origin/master
You can also see here for someone else that had the same issue https://github.com/schmittjoh/JMSSecurityExtraBundle/issues/24

Resources