FR: project includes

.NET obfuscator and automated error reporting

Moderators: Luke Jefferson, Alex.Davies, melvyn.harbour

FR: project includes

Postby Uniwares_AS » Fri Jun 25, 2010 5:58 pm

Feature Request: include for project settings

Having about 30 SA project files to maintain for a single solution (and there are much larger ones out there) its a real pain to either hand edit each one or even worse, modify it with the GUI app.

How nice would it be to be able to do something like
Code: Select all
<Include File="solutionwideassemblies.{sa}inc" />

where the .{sa}inc file contains my list of assemblies references and settings used in all my SA projects for this solution.
I understand that this cant be managed by the GUI app anymore (at least not with acceptable effort) but who uses MSBuild doesn't care much about this anyway.
Same could be applied to the <Options> section, settings like <Company>, etc.
Would make life for larger solutions a lot easier.
Uniwares_AS
 
Posts: 132
Joined: Thu Oct 11, 2007 3:29 pm

Use input parameter

Postby Ed » Mon Jun 28, 2010 2:32 pm

You can try to use the Input option when calling SA. Then you can use the same file. I am trying something like this on my build server:

Code: Select all
<SmartAssembly.MSBuild.Tasks.Build ProjectFile="$(DeploymentRoot)\\CommonFile.saproj"
         Input="$(DeploymentRoot)\\Target1.dll"
         OverwriteAssembly="True"
         MarkAsReleased="True" />
<SmartAssembly.MSBuild.Tasks.Build ProjectFile="$(DeploymentRoot)\\CommonFile.saproj"
         Input="$(DeploymentRoot)\\Target2.dll"
         OverwriteAssembly="True"
         MarkAsReleased="True" />
Ed
 
Posts: 5
Joined: Wed Jun 16, 2010 8:55 pm

Postby Uniwares_AS » Mon Jun 28, 2010 2:35 pm

While its a bit like carrying the church around the cross, it might work. Will give it a try.
Uniwares_AS
 
Posts: 132
Joined: Thu Oct 11, 2007 3:29 pm

Postby Uniwares_AS » Tue Jun 29, 2010 1:34 am

Ok, gave it a try but got stuck on an bad error message.

ERROR: Some options are not set or are not valid.
Please review all the settings and try again.


The options themselves cant be wrong since they are copied from a 100% working project file. The GUI app asks for an input and output file and builds fine. No errors.

What did I do? Added all the assemblies of all libraries (around 30) which I am going to protect to the project file and call the commandline app with the -input parameter which is one of the assemblies in the project.
Uniwares_AS
 
Posts: 132
Joined: Thu Oct 11, 2007 3:29 pm

Postby Paul.Martin » Tue Jun 29, 2010 11:33 am

Are you specifying an -output parameter as well?
Paul.Martin
 
Posts: 83
Joined: Wed Feb 03, 2010 11:20 am
Location: Cambridgeshire

Postby Paul.Martin » Tue Jun 29, 2010 11:56 am

The full list of things which will give that error:
  • It can not find the main assembly as specified by the -input parameter or if -input is not given, the one in the project file. (The input parameter should either be an absolute path or a path relative to the project file name. Note it is not relative to the current working directory)
  • There is not a destination file name specified, either by the -output parameter or by the project file.
  • If you have asked to sign you assembly with a strong named key and the strong name key file does not exist.
  • If you are using the Automatic Error Reporting feature with a custom reporting template and it can not find the template specified or it is invalid.
  • If the project file specifies that one or more assemblies should be merged, but are not referenced by the main assembly.


My guess is either the second or the last are the problem.

Yes it would be better if SA actually told you what part of the configuration it was having problems with.
Paul.Martin
 
Posts: 83
Joined: Wed Feb 03, 2010 11:20 am
Location: Cambridgeshire

Postby Uniwares_AS » Tue Jun 29, 2010 1:33 pm

Ok, using the -output parameter it works on the commandline. Yet trying to do the same with the build task fails in all combinations. With and without the output parameter, overwrite yes or no, all the same, it fails and I dont get the error message because its a build task and MSBuild shows only that SA exited with error code -1.
Uniwares_AS
 
Posts: 132
Joined: Thu Oct 11, 2007 3:29 pm

Postby Paul.Martin » Tue Jun 29, 2010 2:39 pm

