cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
rguggisberg
Level 13

Excluding Installshield Deployment Projects from MSBuild

I need to exclude a few deployment projects (used for development only) from my build (using MSBuild from command line) and have not been successful. I have tried both of the following (separately) in my InstallShield.targets file with no difference.



[ExcludeDeploymentProjects]





[ExcludeDeploymentProjects]



How can I prove that the InstallShield.targets is even being used? I uncommented the 'Message Text' lines, and I see no messages. Are the messages supposed to appear on the console or in the log files?
Thanks for any advice!
Labels (1)
0 Kudos
(11) Replies
Reureu
Level 10

Hi there,

Please correct me if I'm wrong, but I am under the impression that what you are trying to do applies to Web Deployment Projects in Visual Studio.
I don't think that the InstallShield.targets knows what to do with the items.
So, I'm a bit confused about your question.
Do you want to tell us a bit more about what you are trying to achieve and what type of project you are working on?

As for the logs, you can add a task pretty much in any target you want. See here for more info: https://msdn.microsoft.com/en-us/library/6yy0yx8d.aspx
If you build your project by calling MSbuild from the command line, your message will appear in the console window.
If you build your project with a build server, it will appear in the log file.
But you need to set the right verbosity level either as parameter of your msbuild command (/v:diag), or by setting some attributes of your build definition when launching a build.
The verbosity level is directly related to the importance of your message: the message task has an "importance" attribute. Have you tried to set it to "high"?

I hope that helps.
0 Kudos
rguggisberg
Level 13

Thanks Reureu,
I agree... " is not applicable in my case. I have several InstallScript MSI projects in my solution. Our developers only have InstallShield LE on their machines and some of the InstallShield projects are for use only by the developers. Those projects are not part of what we distribute with the product. When I do an MSBuild I specify the solution as part of the MSB command line. This builds ALL the .isproj files in the solution. I need to exclude some of the .isproj files. How do I do that?
Thanks.
0 Kudos
Reureu
Level 10

I think your question is more related to Visual Studio than InstallShield, but here we go...

Why don't you create several solution configurations, then set the projects to build for each solution configuration?

So let's assume you have the following solution/project structure (see image 1)


Now, you go in the configuration manager, and create some more solution configurations, all based on the "Release" solution configuration, like Release01, Release02, Release03.
Then you set which project to build for each solution configuration (see images 2, 3 & 4)






Now, you need to pass the solution configuration as "Configuration" property on the command line:
msbuild /t:Build /p:Configuration=Release01 MyDeploymentSolution.sln.

You should see the following lines in the output:


Does that help?
0 Kudos
rguggisberg
Level 13

Reureu,
Thanks for the explanation. I already have several configurations as you described, have excluded projects from some, and am specifying the right configuration. The ones generating the errors are .isproj files that are used for development, but not included in the release. The build completes without errors if built from VS. When built from MSBuild command line it gets errors on the unneeded .isproj files. I would just like to get rid of the errors so they don't obscure the results.
Thanks
0 Kudos
Reureu
Level 10

Why don't you show us the error messages you are getting?
Or even better create a dummy solution that shows the error and attach it to this thread?
0 Kudos
rguggisberg
Level 13

Thanks Reureu,
The error message is
MyPath\MyProjectName.isproj(30,2): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\InstallShield\2013Limited\InstallShield.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk

"C:\Program Files (x86)\MSBuild\InstallShield\2013Limited\InstallShield.targets" is not on this machine because this machine has the full version of InstallShield. Limited is what the developers have. I tried copying ..\2013\InstallShield.targets to ..\2013Limited\InstallShield.targets, but that generates other errors. The real problem is that this .isproj file should not be included in this configuration (it is unchecked in configuration manager). Seems like all isproj files in the solution are loaded whether they should be or not.

I also sent you a PM.
0 Kudos
Reureu
Level 10

I faced a similar problem as some of my colleagues are building the solution as me, but I am the only one who has got an InstallShield license (given the price, my employer thought 1 IDE license would suffice).
So the ISPROJ was building fine on my machine, but not on my team-members' machines.

Here is a description of one possible resolution. Unfortunately, I don't have the files with me right now and I might not remember everything, so take this description with some caution.

To solve my problem, the idea is to import the right InstallShield.targets file if it is present, and import a dummy targets file if it isn't. This dummy ".targets" file contains a "Build" target that only displays a message.

So here we go:

  • I created a NoInstallShield.targets file and saved it in the same folder as the ISPROJ. I don't remember the exact content, but this NoInstallShield.targets file mainly contains one "Build" target that displays a message. Useless to say, I added this file to the source-control.
  • Now in the ISPROJ file:

    • I added a condition to the import element, something like:

      It means the InstallShield.targets is only imported if it exists.
    • Then I added the following line, just below the import I've just mentioned.

      This one imports the NoInstallShield.targets if the InstallShield.targets file does not exist.



The only remaining problem is a message that Visual Studio displays when opening the solution on a machine that does not know what to do with ISPROJ (ie a development machine without any InstallShield installed), but it's something we can live with.

In any case, you can easily reuse the idea to resolve your problem:

  • Import one InstallShield.targets file if it exists
  • Import the other InstallShield.targets file if it exists.
  • If none of them exist, import a dummy target file.

So your imports in your ISPROJ would look like this:




HINT: Instead of copy-pasting the whole path of the target everywhere in your ISPROJ file, you could define an MSBuild property.
0 Kudos
rguggisberg
Level 13

Looks like I can make it work the way I want it to by changing
	

to
	

That will cover the 3 cases, true false, and empty.
0 Kudos
Reureu
Level 10

Even better! I didn't even know about this MSBuild property!
0 Kudos
rguggisberg
Level 13

I had trouble with my solution listed 2 posts back, so I implemented Reureu's suggestion as follows.
Made a copy of InstallShield.targets and named it NoInstallShield.targets. I edited that to look like this:





C:\Program Files (x86)\InstallShield\2013\System





Then I went to the appropriate.isprojfiles and changed

to



This is working well.
Thanks Reureu
0 Kudos
Reureu
Level 10

If I were you, I would remove any reference to InstallShield.Tasks.dll. This file is not present if InstallShield is not installed.

It is also a good practice to define the "Clean" target in your NoInstallShield.targets.
This allows to call MSBuild with the "Rebuild" target.

This leads to the following NoInstallShield.targets:










I would also place this NoInstallShield.targets file in the same folder as the ISPROJ, and check it in under source control, otherwise, you will need to copy it manually on every developer's machine. But that's only my humble opinion.
0 Kudos