I'm making a build file to build a website written in C#.net using NANT,
but i'm Unable to include the AWSSDK assembly to the file. it give me error
error CS0234: The type or namespace name 'S3' does not exist in the namespace 'Amazon'
the AWSSDK is present in the c:/windows/assembly folder
and this is what i tried
<references>
<include name="/WINDOWS/assembly/AWSSDK.dll" />
</references>
Note :-
<Reference Include="AWSSDK, Version=1.3.19.0, Culture=neutral,
PublicKeyToken=cd2d24cd2bace800, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>/WINDOWS/assembly/</HintPath>
</Reference>
Doesn't work i guess Reference Include=is not the part of the NANT
Make sure you're importing the correct namespace.
<imports>
<import namespace="Amazon.S3" />
</imports>
Related
In order to get my unit test project to build in Jenkins, I had to add a reference to:
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\lib\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll</HintPath>
</Reference>
<Reference Include="System" />
However, vs2015.2 locally keeps removing the hint path. In fact, if I undo it, it immediately comes back. How can I prevent v2015.2 from removing the hint path from the CSPROJ? Or, is there a workaround / better way?
I would like to use web deploy to publish a Visual Studio "Console" application to a folder on the target system.
I have had some luck, and have been able to produce something similar to what I need, but not quite.
I've added the following to the console .csproj:
added the following projectName.wpp.targets file
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
and I've added the following projectName.wpp.targets:
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<DeployAsIisApp>false</DeployAsIisApp>
<IncludeSetAclProviderOnDestination>false</IncludeSetAclProviderOnDestination>
</PropertyGroup>
<ItemGroup>
<FilesForPackagingFromProject Include="$(IntermediateOutputPath)$(TargetFileName).config">
<DestinationRelativePath>bin\%(RecursiveDir)%(FileName)%(Extension)</DestinationRelativePath>
<FromTarget>projectName.wpp.targets</FromTarget>
</FilesForPackagingFromProject>
</ItemGroup>
</Project>
I then edit the .SetParameters.xml file as follows:
<parameters>
<setParameter name="IIS Web Application Name" value="c:\company\project" />
</parameters>
When I then deploy using the generated .cmd file, I get all the files deployed to C:\company\project\bin.
That's not bad, but I'd like to do better. In particular, I'd like to omit the "bin" folder and put all files in the "C:\company\project" folder, and I'd like to be able to specify the ACLs
Has anybody been able to work around these problems?
Ok, so here's the way how to omit the 'bin' folder.
First of all, I'd like to emphasize that all this msdeploy-related stuff is for web apps deployment, and 'bin' folder seems for me to be almost hardcoded deeply inside. So if you want to get rid of it - you have to do some dirty things. Which I did.
We'll have to change $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets project a little bit, so it's better to change not it, but it's copy.
Steps:
1.Backup $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets(alternatively, you could install MSBuild.Microsoft.VisualStudio.Web.targets package, redirect your csproj file to Microsoft.WebApplication.targets file obtained from package and work with it).
2. In the $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplicaton.targets find the xml node which looks like <CopyPipelineFiles PipelineItems="#(FilesForPackagingFromProject)"(there are several ones of them, take the one from the line ~2570).
3. Comment the node out, replace with the custom one, so eventually it will look like:
<!--
<CopyPipelineFiles PipelineItems="#(FilesForPackagingFromProject)"
SourceDirectory="$(WebPublishPipelineProjectDirectory)"
TargetDirectory="$(WPPAllFilesInSingleFolder)"
SkipMetadataExcludeTrueItems="True"
UpdateItemSpec="True"
DeleteItemsMarkAsExcludeTrue ="True"
Condition="'#(FilesForPackagingFromProject)' != ''">
<Output TaskParameter="ResultPipelineItems" ItemName="_FilesForPackagingFromProjectTempory"/>
</CopyPipelineFiles>-->
<!-- Copying files to package folder in 'custom'(dirty) way -->
<CreateItem Include="$(OutputPath)\**\*.*">
<Output TaskParameter="Include" ItemName="YourFilesToCopy" />
</CreateItem>
<Copy SourceFiles="#(YourFilesToCopy)"
DestinationFiles="#(YourFilesToCopy->'$(WPPAllFilesInSingleFolder)\%(RecursiveDir)%(Filename)%(Extension)')" />
Then
4. Your projectName.wpp.targets don't have to have FilesForPackagingFromProject, so it will look like:
<!-- targets -->
<PropertyGroup>
<DeployAsIisApp>false</DeployAsIisApp>
<IncludeSetAclProviderOnDestination>false</IncludeSetAclProviderOnDestination>
</PropertyGroup>
<ItemGroup>
<!-- intentionally left blank -->
</ItemGroup>
</Project>
That's it. Worked for me(tm), tested. Let me be honest, I don't like this approach, but that was the only way I made it working in the needed way. It's up to you whether you'll use it in your project or not.
My opinion is not to use msdeploy here - it was not for you task.
Better to write msbuild-scripts from scratch or accept the 'bin' folder, and fight against the framework again once next customization is required.
I've created a custom project type (cljproj instead of csproj) for a programming language called clojure. When the project compiles it outputs multiple .dll files as well as some dependent .clj files.
This is done by overriding the default CoreCompile target in the cljproj file. Which basically copies all files needing compilation to the bin directory and then executes a separate app to compile them.
<Target Name="CoreCompile">
<PropertyGroup>
<ClojureNamespaces>#(Compile -> '%(RelativeDir)%(Filename)', ' ')</ClojureNamespaces>
</PropertyGroup>
<Copy SourceFiles="#(Compile)" SkipUnchangedFiles="true" OverwriteReadOnlyFiles="true" DestinationFiles="#(Compile -> '$(OutDir)%(RelativeDir)%(Filename)%(Extension)')" />
<Exec WorkingDirectory="$(OutDir)" Command=""$(ClojureRuntimesDirectory)\$(ClojureVersion)\Clojure.Compile" $(ClojureNamespaces.Replace('\', '.'))" />
</Target>
I've added a reference from a c# project (csproj) to my clojure project (cljproj).
<ProjectReference Include="..\Clojure ASP.Net MVC Controller Library1\Clojure ASP.Net MVC Controller Library1.cljproj">
<Project>{8fe1995b-4b6d-4911-b563-a759467fdf53}</Project>
<Name>Clojure ASP.Net MVC Controller Library1</Name>
</ProjectReference>
Visual Studio by default doesn't resolve the project reference correctly, because it assumes there will only be one output, Clojure ASP.Net MVC Controller Library1.dll.
Examples of the actual output files are MvcApplication1.Controllers.HomeController.dll and HomeController.clj
I'd like to make this work without making any changes to the C# .csproj file, so that a .cljproj can easily be referenced from any .csproj file.
My attempt to resolve the project reference is by overriding the GetTargetPath target.
<Target Name="GetTargetPath" DependsOnTargets="$(GetTargetPathDependsOn)" Returns="#(TargetPath)">
<ItemGroup>
<TargetPath Include="$(TargetDir)\**\*.dll" />
<!-- <TargetPath Include="$(TargetDir)\**\*.clj" /> -->
</ItemGroup>
</Target>
If I set the TargetPath using *.dll, it works and copies the .dll files to the c#.csproj output directory. It even copies the .pdb files to that directory, although I didn't add them to the TargetPath. However, if I uncomment the *.clj TargetPath, CSC complains that the .clj files are corrupt (probably because they are plain text, not .net assemblies).
I'm happy to use a copy command instead of overriding TargetPath, however I'm not sure which variable to use for the directory to output them to, because $(outdir) gives me the bin of my custom project (.cljproj) not the bin of the c# project trying to resolve the project reference (.csproj). I'm not sure what other target to override besides GetTargetPath, because most clojure project (.cljproj) targets are not called when compiling the c# (.csjproj) project, for example: .cljproj:AfterBuild is only called when compiling cljproj directly, not when compiling .csproj which has a project reference to .cljproj.
I was able to get it to work by overriding the GetCopyToOutputDirectoryItems Target.
<Target Name="GetCopyToOutputDirectoryItems" Returns="#(CopyToOutputDirectoryItemsWithTargetPath)">
<ItemGroup>
<CopyToOutputDirectoryItems Include="$(TargetDir)\**\*.clj">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</CopyToOutputDirectoryItems>
</ItemGroup>
<AssignTargetPath Files="#(CopyToOutputDirectoryItems)" RootFolder="$(TargetDir)">
<Output TaskParameter="AssignedFiles" ItemName="CopyToOutputDirectoryItemsWithTargetPath" />
</AssignTargetPath>
</Target>
I'm trying to write some project and file templates for MonoDevelop (Android, Console and iOS) and can't seem to get the mpack files to install, I keep getting this error when installing the mpack file the monodevelop addin manager:
The add-in MonoDevelop.MonoAndroid.2.8.1.2 is trying to extend /MonoDevelop/Ide/About, but there isn't any add-in defining this extension point.
And here is my template, if you see anything silly, please let me know.
Thanks,
Kenny.
<Runtime>
<Import file="__PreviewImage.png"/>
<Import file="__TemplateIcon.png"/>
</Runtime>
<Dependencies>
<Addin id="::MonoDevelop.Ide" version="2.8"/>
</Dependencies>
<Extension path="/MonoDevelop/Ide/ProjectTemplates">
<ProjectTemplate id="iFactrCrossPlatformAndroid" file="iFactrCrossPlatformAndroid.xpt.xml" />
<ProjectTemplate id="iFactrCrossPlatformTouch" file="iFactrCrossPlatformTouch.xpt.xml" />
<ProjectTemplate id="iFactrAndroid" file="iFactrAndroid.xpt.xml" />
</Extension>
I'm assuming you have the correct attributes on your root element. If so, the error would seem to indicate that you have an old copy of MonoDevelop.MonoAndroid.dll somewhere, and it's confusing the addin engine for some reason.
Note also that you need to import all the addin's files (except the manifest) to get them included in the mpack.
<Runtime>
<Import file="__PreviewImage.png"/>
<Import file="__TemplateIcon.png"/>
<Import file="iFactrCrossPlatformAndroid.xpt.xml"/>
<Import file="iFactrCrossPlatformTouch.xpt.xml"/>
<Import file="iFactrAndroid.xpt.xml"/>
</Runtime>
I'm creating bild-file for a project containing several 3rd-party libraries located inside a lib-folder. So my build-script looks like this:
<csc target="library" ....>
<sources>
<include name="**/*.cs" />
<!-- common assembly-level attributes -->
<include name="../../src/CommonAssemblyInfo.cs" />
<exclude name="Properties/AssemblyInfo.cs" />
</sources>
<references>
<include name="${build.dir}/bin/lib/Should.Fluent.dll" />
</references>
</csc>
The compilation runs fine, however, runtime doesn't work, saying it can't find the library Should.Fluent.dll. How can I make the program find it?
The library has to be present either in GAC or in the same directory that the referencing assembly is in. You can copy it manually to check if this fixes the problem - if yes, then add a <copy> task that makes sure you references are present in your output problem.