MSBuild in a Client Environment - c#

I'm wondering if anyone has some solid advice for me. I'm trying to see if MSBuild is an appropriate tool for a client-side application (sold, commercial product). For example, if on the client machine there is .NET 4.0 and my program, I want users to be able to create screen savers and save them as an EXE.
So far, all I've seen is MSBuild being used for ASP.NET and build machines in a controlled environment, but is it appropriate to use it "in the wild" for a scenario such as described above?

I can't advise whether it is appropriate or not in your particular case, but since it is included in the .NET Framework setup, it is reliable to use it.

Overkill
MSBuild is great for managing complex projects with many interdependencies. If all you want to do though is generate an EXE from a simple set of inputs, like the screensaver scenario you used, I'd just use the C# APIs for calling the compiler or call csc.exe directly.

What you have to ask yourself here is how transparent you want msbuild to be? I would not advise using a command line and giving clients these commands and parameters, but if you mask it and have a good presentation layer that keeps all the technical stuff hidden then it's a pefectly good idea.
My current project relies pretty heavily on msbuild when installing, it works great and no one would know unless they seen the code.
Hope this helps.

Related

WPF Based installation shell

Preface:
Okay, so let me preface this by saying that this might be slightly off-topic but trust me - I can't seem to find a better place to ask it on stack exchange without it violating the posting rules ever-so-slightly. As a result, I just want to note that I'm not asking for a library to accomplish what I'm trying to do, I'm asking about whether or not it is implementable (and the basics of how to implement it) in an existing library.
The question:
TL/DR:
I want to create a setup wizard that uses a WPF shell (much like the Visual Studio 2012/2013 installer). Is this possible to create without writing all of the actual installation/update management/uninstallation code?
Details:
My motivation behind this is because unless one plans to open source it or market it, maintaining a custom written installer simply for aesthetics is not practical. I don't want to rewrite the wheel on something that has decades of talent and real-world-experience already. As a result, I need to be able to rely on existing and proven installation management code - yet extend the user interface to fit the desired aesthetics
Now, my research thus far has shown that ClickOnce supports a custom interface - however it must be done in WinForms. No offense to WinForms, but I'm trying to accomplish this in WPF as it would allow me to share my existing resource dictionaries from the application being installed. Installshield also isn't an option if it requires a paid license (too expensive) - though I have no idea if it supports a custom UI or not
The only things I really require are the ability to carry extra files as a payload with the installer (pretty standard), and the ability to perform update management using a server as the version manager. Perks would be the ability to manage multiple release channels with a single project (which is not possible with ClickOnce) and somewhat-simple TFS build integration - but neither are required as we don't currently rely on either.
Again - I am sorry if this appears slightly off-topic...however the core of the question is not 'what library will do this?' but rather 'how do I implement this in said library?'
Here's an example of the VS2012/2013 installer:

Web developer moving to Winforms