Do you use a logger with MSBuild (e.g. http://msdn.microsoft.com/en-us/library/ms171470%28VS.80%29.aspx)?

The SmartAssembly.MSBuild.Task is configured to log errors and the errors from the actual build process will be sent to the log, although you may need to set the verbosity level to normal or detailed.


My guess if it works fine with the standalone command line, then it is a permissions or relative path issue.
Paul.Martin
 
Posts: 83
Joined: Wed Feb 03, 2010 11:20 am
Location: Cambridgeshire

Postby Uniwares_AS » Tue Jun 29, 2010 5:38 pm

As I am not using MSBuild.exe but devenv.exe to build the executables I dont get the error output from SA into the VS error console.

I can try MSBuild but I recently had problems with the configuration of the msbuild process so this may take some time to setup right.
Uniwares_AS
 
Posts: 132
Joined: Thu Oct 11, 2007 3:29 pm

Postby Paul.Martin » Tue Jun 29, 2010 6:27 pm

OK, if you go into Visual Studio (which ever edition you are building under) and under the "Tools" menu select "Options".
Under the "Projects and Solutions" section choose "Build and Run". You can then set the "MSBuild project build output verbosity" to one of the high settings.

There is a registry setting to do the same (e.g. if you can't run the IDE) HKCU\\Software\\Microsoft\\VisualStudio\\9.0\\General
DWORD key "MSBuildLoggerVerbosity" with data "4" (diagnostic) or "3" (detailed), but usual warnings about editing your registry.


If you are building using the IDE version you will get all the detail straight-away. If you are using the command line version you should add the switch
/out <log file name>
to view the information (N.B. this is an append only log and with diagnostic will get quite big very quickly so turn off logging and reduce the verbosity as soon as you sort out the problem).
Paul.Martin
 
Posts: 83
Joined: Wed Feb 03, 2010 11:20 am
Location: Cambridgeshire

Postby Uniwares_AS » Tue Jun 29, 2010 6:57 pm

Thanks Paul, that was a great tip. But makes me wonder why doesn't SA at least log errors by default to the console? Digging through miles of log is not the funniest.

Anyway, solved the problem now, it was really a wrong path to the input assembly (should have been $(ProjectDir)\\obj\\Release and not $(TargetDir)), SA threw an IOException.

So this makes this workaround somehow usable. Although a <Include> would be much cleaner and logical.

If someone else is interested, this is what the SA output looks like:
Code: Select all
Target "AfterCompile: (TargetId:36)" in file "X:\\solutionfolder\\SmartAssembly.targets" from project "X:\\solutionfolder\\project\\subproject\\subproject.csproj" (target "Compile" depends on it):
Task "Copy" (TaskId:17)
  Copying file from ".\\obj\\Release\\subproject.dll" to ".\\obj\\Release\\subproject.temp.dll". (TaskId:17)
Done executing task "Copy". (TaskId:17)
Task "SmartAssembly.MSBuild.Tasks.Build" (TaskId:18)
  Command: (TaskId:18)
  C:\\Program Files\\Red Gate\\SmartAssembly 5\\SmartAssembly.com "X:\\solutionfolder\\project\\Build\\subproject.{sa}proj" /output=$self  (TaskId:18)
  The "Build" task is using "SmartAssembly.com" from "C:\\Program Files\\Red Gate\\SmartAssembly 5\\SmartAssembly.com". (TaskId:18)
  SmartAssembly v5.0.0.284 (TaskId:18)
  Copyright c Red Gate Software 2005-2010 (TaskId:18)
  Loading project X:\\solutionfolder\\project\\Build\\subproject.{sa}proj (TaskId:18)
    Output=X:\\solutionfolder\\project\\subproject\\obj\\Release\\subproject.dll (TaskId:18)
  Analyzing... (TaskId:18)
  Preparing... (TaskId:18)
  Creating Assembly... (TaskId:18)
  OK (TaskId:18)
Done executing task "SmartAssembly.MSBuild.Tasks.Build". (TaskId:18)
Uniwares_AS
 
Posts: 132
Joined: Thu Oct 11, 2007 3:29 pm

Postby Paul.Martin » Tue Jun 29, 2010 7:05 pm

That is the annoying thing with MSBuild (and devenv.exe which is a wrapper around it), it redirects the console output to the logger and the default settings for the default logger are for a very quiet output.

Glad you managed to find the problem.

I'll log a feature request for the <Include ...> structure
Paul.Martin
 
Posts: 83
Joined: Wed Feb 03, 2010 11:20 am
Location: Cambridgeshire

Postby Uniwares_AS » Tue Jun 29, 2010 7:50 pm

Just one more note on the build output: setting it to minimal already produces useful output. Actually more than SA should but still useful.

Code: Select all
------ Build started: Project: subproject, Configuration: Release Any CPU ------
  SmartAssembly v5.0.0.284
  Copyright c Red Gate Software 2005-2010
  Loading project X:\\solutiondir\\project\\Build\\GeneralAssemblies.{sa}proj
    Input=X:\\solutiondir\\project\\subproject\\obj\\Release\\subproject.dll
    Output=X:\\solutiondir\\project\\subproject\\obj\\Release\\subproject.dll
  Analyzing...
  Preparing...
  Creating Assembly...
  OK
  subproject -> X:\\solutiondir\\project\\Executables\\Release\\subproject.dll


When set to minimal, this is the only output during build time.
Uniwares_AS
 
Posts: 132
Joined: Thu Oct 11, 2007 3:29 pm


Return to SmartAssembly 5

Who is online

Users browsing this forum: No registered users and 1 guest