I am building an NSIS installer. I would like the user to specify two different directories. I am using two MUI_PAGE_DIRECTORY pages like so:
!define MUI_DIRECTORYPAGE_VARIABLE $SomeDir
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Some directory"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_DIRECTORY
I would like the first page to come up with a default directory for SomeDir. How do I achieve that?
Function .onInit
StrCpy $SomeDir "$AppData\MyDefault"
FunctionEnd
Related
I have a templates folder and I have multiple files under it.
I want to compile all these templates into a single file so that I can load it using requireJS.
I know that, I can do this via build tools like Grunt, Gulp, Brunch etc
What I am specifically looking for is how can I do this via command line using the handlebars compiler.
I installed the compiler via node
npm install -g handlebars
But, I am able to compile only 1 file at a time.
handlebars --amd templates/single-template.hbs -f compiled.js
[I am using windows OS]
It's as easy as:
handlebars path/to/template/folder -f path/to/compiled/folder/all-templates-compiled.tpl.js
found here https://github.com/wycats/handlebars.js/issues/131
#echo off
cls
echo -------------------------------
:choice
set /P c=Precompile every .html in this folder?[Y/N]?
if /I "%c%" EQU "Y" goto :compile
if /I "%c%" EQU "N" goto :end
goto :choice
:compile
for %%f in (*.html) do (
echo %%~nf
handlebars "%%~nf.html" -f "%%~nf.tmpl" -m
)
:end
echo End of script
pause
exit
In Visual Studio website projects (in Visual Studio 2005 or later, not web application projects where there is still a .csproj file) how is the reference information stored, and is it possible to source control it without storing compiled binaries in source control?
If you right-click on a website project and select Property Pages, the first screen (References) lists all the project references.
System.* references are listed as type GAC, and other DLL files can be listed as BIN or Project.
The problem occurs when you include something as a project reference, and then commit it to source control (for us, Subversion, ignoring .dll and .pdb files.)
Another developer gets updated code from the repository and has to manually set up all of these project references, but I can't even determine where this information is stored, unless it's in that .suo, which is NOT source-control friendly.
If you reference a .dll by file name through the browse tab, there should be a .refresh file created (nested under the dll in BIN). We put those in SVN and it works great (you may have to hand edit them to use relative paths).
References added from the .NET tab are added to web.config
Project references are stored in the solution (.sln) file. Open the .sln file and you'll see them listed:
Project("{xxxxxxx-7377-xxxx-xxxx-BC803B73C61A}") = "XXXXXXX.Web", "XXXXXXX.Web", "{xxxxxxxx-BB14-xxxx-B3B6-8BF6D8BC5AFF}"
ProjectSection(WebsiteProperties) = preProject
TargetFramework = "3.5"
ProjectReferences = "{xxxxxxxx-C3AB-xxxx-BBED-2055287036E5}|XXXXXX.Data.dll;
...
“Web Site” projects in Visual Studio are a strange thing. They seem to be an attempt to cater to traditional web developers, where a “site” is just a set of files in a directory. In much the same way, when you make a “Web Site” project in Visual Studio, there is no real “project” file, like C# projects have a .csproj file. However, there is still a solution file (.sln). Normally, assembly .dll references are saved in the project file. Since a Web Site doesn’t have one, where do they go?
References to other projects
If you add a reference to another project, then an entry is made in the solution .sln file. It ends up looking like this:
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "WebSite1", "..\..\WebSites\WebSite1\", "{F25DB9D6-810D-4C18-ACBB-BFC420D33B20}"
ProjectSection(WebsiteProperties) = preProject
TargetFramework = "3.5"
ProjectReferences = "{11666201-E9E8-4F5A-A7AB-93D90F3AD9DC}|ClassLibrary1.dll;"
File System References
If you browse the file system and add a .dll file, then Visual Studio will create a “.refresh” file with the same name in the \Bin folder. This file is just a 1-line text file that indicates the path that the file was loaded from. So for example if I added “MyAssem.dll” from ....\libs, then in the Web Site \Bin folder, I would end up with 2 files copied there: MyAssem.dll and MyAssem.dll.refresh. The .refresh file would contain the text: “....\libs”. At each build, Visual Studio will check the path in the .refresh file, and if a newer .dll exists there, it will overwrite the one in the Bin directory.
Warning: Visual Studio will NOT throw an error if the file does not exist where the .refresh file tells it to look. It will just continue to use the .dll already in the \Bin folder. It will however output a Warning.
GAC References
If you add an assembly from the Global Assembly Cache, Visual Studio will enter it in the Web.config file, like this:
<compilation debug="false">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Again the thing you have to watch for here is that Visual Studio assumes that if the assembly was in the GAC on your development computer, then it will be in the same place at runtime! That can get you into trouble if you maybe have Oracle.DataAccess installed on your dev machine, which would put it in the GAC, but when you deploy, you just copy the .dll into place on the production machine. It will still try to find it int he GAC and may fail at runtime.
I hope this helps clear up the oddities areund Web Sites and how references work!
I use copyprojectDll.ps1 powershell.
My folder structure is below
ClassLibraries
ThirdParty
Website/Bin
CopyprojectDll.ps1
Website.sln
ClassLibraries are code classes for my project, DAL ..
Website project includes only web files, aspx, aspx.cs ..
ThirdParty are required libraries, AjaxToolkit etc.
I compile ClassLibraries.sln
I run CopyprojectDll.ps1
I use Website.sln after this.
Sample powershell file is below.
$folders = #();
$folders +="IB.Security"
$folders +="ClassLibraries/Core.Classes"
function CopyDllsToWebBin($dll_files)
{
if ($dll_files -eq $null)
{
return;
}
$targetfolder = "./Kod/bin/"
foreach($dll in $dll_files)
{
copy-item $dll.FullName -destination "$targetfolder" -force #-Verbose
}
}
function CopyDllsToThirdParty($dll_files)
{
$targetfolder = "./ThirdParty/"
foreach($dll in $dll_files)
{
copy-item $dll.FullName -destination "$targetfolder" -force #-Verbose
}
}
$dll_output_folder = "/bin/debug";
foreach($folder in $folders)
{
$dll_files = Get-ChildItem -Path $folder$dll_output_folder -include *.dll -Recurse | sort-object Name
CopyDllsToWebBin($dll_files)
$dll_files = Get-ChildItem -Path $folder$dll_output_folder -include *.pdb -Recurse | sort-object Name
CopyDllsToWebBin($dll_files)
$dll_files = Get-ChildItem -Path $folder$dll_output_folder -include *.xml -Recurse | sort-object Name
CopyDllsToWebBin($dll_files)
"Copied $folder$dll_output_folder"
}
$dll_files = Get-ChildItem -Path "ThirdParty" -include *.dll -Recurse | sort-object Name
CopyDllsToWebBin($dll_files)
$dll_files = Get-ChildItem -Path "ThirdParty" -include *.pdb -Recurse | sort-object Name
CopyDllsToWebBin($dll_files)
$dll_files = Get-ChildItem -Path $folder$dll_output_folder -include *.xml -Recurse | sort-object Name
CopyDllsToWebBin($dll_files)
"Copied ThirdParty"
date
I have the following NSIS code
Function CreateDesktopSC
;Creates Desktop Shortcut
SetShellVarContext current
SetOutPath "$DOCUMENTS\Foo\"
SetShellVarContext all
detailprint "Icon path: $INSTDIR\Bar\icon.ico"
CreateShortCut "$DESKTOP\${productName}.lnk" "$INSTDIR\Bar\binary.exe" "" "$INSTDIR\Bar\icon.ico" 0
FunctionEnd
The install log shows the following (from the detailprint command)
Icon path: C:\Program Files (x86)\Bar\icon.ico
The shortcut is created, but with the icon from the executable.
If I open the lnk file or right click the shortcut and click "Change Icon ...", I get the error "Windows can't find the file %ProgramFiles%\Bar\icon.ico."
If I browse to %ProgramFiles%, it takes me to c:\Program Files, not the x86 version as shown in the detailsprint command. The icon file exists, but in the x86 folder.
It appears that either NSIS or windows is replacing "C:\Program Files (x86)\" with "%ProgramFiles%", which doesn't point to the x86 version.
The actual path to the executable is correct, it's only the icon link which is incorrect.
Any ideas?
The workaround from the thread is to add an second \ to your icon code. I didn't really got why this helps on 64bit systems but it does...
so replace:
CreateShortCut "$SMPROGRAMS\$StartMenuGroup\${PRODUCT_NAME}.lnk" "yourapp.exe" "$INSTDIR\${APPLICATION_ICON}"
with
CreateShortCut "$SMPROGRAMS\$StartMenuGroup\${PRODUCT_NAME}.lnk" "yourapp.exe" "$INSTDIR\\${APPLICATION_ICON}"
After adding the second \ before APPLICATION_ICON the icon will be displayed again
Confusing but it works
NSIS just uses the documented IShellLink interface. There is a thread about it on the NSIS forum (with a workaround you can try). I believe it is a bug in WOW64... (The registry redirector is docmented to change %ProgramFiles% to %ProgramFiles(x86)% behind your back, I suspect IShellLink is missing this hack)
Disable redirection
Load Icon from path
All is done with System plugin. Why to complicate ...
http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.3.4 seems to be wrong, for me what worked was:
CreateShortCut "$SMPROGRAMS\${PRODUCT_PUBLISHER}\${SHORTCUT_NAME}.lnk" "$INSTDIR\${PRODUCT_EXE}" "$INSTDIR\${PRODUCT_EXE}" "$INSTDIR\MyIcon.ico"
I'm using an msbuild command line script to publish a c# web project from team city out to a live server.
After wrestling with IIS perimisions etc it all works well...
....apart from the fact that the font files end up not being copied to the right directory (they end up on the bin directory)
/t:rebuild
/p:Configuration=Deploy
/p:OutputPath=bin
/p:DeployOnBuild=True
/p:DeployTarget=MSDeployPublish
/p:MsDeployServiceUrl=https://<server>/MsDeploy.axd
/p:username=<username>
/p:password=<password>
/p:AllowUntrustedCertificate=True
/p:DeployIisAppPath=<sitename>
/p:MSDeployPublishMethod=WMSVC
Any suggestions as wo what I can do to force the files to go to the right directory?
Make sure the fonts are included as "Content" by right clicking on them in Visual Studio and selecting properties and changing the "Build Action" to "Content". Also ensure "Copy to output directory" is set to "Do not copy"
i got an error while loading a page in asp.net.I have renamed the page before loading it.The error is as follows:-
****could not read state "obj\Debug\ResolveAssemblyReference.cache"****
Please help
Sounds to me like you need to clear your ASP.NET cache directory, located in:
C: \ Windows directory \ Microsoft.NET \ Framework \ v2.0.50727 \ Temporary ASP.NET Files \
Navigate to that directory and delete all folders in it.
Or Perhaps resetting your IIS will do the trick:
Hit Windows-key + R
Type "cmd" to open up the console
Hit enter
Type "iisreset" to reboot your IIS
Hit enter
Or perhaps Visual Studio crapped out on you when you re-named the file. Check so see if your .aspx page is referencing it's .aspx.cs code-behind file and partial class correctly:
// First line of Default.aspx:
<%# Page CodeFile="Default.aspx.cs" Inherits="_Default" %>
The Inherits property should be set to your partial class's name in your .aspx.cs code-behind file. The CodeFile property should point to your .aspx.cs. code-behind file.