I have been doing ASP.NET / C# development for several years now. I have recently been offered a project that will need to be a winforms application (I am assuming .net 2.0).
Specs:
Winforms applicaton
Application will
have "testing for understanding
questions"
Must support flash and camtasia
files (these are "lessons")
I have done winforms development before, although nothing that is this involved. As there is a potential need for this application to be generic enough to apply to multiple different "disciplines", I would like to make the application generic enough to be easily configurable. The caveat here is that the application will need to be run from a CD-ROM and that I cannot rely explicitly on an internet connection. I was thinking of using something like SQL-Lite to support the configuration of the application. There will not be the need for updating the application as it will not be updated (at least I don't think, I guess there is the possibility of the application calling a webservice and configuring its-self based upon returned values).
With the requirements of supporting Flash and Camtasia, along with making this application generic enough to support different "disciplines", and my self being an ASP.NET developer, does anyone have an recommendations or tips/ tricks to look out for? Has anyone done something like this before?
Thanks in advance.
I'd start by writing a user control that can be used to either display a video file (presumably the output from Camtasia) or a Shockwave app. Once you have that user control, I'd then move on to look at the overall app.
If you're using Winforms, and the software is supposed to run from the CD (instead of merely be installed from CD) you'll need to have the DotNet framework already on the computer I think - but then I'm not an expert in deployment.
I find the application model in Winforms to be a lot easier than WebForms, but then I was "raised" in thick clients, so I suppose I would.
I would also, whilst agreeing to WinForms if needs really must, encourage the client to give consideration to using WPF instead - which opens up the idea that you could also provide access over the web using a simlar interface using Silverlight...
Just a few thoughts anyway - good luck with it...

How to support linux for my C# project

I have a project that is an open source application for a specific type of scientific calculation that uses c++ for the backend, and C# for the front end. I'm not doing anything windows specific in the c++ portion, so I'm hoping for a relatively small learning curve there. I have a few specific questions, and I would appreciate any advice in general about this type of transition. Please keep in mind that I know absolutely nothing about Linux, but I am willing to learn.
Is there an IDE that is similar to Visual Studio? Ideally, I would like to set it up in a similar fashion to what I have now, with 2 C# solutions and a couple of c++ dlls. I really don't want to use a text editor alone and link with a command line
Is there some tool to give me an idea about problems I might have in the transition?
Is there anyway to translate my Visual Studio options to gcc options?
I know that I don't need to support Linux technically, as almost everyone in my field uses Windows, or has easy access to a Windows box, but I thought this might be interesting from a technical standpoint.
There is a IDE you can use for C# on linux - it is Mono Develop. The current version will open visual studio project and solution files, so zero knowledge is needed to migrate to it.
It uses the Mono project, which is an implementation of C# for linux.
They have created a migration tool (MoMa) so you can test your C# code and see if it will work on linux - it will provide you with hints and explanations of what isn't portable and why.
I know this isn't the c++ route you are asking about, but it is probably going to be the easiest and quickest way to make your application platform independent.
The answer to nr 1 is: MonoDevelop. Which also comes with Mono, the .NET version that's platform independent. It's a must-use when you do this transition. It runs also on Windows, which makes the learning curve less steep.
The answer to nr 2 is: I don't know..., but running your program compiled for Mono should give you a fair idea of platform specific issues you have in your code.
The answer to nr 3 is: try that as a specific question, that will give that rather complex issue the right attention and support.
The answer to nr X is: use an automatic build (NAnt or similar) to automatically build your code for several target platforms. However, it is possible that your .NET code runs unmodified for either platform (ideally it should) and only your C++ part needs special attention.
Everyone else has already mentioned MonoDevelope. But there is also MoMA which can scan a .NET application and look for commands like pInvoke that will not be portable.

What alternatives exist for CSharpOptParse?

I've previously asked a question about an issue I have been experiencing with CSharpOptParse that didn't get much of a response. Since I haven't been able to resolve the issue, I'm looking around for an alternative library.
While the issue I'm experiencing isn't really enough of a compulsion for me to search for an alternative...the fact that the last development for this library was done in 2005 worries me a bit.
Does anyone know of any good equivalent C# command line option parsing library?
Mono distribute a library in the form of a single source file to simply place inline in your own projects called Mono.Options since 2.2 as the suggested replacement for Mono.GetOptions
This is basically NDesk.Options and it works just fine in MS.Net too.
CodePlex has a variety of libraries (of varying levels of development) active ones include:
ConsoleFX
commandline
CmdLine
CommandLineHelper

Common C# source code for Windows and Windows Mobile

I have a goal to build an application with UI that would run on both Windows Mobile and "normal" desktop Windows. The priority is for it to "look good" under Windows Mobile, and for desktop Windows it is OK if it distorted. Before I invest days trying, I would like to hear if that is possible to begin with. There are several parts to this question:
Is .NET Compact Framework a subset of "normal" (please, edit) .NET Framework? If not, does MSDN have any information anywhere on classes that are in .NET Compact Framework, but not in "normal" (again, please, edit) framework?
Is behavior of shared classes same in both frameworks?
Is it possible to have a single Visual Studio 2005 solution / project for both platforms? If yes, how do to set it up?
Any other comments and advice? Any relevant links?
The CF contains a subset of the full framework (FFx), but it is not a pure subset. There are actually several things available in the CF that aren't in the FFx, which makes it a bit more difficult. CF apps also, except in the most rudimentary cases, use P/Invoke. Those calls are never the same from the desktop to the device, so they are not directly portable (though with a little abstraction you can have a platform-agnostic interface).
For the most part, behavior is the same. I've seen some cases where it's not, and I recall some event ordering not always being identical though, so trust but verify.
It's possible through very careful massaging of the configurations, but I certainly don't recommend it. It's difficult to maintain and very fragile. Instead have two project files, one for CF and one for FFx. You're likely to have code file differences anyway. Add the code files as links to each project so they both use the same physical source file. I'd recommend using some form of CI to help ensure they both build at all times.
Take a look at Dan Moth's MSDN article and blog entries on sharing code assets.
P.S. I found the poster online - it'll show you all the classes that are CF. I ordered it fro Microsoft because Kinkos wanted $65 to print it out in color for me! Microsoft sent me a couple of copies free - all I had to do was ask:
http://www.microsoft.com/downloads/details.aspx?familyid=7B645F3A-6D22-4548-A0D8-C2A27E1917F8&displaylang=en
I have it hanging in my cubicle and it's a godsend when trying to remember which namespaces classes can be found in.
Nice multi-part question:
Differences between the Full Framework and the Compact Framework
The article above has links to relevant documentation about how class behavior differs (it definitely DOES differ in some situations)
Very simple! Create a single solution with a set of base functionality in a Class Library, then create two client projects (one for your desktop app and one for the windows mobile app). Finally, add references to the class library to both client projects.
Depending on the breadth of the project you are working on, you may want to check out the Model View Controller pattern. It may be a bit much for your project, but if you want to share UI behavior between projects, it can be a life saver.
Hope that helps!
CF, in general contains a subset of the classes from the regular framework - but you can't directly execute code from one on t'other. Additionally, rather than just being a subset, there are probably a few things in compact that aren't in the regular version, such as the GUI things specific for mobile devices (soft keys, etc) - assuming you are writing a winform exe, and not a web page (which might be the simplest way to get compatibility).
With some effort, it it possible to share logic code, in particular utility dlls - but they need different csproj files (since they have completely different compile-time "targets"). To reduce maintenance, you can often cheat by hacking the csproj to use wildcards, like from here:
<ItemGroup>
<Compile Include="..\protobuf-net\**\*.cs" />
</ItemGroup>
For UI, things get a lot tricker. In general the expectation would be to have shared business logic and separate UI for different target devices.
1). There is a Compact Framework so yes; And it is a subset of the full .NET framework. I've got a poster on my wall at the office that denotes a whole bunch of classes that work in CF... I don't recall off the top of my head if there are any that are purely CF, but I suppose there must be some. There are a couple of good books on the subject - one by Paul Yao that I have and another by Andy Wigley - both are available on Amazon.
2). As far as I'm aware, the classes that are CF and full framework work the same but need to be compiled for different targets.
3). I would hazard a guess that providing you only use classes that are common to both, that you could use the same solution, I don't know the extent you would have to go to make it compile for the compact device and the full version though, nor can I say with complete certainty that it can be done. I'd hazard a guess that the process isn't simple.
4). Go to your local book store and have a flick through those two books I mentioned. Like I said, I have the one by Paul Yao and it seems to cover most of what I could imagine needing on a compact device.

Categories