Closed lwiechec closed 6 years ago
Here's the syntax: https://github.com/Albacore/albacore/wiki/build
@haf sorry for confusion.
But when I remove it from build task and do this:
desc "Check the difference between the filesystem and the files referenced in a csproj"
csprojfiles do |f|
# Files to ignore
# for instance if you have source control specific files that are not supposed to be in the project
f.ignore_files = [/.*\.srccontrol/]
f.project = "src/MyMvcSite/MyMvcSite.csproj"
end
I am getting this:
rake aborted!
NoMethodError: undefined method `csprojfiles' for main:Object
/home/luke/fun/dotnet/NCIA.CCIF/ServiceClients/CSDQuery/Rakefile:15:in `<top (required)>'
/home/luke/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
/home/luke/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)
What I am doing wrong?
Wow, I haven't used that feature in 4 years.
https://github.com/Albacore/albacore/blob/master/lib/albacore/tasks/projectlint.rb#L35 is its home.
So with this config https://github.com/Albacore/albacore/blob/master/lib/albacore/tasks/projectlint.rb#L9
Albacore::Tasks::ProjectLint.new do |f|
f.project = ''
f.ignores = [ ... ]
end
Could you try it an update the docs, please?
Thanks. Now it loads the task but the check seem not to do anything.
My setup (I wrap it in task
):
task :check do
puts "checking if project file is consistent with the disk..."
Albacore::Tasks::ProjectLint.new do |f|
f.project = './ClientServiceLibrary.csproj'
#f.ignores = [ '/.git/*' ]
end
end
while my project file includes this:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
...
<ItemGroup>
<Compile Include="FileThatExists.cs" />
<Compile Include="FileThatIsNotThereExists.cs" /> <!-- not existing, ProjectLint should find it out -->
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
...
(C# sources are in the same dir as project files).
I don't see any error messages anywhere?...
So ... you declare ProjectLint outside of a task, otherwise your task just declares another task.
thanks. But even if I put project linter outside of the task (looking at the top of Rakefile
):
require 'bundler/setup'
require 'albacore'
# require 'albacore/tasks/release'
require 'albacore/tasks/versionizer'
require 'albacore/ext/teamcity'
require 'albacore/tasks/projectlint'
# take build configuration from the environment; 'Release' by default
Configuration = ENV['CONFIGURATION'] || 'Release'
Albacore::Tasks::Versionizer.new :versioning
# check!
puts "checking if project file is consistent with the disk..."
Albacore::Tasks::ProjectLint.new do |f|
f.project = './NCIA.CCIF.CSDQuery.ClientServiceLibrary.csproj'
#f.ignores = [ '/.git/*' ]
end
# other tasks follow
it still does not complain about the file that is listed in the *.csproj
file and not on disk...
That puts
does not do what you expect; the role of the rakefile is to declare tasks. You need to name the task something, e.g. Albacore::Tasks::ProjectLint.new :check do |f|
and run it bundle exec rake check
or depend on it.
hi - and thanks for a lesson in the syntax of Rakefiles! it worked. Big thanks!!!
Perhaps in return you can update our wiki, please?
Just did it - can you check if you like it? (https://github.com/Albacore/albacore/wiki/csprojfiles)
---- On Ter, 06 mar 2018 18:20:54 +0100 Henrik Feldt <notifications@github.com> wrote ----
Perhaps in return you can update our wiki, please?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
@lwiechec Looks good!
Hi,
I really like the
csprojfiles
tool that checks if MSBuild project files match what's on the disk but - I cannot find it anywhere in the code - am I using it wrong? In myRakefile
I have: