Red Gate forums :: View topic - FR: project includes
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SmartAssembly 5
SmartAssembly 5 forum

FR: project includes

Search in SmartAssembly 5 forum
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
Jump to:  
Author Message
Uniwares_AS



Joined: 11 Oct 2007
Posts: 132

PostPosted: Fri Jun 25, 2010 5:58 pm    Post subject: FR: project includes Reply with quote

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:
<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.
Back to top
View user's profile Send private message MSN Messenger
Ed



Joined: 16 Jun 2010
Posts: 5

PostPosted: Mon Jun 28, 2010 2:32 pm    Post subject: Use input parameter Reply with quote

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:
<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" />
Back to top
View user's profile Send private message
Uniwares_AS



Joined: 11 Oct 2007
Posts: 132

PostPosted: Mon Jun 28, 2010 2:35 pm    Post subject: Reply with quote

While its a bit like carrying the church around the cross, it might work. Will give it a try.
Back to top
View user's profile Send private message MSN Messenger
Uniwares_AS



Joined: 11 Oct 2007
Posts: 132

PostPosted: Tue Jun 29, 2010 1:34 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message MSN Messenger
Paul.Martin



Joined: 03 Feb 2010
Posts: 83
Location: Cambridgeshire

PostPosted: Tue Jun 29, 2010 11:33 am    Post subject: Reply with quote

Are you specifying an -output parameter as well?
Back to top
View user's profile Send private message
Paul.Martin



Joined: 03 Feb 2010
Posts: 83
Location: Cambridgeshire

PostPosted: Tue Jun 29, 2010 11:56 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Uniwares_AS



Joined: 11 Oct 2007
Posts: 132

PostPosted: Tue Jun 29, 2010 1:33 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message MSN Messenger
Paul.Martin



Joined: 03 Feb 2010
Posts: 83
Location: Cambridgeshire

PostPosted: Tue Jun 29, 2010 2:39 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Uniwares_AS



Joined: 11 Oct 2007
Posts: 132

PostPosted: Tue Jun 29, 2010 5:38 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message MSN Messenger
Paul.Martin



Joined: 03 Feb 2010
Posts: 83
Location: Cambridgeshire

PostPosted: Tue Jun 29, 2010 6:27 pm    Post subject: Reply with quote

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).
Back to top
View user's profile Send private message
Uniwares_AS



Joined: 11 Oct 2007
Posts: 132

PostPosted: Tue Jun 29, 2010 6:57 pm    Post subject: Reply with quote

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:
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)
Back to top
View user's profile Send private message MSN Messenger
Paul.Martin



Joined: 03 Feb 2010
Posts: 83
Location: Cambridgeshire

PostPosted: Tue Jun 29, 2010 7:05 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Uniwares_AS



Joined: 11 Oct 2007
Posts: 132

PostPosted: Tue Jun 29, 2010 7:50 pm    Post subject: Reply with quote

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:
------ 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.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
This topic is locked: you cannot edit posts or make replies. All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group