Reputation: 8928
I have a .NET WinForms application which needs to be run from CD. What I need to figure out is if user has required .NET version installed or install if necessary than run the application after installation. Any info I've found about bootstrapping involves setup and installation of the application. How can I do this if I don't install anything? I'd appeciate any info..
Upvotes: 3
Views: 2623
Reputation: 2222
I was also thinking that you can't do it without making an installer for a long time, but that's not true. There is a msbuild action, called "GenerateBootstrapper". If you're in Visual Studio:
Then you can add GenerateBootstrapper action in different ways (depend on what you want to install). MSDN gives an example for .NET 2.0:
<ItemGroup>
<BootstrapperFile Include="Microsoft.Net.Framework.2.0">
<ProductName>Microsoft .NET Framework 2.0</ProductName>
</BootstrapperFile>
</ItemGroup>
<Target Name="BuildBootstrapper">
<GenerateBootstrapper
ApplicationFile="WindowsApplication1.application"
ApplicationName="WindowsApplication1"
ApplicationUrl="http://mycomputer"
BootstrapperItems="@(BootstrapperFile)"
OutputPath="C:\output" />
</Target>
I didn't try this example, but I tried my own and I can tell you, that in order to install .NET 4 Client Profile (which is the latest stable .NET release for today) on XP machines, you need to install Windows Imaging Component first. That's why standard .NET4 Client Profile prerequisite, included in VS2010, fails on XP. So i wrote my own bootstrapper. You can download my sample VS2010 solution, that creates a bootstrapper for console app. But it requires you to install (just copy) my bootstrapper. So here are the steps:
Upvotes: 4
Reputation: 1531
Most straightforward way would be to check for registry entries as listed in this question:
A script file might be the easiest way to check from the CD:
Windows Script Host - RegRead method
Upvotes: 2
Reputation: 33318
You could code a small native code loader that checks for .NET runtime, triggers the installation of .NET if necessary, and then starts your .NET application.
Upvotes: 2
Reputation: 416053
The msi installer you build with visual studio can include a native setup.exe that checks the framework dependency and kicks off the installer first if needed. You can even include the redistributable on your cd. But you have to install the program for that to work.
Otherwise, you must build your own native code tool.
Upvotes: 3