FxCop Nant Task Error: Error creating FileSet - nant

I am getting following error whenever I run fxcop nant task.
Error creating FileSet.
Does anybody know what could be the reason?
Thanks,
Sachin

I got the reason behind the issue. Recently I had downloaded Binary Zip of latest NantContrib project. After downloading the zip, I extracted it without unblocking. As I am using Windows Server 2008, all assemblies extracted from the zip were blocked. The FxCop nant task is defined in NAnt.Contrib.Tasks.dll(which was locked). FxCop task needs IO permission to save report on the machine. Since the file were blocked, fxcop task was throwing exception due to lack of IO permissions.
To resolve this, I just unblocked the zip and re-extracted the NantContrib files. Thereafter everything worked fine.
Thanks Soner!!! Sorry about not being so specific :)
Thanks,
Sachin P

Related

MSBuild publish stopped working out of nowhere

For a very long time the following command worked as expected:
msbuild /property:Configuration=Release /property:TransformConfigFiles=true /property:DeployOnBuild=true /property:PublishProfile=FolderProfile /verbosity:normal /target:Rebuild /fileLogger /nologo /m Ticket.Corporativo.sln
By "expected" I mean, the project is built, then "packaged" into a "pkg" folder according to a publish profile called "FolderProfile" which is a simple file system deployment.
The last time it worked as expected was 2019-01-30. On the daily build of the 31st, the 'pkg' folder of "FolderProfile" was no longer created. Checking the build server, nothing we could track was changed... no updates, no nothing!
I've run out of ideas or items to check that could explain this failure... can anyone help?
PS:
-MSBuild version is 14.0
-Project being built
-Works on local machine as expected
I figured it out: Apparently, on my local machine, I added a reference to a package that was not available in our internal NUGET (only available on the public NUGET), which is the only source the builder machine has access... that caused an error, but was not reported as such, it failed silently... after copying the nuget pack to out server, it worked again perfectly

SimpleAuthencation throwing "Failed to reflect on the current domain's Assemblies while searching for plugins"

I have a NancyFX web project using SimpleAuthentication that works fine when self-hosting from the terminal. When I self-host from unit tests (NUnit runner with Xamarin Studio), I receive exception "Failed to reflect on the current domain's Assemblies while searching for plugin" with error message "Could not load file or assembly or one of its dependencies." repeated many times.
Any idea why this would fail? This looks like the code throwing the exception is at https://github.com/SimpleAuthentication/SimpleAuthentication/blob/master/Code/SimpleAuthentication.Core/ReflectionHelpers.cs. I tried a IntPtr.Size measurement to make sure they are running in the same 32/64 bitness in both cases (it is running 32-bit).
UPDATE: Per recommendation, I tried to run some prerelease builds to the same resulting, ending up with these binaries:
./Nancy.1.3-Pre1524/lib/net40/Nancy.dll
./Nancy.Authentication.Forms.1.3-Pre1524/lib/net40/Nancy.Authentication.Forms.dll
./Nancy.FlashMessages.1.0.4.0/lib/net45/Nancy.FlashMessages.dll
./Nancy.FlashMessages.Razor.1.0.4.0/lib/net45/Nancy.FlashMessages.Razor.dll
./Nancy.Hosting.Self.1.3-Pre1524/lib/net40/Nancy.Hosting.Self.dll
./Nancy.SimpleAuthentication.0.3.14/lib/net40/Nancy.SimpleAuthentication.dll
./Nancy.Viewengines.Razor.1.3-Pre1524/BuildProviders/Nancy.ViewEngines.Razor.BuildProviders.dll
./Nancy.Viewengines.Razor.1.3-Pre1524/lib/net40/Nancy.ViewEngines.Razor.dll
UPDATE: Running the ReflectionHelpers.cs code in isolation shows that the only DLL failing to load is MonoDevelop.NUnit. The NUnit dll is unneeded for this part anyhow.
I suppose I should contemplate https://github.com/SimpleAuthentication/SimpleAuthentication/issues/144
I fixed this with GetLoadableTypes from this post from #haacked http://haacked.com/archive/2012/07/23/get-all-types-in-an-assembly.aspx/
And here it's the PR (https://github.com/SimpleAuthentication/SimpleAuthentication/pull/171)
I didn't had the problem with Nunit I had the problem with Microsoft.Owin.Security.DataProtection.DpapiDataProtector that it's not implemented in Mono....

Ant MailLogger problem

I'm trying to establish MailLogger as the principle logger for my ant build. When I launch the ant build, I add the parameters -DMailLogger.properties.file=mail.properties -logger org.apache.tools.ant.listener.MailLogger. When the build finishes, it first tells me it couldn't send the e-mail and then it spits out the call stack:
BUILD SUCCESSFUL
Total time: 1 second
MailLogger failed to send e-mail!
java.lang.NullPointerException
at org.apache.tools.ant.taskdefs.email.MimeMailer.send(MimeMailer.java:206)
at org.apache.tools.ant.listener.MailLogger.sendMimeMail(MailLogger.java:332)
at org.apache.tools.ant.listener.MailLogger.buildFinished(MailLogger.java:143)
at org.apache.tools.ant.Project.fireBuildFinished(Project.java:2037)
at org.apache.tools.ant.Main.runBuild(Main.java:778)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
If I attempt the same thing without MailLogger.user and MailLogger.password set in mail.properties, it informs me that I wasn't authenticated (and correctly so).
I've included ant-javamail.jar which contains MimeMailer.class and as far as I can tell it's in the classpath along with all the other jars for ant. Perhaps I'm doing something wrong, but NullPointerException is certainly not helping me understand what it is.
I'm using Ant version 1.7.1. Any help would be greatly appreciated! I'm tearing my hair out!
It's an Ant bug - 44999. Looks like it's fixed in Ant 1.8.

Problem Publishing NUnit Testing Result Reports with Hudson

I am facing a problem with Hudson and NUnit testing. When trying to publish the Test Result Report for NUnit, the option in Hudson, i.e., "Publish NUnit Test Result Reports", is creating a problem. I am unable to provide the Path of the already-created XML file under the workspace folder of the Job. When I set the path of my file, i.e., "nunit-result.xml" and run the job, it throws an error:
"No test report files were found. Configuration error?"
Can anyone please help me out?
Thanks in advance.
Check the the beginning of the log where the clone is made. Sometimes when you have the "Enable concurrent builds" option it triggers another build in a different workspace called your-project-name#2/source and that's why it can't find the reports

build failed executing nant

I've got a nant build script (.86 beta) and it is telling me this:
BUILD FAILED
Failed to initialize the 'Microsoft
.Net Framework 2.0' target
framework.
The process cannot access the file
'C:\Users\cconway\AppData\Local\Temp\tmp25E3.tmp'
because it is being used by another
process.
This file does not even exist on my machine. Does anyone know the cause of this? Rebooting seems to allow me to run the script once successfully, but every time after that I get this message (though the name of the tmp file changes per reboot).
Thanks!
Are there any third-party tasks which might leave temp files open or keep running in the background, thus leaving file locked?
Maybe try sysinternals process monitor which will allow you to see the process which has the handle on this file.
Also, make sure that you have all the right versions of .Net installed and they are the correct ones (SDK vs Runtime). If you open the config file for nant you can see where it expects the .net version to be go check to make sure it's there and that you can see hte compiler methods (csc, vbc, etc). So it could have something that is trying to find it but it's not there or the pathing is off.
It is beta so there could even be a typo in the config file.
The answer is my anti-virus. I should have tried disabling that first! Once I disabled it, everything worked like a charm.
Hope this helps someone.