I need to deploy a webservice as part of a DotNetNuke 4.x module that I'm creating - but am not sure how I can do that and know that it'll always stay in the same place. How can I add an asmx file to my module project, and when I create my .DNN file specify where the webservice will end up? I want to reference the webservice from inside the ascx file in the module using the "~/webservices/webservice.asmx" format.
Does DotNetNuke have a way to specify in the .DNN file where the webservices will end up on the site? And if so, will I still be able to reference them with root anchored tags like ~/myservice.asmx?
You can include the ASMX file by including a element in the <files> section:
<files>
<file>
<name>YourWebService.asmx</name>
<path></path>
</file>
</files>
Generally, you don't need to specify a path.
Alternatively, you can include a Resources.zip file with your package which will include any files other than those that DNN needs to process during installation (e.g. Assemblies and SqlDataProvider files).
The benefit of this is maintainability. Using Resources.zip will keep you from having to edit the manifest file over and over...
The contents of the zip file will simply be unpacked into the root module directory (e.g. /DesktopModules/YourModule/*). If there is a file structure within your zip file it will be maintained.
You'll want to add TheNameOfYourFile.zip To your manifest file under the element.
[snip]
<folder>
<name>Your Module</name>
<friendlyname>Your Module</friendlyname>
<foldername>YourModule</foldername>
<modulename>YourModule</modulename>
<description>A module for DotNetNuke websites.</description>
<version>01.00.00</version>
<resourcefile>Resources.zip</resourcefile>
<businesscontrollerclass></businesscontrollerclass>
<modules>
<module>
[/snip]
As for referencing it in your module - I suggest using:
<%=ResolveUrl("~/DesktopModules/YourModule/Services.asmx")%>
Related
I was created one nuget package using following step.
First I created one Asp.net Mvc application
The I created spec file using nuget spec command
Then I edited $id$,$version$,$author$,$description$ ect..
Then I created package using following command.
nuget pack myproject.csproj -Build -Properties Configuration=Release
It was created one myproject.1.0.0.0.nupkg
Then I copy the file And past into C:\LocalNuGetFeed\myproject.1.0.0.0.nupkg
I already configure the local repository in my VS
My problem is
When I install this package from any other project it ask following question.
But as per my requirement I don't want to move this file to target project. Suppose user give y the it overwrite the target project file because of it i face lot reference problem.
**File Conflict
File 'Web.config' already exists in project 'CRM'. Do you want to overwrite it?
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "N"):
File Conflict
File 'Global.asax' already exists in project 'CRM'. Do you want to overwrite it?
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "N"):**
But in my package I don't want to move this above two file from package to target project.
Is any way to avoid transform Global.asax and Web.config move from package to target project.
In my .nuspec file I added following line
<files>
<file src="Web.config" target = "" exclude="Web.config"/>
<file src="*.asax" target = "" exclude="*.asax"/>
<file src="Content\*.css" target="Content\" />
<file src="Scripts\*.js" target="Content\Scripts\" />
</files>
But it include the web.config file AND Global.aspx file in Content folder My resultant package look like bellow
myproject.1.0.0.0
>> Content
....css
>>Script
..Js file
web.config
Global.asax
I was solved this using following command to crate package
nuget pack CrmHtmlController.csproj -IncludeReferencedProjects -Exclude **\*.config;**\*.asax
so it exclude all .congig and .asax file from package.
Take a look at your .nuspec file. It's just an XML file, so you can open it up with any text editor. See how it define which files to include at <package><files>? Remove those files that you don't want. A handy tool if you want to do this with a GUI is NuGet Package Manager.
Nuget includes the web.config in your package, because the build action of the web.config is "Content". This is by default and necessary for a classic publish of an asp.net web site.
If you don't want this, propably because your assembly is only a component of another web site, you can change the build action to "None" and nuget will not take it any longer.
I have n wix installer for a webproject (asp.net). This installer relies on msdeploy, so my website content is wrapped up in a zip file and this file is used for installing at the target. I'd like to include a TXT in the instalation directory, but I can't add this file into the web project solution.
Any idea of how to achieve that?
You can create a custom action to do the job for you.
try that:
<CustomAction Id="ConfigCommand" Property="Cmd" Value="[SystemFolder]cmd.exe"/>
<CustomAction Id="YourActionName" Return="check" Property="Cmd" ExeCommand="/c copy [#README.txt] [INSTALLDIR]\README.txt " />
<InstallExecuteSequence>
.....
<Custom Action="ConfigCommand" After="SomeActionBefore"></Custom>
<Custom Action="YourActionName" After="ConfigCommand"></Custom>
</InstallExecuteSequence>
I use the following script to deploy my ASP.NET MVC app to our web server:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe MySolution.sln^
/p:Configuration=TeamCity-Test^
/p:OutputPath=bin^
/p:DeployOnBuild=True^
/p:DeployTarget=MSDeployPublish^
/p:MsDeployServiceUrl=https://mywebserver.com:8172/msdeploy.axd^
/p:username=MyDomain\MyUser^
/p:password=MyPassword^
/p:AllowUntrustedCertificate=True^
/p:DeployIisAppPath=mywebsitename.com^
/p:MSDeployPublishMethod=WMSVC
Now I need to specify to not sync the /uploads folder. Can I specify that in this script? Thanks!
Clarification:
I have the Uploads folder in my project. I'd like for Web Deploy to create the folder. I do not want it to delete the folder/subfolders/files from my web server because it contains user-uploaded content.
Clarification #2:
I just found the SkipExtraFilesOnServer=True option. However, I don't want this to be global. I'd like to set it to a single folder.
UPDATE:
Apparently, what you really want is prevent web deploy from removing existing directory on the destination server, but still have the folder created in case it's not there. You can accomplish this as follows:
create YourWebProjectName.wpp.targets file next to you the project file with the following content:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<MsDeploySkipRules Include="SkipELMAHFolderFiles">
<SkipAction></SkipAction>
<ObjectName>filePath</ObjectName>
<AbsolutePath>$(_DestinationContentPath)\\NameOfYourFolder\\.*</AbsolutePath>
<Apply>Destination</Apply>
<XPath></XPath>
</MsDeploySkipRules>
<MsDeploySkipRules Include="SkipELMAHFolderChildFolders">
<SkipAction></SkipAction>
<ObjectName>dirPath</ObjectName>
<AbsolutePath>$(_DestinationContentPath)\\NameOfYourFolder\\.*\\*</AbsolutePath>
<Apply>Destination</Apply>
<XPath></XPath>
</MsDeploySkipRules>
</ItemGroup>
</Project>
Change NameOfYourFolder and YourWebProjectName accordingly. This assumes, you have it in the root, I believe, you can use relative path if it's not the case.
The first MsDeploySkipRules entry tells webdeploy not to remove any files in Name_OfYourFolder.
The second MsDeploySkipRules tells webdeploy not to remove any child folders in Name_OfYourFolder.
Also, to have the folder created if it's not present on the destination server, you have to do the following:
include the folder into the project
add a dummy DeployemntPlaceholder.txt file into it and include it into the project as well
DeployemntPlaceholder.txt is required to tell MSBUild to add the folder into the package: empty folders are ignored.
I've tested this approach and it works fine when you run publish in the manner you've shown. I've used this answer to get the msbuild items syntaxt right. I believe, this is a MSBuild way to customize flags, passed to webdeploy by MSBuild Deployment Pipeline.
If you ran MSDeploy directly, you could use skip arguments in the following manner:
-skip:objectname='filePath',absolutepath='logs\\.*\\someNameToExclude\.txt'
UPDATE 2
You might also want to have ACL write permissions set on your \Uploads folder - there's a complete guide to do this: Setting Folder Permissions On Web Publish
Conserning the original question "Specifying folders not to sync in Web Deploy", the easiest way to do this is as follows:
You can create a publish profile and add the following lines:
<PropertyGroup>
<ExcludeFilesFromDeployment>
File1.aspx;File2.aspx
</ExcludeFilesFromDeployment>
<ExcludeFoldersFromDeployment>
Folder1;Folder2
</ExcludeFoldersFromDeployment>
</PropertyGroup>
I've tested this approach for excluding files using publish profiles. An easy guide is here (scroll to Edit the .pubxml file to exclude robots.txt section).
You can also do this in .wpp.targets file or edit you csproj. See more information at Web Deployment FAQ for Visual Studio and ASP.NET
I'm writing unit tests for an asp.net mvc project. I have a config file that I use in my tests, but for some reason, the config file has to be in in the bin folder in order to be found. Is there another way to do this as I don't feel it is best practice in having config files in the bin folder.
During compilation, your app.config file is copied automatically from the root directory to the bin folder. You shouldn't have to manually place an app.config file in the bin folder.
Assuming your project name is
MyTestProject
then after a build your bin should contain the following:
MyTestProject.dll
MyTestProject.dll.config
Plus any other referenced assemblies.
One interesting thing about this is that if, in Solution Explorer, you right click your app.config and go to properties (F4) you should see that the "Copy to Output Directory" option is set to "Do not copy". This is correct. The compiler should handle the copying and renaming. If you had the setting set to "Copy always", your bin would contain a file called app.config, which the runtime would ignore.
EDIT: If you are referencing other config files from within your app.config (or web.config for that matter) then these files will need to be deployed to the appropriate directory. An example of this might be a Spring.config file, referenced in the app.config:
<spring>
<context type="Spring.Context.Support.WebApplicationContext, Spring.Web">
<resource uri="~/Spring.config"/>
</context>
</spring>
I have to port an existing project to Maven, and it includes a resource called "config.xml" that is copied to the deploy directory alongside the SWF and HTML, and loaded at run-time to locate a bunch of WSDLs.
Flex Mojos has taken it upon itself to assume that my xml file is a flex-config file with instructions for the compiler, which of course promptly gives up the ghost.
The question is: How do I specify a named config file for the compiler so that Maven stops this nonsense (as well as specifying my compile-time options)?
<configuration>
<configFile>path/to/yourConfigFile.xml</configFile>
</configuration>
https://docs.sonatype.org/display/FLEXMOJOS/compile-swf-mojo.html#compile-swf-mojo.html-configFile
Sorry for the archeology. If you want to hide only some warnings, you can add the following in your pom:
<configuration>
<!-- Maven is more strict than Flash Builder, so I'm hiding some warnings -->
<compilerWarnings>
<warn-no-constructor>false</warn-no-constructor>
</compilerWarnings>
</configuration>
From this documentation:
compilerWarnings
A list of warnings that should be enabled/disabled
Equivalent to -compiler.show-actionscript-warnings,
-compiler.show-binding-warnings,
-compiler.show-shadowed-device-font-warnings,
-compiler.show-unused-type-selector-warnings and -compiler.warn-*
Usage:
<compilerWarnings>
<show-actionscript-warnings>true</show-actionscript-warnings>
<warn-bad-nan-comparison>false</warn-bad-nan-comparison>
</compilerWarnings>