Does anyone know if there is a way of automatically installing an extension on DNN using .net ?
It used to be possible using the infamous Install.aspx page, which has been removed for security reasons.
I've tried refactoring the code within Install.aspx so as to automate this, or even run it for a single module, but no luck. I've just got to the point where the zip has gets unpackaged, but what I really want is to know which and how the tables in the Sql Server database get modified.
I would appreciate any pointers on this.
It is quite hard to find all the tables that get updated, as well as the data that gets put into them.
My solution was is to simply call a copy of the installation page, which can be done from, say, a desktop app. For some reason the original Install.aspx won't run if you add it to the DNN installation. Step by step:
Find the Install.aspx and Install.aspx.cs files. They are deleted after the first installation, but you can get them from the original download.
Make a copy of these two files and rename them, e.g. MyInstall.aspx and MyInstall.aspx.cs
In Visual Studio run the DNN installation as a web site, not as a web project.
Now the page MyInstall will work just as the Install did. You can pass the parameters in the url.
Before you call the page, you need to put your module packages into the corresponding folder e.g. for modules install/module of the DNN Installation. To create the module package use Christoc's VS templates.
Related
So i Have this c# application that contains a button allowing a file copy from a network share folder.i use a vbscript to copy the file, this script takes the source and destination path.now i want to create a setup to install my application on any PC connected to the LAN. the thing is the path will eventually change so i'm not sure if it will work.
I never made a setup before and i'm wondering if there is a way to customise the setup to allow the installer to make the changes.otherwise any solution will be very helpfull. thank you
I don't normally like giving answers that are mostly links, but it is too much to post here. Here is a quick summary:
There are quite a few things that can do what you are asking.
The one I like is called Squirrel. I recently had to learn how to use it while deploying an application for my company.
The steps in a nutshell(see what I did there? :)
Build your application (optionally add the update checker code
first - see links for details)
Package your application into a .nuget file using Nuget Package Explorer(details in links below)
Run the squirrel --releasify on your nuget
It will output the setup files that you are looking for in the Releases directory.
More information (that you will likely need):
Github - Squirrel.Windows
Youtube - Video tutorial that I found helpful
Github - Squirrel Getting started guide
As for your vbscript, I would do the file copy inside C#. You are very likely to run into permissions issues when using vbs. In any case, why add the complexity of 2 different languages when C# can do a file copy easily.
Something like this during your application's startup.
if (File.Exists(localFileName) == false) // check to see if the file is needed
{
File.Copy(sourceFileOnLan, destinationFile); // get the file
}
If you are really set on using a vbs file, you can launch it using Process.Start() and let Windows execute it.
Also, you can store the paths in your app.config file, and update them if/when they change.
I am working on a conversion from Accurev to TFS and am being blocked by Accurev's usage of symbolic links, which TFS does not work with. I have tried several methods, but they all seem to fail to work.
What I would like to do is have a file in the project/branch that lists all the linked files and folders that is stored in source control. On every get operation, I would like to read this file and link the folders and files specified in the central file. However, I cannot find a way to extend the get operation. Does anyone have any experience in extending it in VS?
TFS does not provide a way to extend what happens on a Get action. You could easily create a custom powershell or batch file that you use in place of calling tf.exe, but since Team Build and Visual Studio call into TFS directly using the Client Object Model you're not going to make this easy on yourself.
In the end everything is possible of course. You could write a custom build action for Team Build to replace the standard get operation, or create one that triggers after the standard get operation has completed. You can write a vsix visual studio extension that replaces the standard Get operation everywhere in the menu's of Visual Studio and get to a something that could be considered workable. But I would not recommend this. It is far from standard and it is far from sustainable. You'll have to unwire so much default behavior in Visual Studio (that checks out files that are changed, adds files to source control when they're added to the project file etc etc etc).
SourceSafe used to have this feature as well (it was called pinning) and Microsoft removed it when they created TFVC. They now recommend you use branching and merging to synchronize these files across multiple projects, making sure that the source structure in Source control is the same as the ones on disk during build.
You can also make use of the Add-as-Link option in your project files. This allows you to keep the original files in their original location, but MsBuild will understand that in the project structure this file actually lives somewhere else. Or package the linked files up in a NuGet package and use the Dependency Management using NuGet guide to help you place the files in the right location during build.
And finally, you can get very creative using Workspace Mappings, many people never get further than mapping $/project -> $(SourceDir), but in essence the workspace mapping is like the file you describe. A way to layout your sources from Source control to disk. You could do:
$/Project/DEV/MyProject -> $(SourceDir)\MyProject
$/Project/Shared/FilesToCopy -> $(SourceDir)\Shared
And you can even add files from other projects in the same collection:
$/AnotherProject/Shared -> $(SourceDir)\MoreShared
And something not many people know, you can layout individual files:
$/AnotherProject/CompanyAssemblyInfoItems.cs -> $(SourceDir)\CompanyAssemblyInfoItems.cs
The only thing you cannot do, is map files to be children of an already mapped folder. In that case you might need to have the workspace mapping do the fetching of the sources and then a .targets file that you include in your .csproj file to do the copying of files.
One of our clients has installed our web application into production.
We need to do a very quick patch to one of the aspx controls. I tried dropping the ascx and ascx.cs source files into the dir and unsurprisingly I got this error:
Exception type - HttpParseException - The base class includes the field 'foobar', but its type (UserControls_Controls_FOO) is not compatible with the type of control (ASP.usercontrols_controls_foo_ascx).
Yes, this approach is never a good idea, but is there anything I can do to the control to get it to run in the site instead of the version compiled into the DLL?
Doing a fresh install is not an option at this point.
no , you need to get it into compiled DLL and fresh deploy only then you can see the patch working
If you changed only ascx file you must update only it.
But if you updated ascx.cs you must Publish project and replace old bin directory with new one.
Also you can transform site to set of dynamically compiled pages, but it is hardcore old way and bad idea nowadays.
Recently we have been having problems with TFS and our code base. We have a section of tests that use Webdriver, and a section that use Coded UI. Lately, we've been having problems merging our code after a new build has been pushed out. Some folders show up as a white outline of a folder, which we can right click and select "include in project". We also notice some files missing, and we can't "get latest" to grab them. We have to go some round about way to do it (shelve code, delete local files, get latest, merge code). Even when we do that we still have some issues.
But the main issue we are having is that our Coded UI maps are breaking. Instead of being the normal structure such as:
.uitest
----.cs
----.designer.cs
When we merge in the new code, the UI maps break out like:
.cs
----.designer.cs
.uitest
I opened the .csproj in notepad++ and noticed that both the .cs and .designer.cs files no longer have a dependancy of the .uitest file. Now the .cs file has no dependancy, and the .designer is dependant on the .cs file. We can fix it with relative ease, but it keeps breaking in every build and we have several maps we need to fix. What exactly could the problem be here? Also, referring to my frist problems of files not being included in the project, what could the issue be there?
I asked the same question on the MSDN forums, but the suggestions I have received I have already tried, like creating a new workspace since the other might be corrupt. Still didn't work.
Thanks in advance
Edit: Had a suggestion on the MSDN forums to run VS as administrator. That didn't work either. Not really sure what could be causing this issue. It doesn't seem to be causing problems for everybody because some new builds cause issues for some people but not others. Some more info would be I run on Windows 7 64bit and Visual Studio Ultimate 2010.
In the past I've had issues with TFS that sound similar, 2 of our developers seemed to periodically create problems when merging files into the data store, folders and files would show as not included while the project file would make it in (breaking everything after get latest). Eventually the problem went away but we never truly found the source. I believe it had something to do with our network - maybe a switch issue in combo with the way we mapped working folders to network drives pointing to a shared dev server. Also one of the workstations seemed to have a problem with windows explorer not seeing file updates on the dev server share... developer would have to hit \servername\C$\sharefolder then hit his mapped network drive again before updates would refresh. (And his check in's created the most problems) ... we ran VS2008, TFS2010
Just some ideas...
Several years before I started working at this job another developer who is no longer here wrote an application in classic ASP using HTML, vbscript and javascript. This is fine but the problem is that 2 pages were written in C# with an HTML file and a code behind file. There was no solution files for these two pages. They may have been originally created in Visual Studio but they don't exist in it now.
That is important because there is a lot of things that Visual Studio just does for you without even thinking.
My problem is that in these two C# pages I need to get them to reference a DLL. This is a simple task when using Visual Studio. You just add a reference to the project and life is good. But outside of VS nothing seems to work.
I tried putting the dll in the same folder as the pages and then I tried the following:
Using myDLL;
myDLL dll = new myDLL();
myDLL dll = myDLL();
I found some code online that said to create an internal static class and use [DLLImport()] but that didn't work either. It couldn't find the dll or the Entry Point for the dll. I am currently researching how to create an entry point, just in case this is the method to make everything work.
Outside of having to rewrite these pages in vbscript (which I don't have the time to do) I am at a loss.
Has anyone ran into this problem before? Is there something that I can put in the web.Config? Or is this just impossible and I am hosed.
BTW this is all running under the 2.0 .net framework.
If you drop the DLL you want the code to reference into the bin folder of the website, then open the web.config and locate the following section configuration -> system.web -> compilation -> assemblies.
You need to add the display name of the assembly to that list - so that the compiler will reference that assembly during it's late-bound build process.
Now you should be able to use the stuff that's in it on those pages.
If you don't the know the display name of the assembly (typically yourassembly, version=*.*.*.*, Culture=neutral, PublicKeyToken=null for culture-invariant, non-strong-named assemblies) you can open it in a tool like ILSpy (there are others, it's just become my favourite) and it tells you when you select it in it's UI:
sorry for the poor highlighting - jerky hand following far too much coffee
If all the code in that assembly is in a single namespace, also, you can also add a default using to all the .cs or .aspx code in the project by adding that namespace to configuration -> system.web -> pages -> namespaces - making it simpler to use that code in the pages.
I created a VS Solution/Project for my app. I compiled and published it to the web server. When I published it I had it copy all project files.
I ran it and it crashed because it could not find my dll.
I tried adding the lines that Andras mentioned above and it seemed like it was getting me closer but it only changed the errors I was getting.
Then I went into IIS on the web server. I expanded the folder listing under Web Site. I right clicked on the folder that contained my app and made that folder into an application folder.
After I did that everything just worked. So then I thought I would see what happened if I backed out all of the additional code I added to my C# app and the Web.Config file. It still worked. All I needed to do was to make the folder an application folder in IIS and put a Using statement in my C# app and life is wonderful again.
Thanks for all the comments and suggestion. Andras thanks for the link to ILSpy. That is a cool little tool.
Take care,
Robert
I agree with Jon, it sounds like you should try creating a new project for these files. It's always better to leave code better off than you found it. If a new project is not an option for some reason, you should indicate this in your question.