I have the SL Control toolkit installed on my machine and I have added a reference to the toolkit DLL (System.Windows.Controls.Toolkit.dll)
I like to have all my external dependencies in a lib folder under the SL project, so I copied over the DLL from the installation dir of the control toolkit to the lib folder, but if I try to add reference to the DLL from this location, VS is still picking up the reference from the installation dir.
What gives?
I ran across this problem everyday. The easy (it feels that way after some time) solution is to unload the project (right click>Unload Project) then right click again en select Edit. Find a reference that is point to another assembly in your lib folder, copy that Xml element and change the 'Hint' path to your assembly.
It will look something like:
<ItemGroup>
<Reference Include="Ninject">
<HintPath>..\..\Ninject.dll</HintPath>
</Reference>
<Reference Include="System" />
<!-- other references removed for breviti-->
</ItemGroup>
The installed DLLs are always searched first, even if you add the DLL by browsing. The path in the properties window (for your added reference) would have shown the "installed" version instead immediately after adding the reference to your copy.
A build machine would not have the toolkit installed. You could uninstall the toolkit and organise the DLLs yourself if you really need that sort of behaviour.
Related
My goal:
I want to use Interaction Triggers in that way:
<i:Interaction.Triggers>
Therefore I opened the Nuget and installed this:
After this the two references (Microsoft.Expression.Interactions and System.Windows.Interactivity) were added to my project. The path of those points to the package directory (Blend.Interactivity.Wpf.1.0.1340.0) in my project folder.
The problem:
The namespace is not recognized by Visual Studio. I tried:
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
Intelisense is not recognizing any elements inside the i-Tag.
The .Net version of the project is 4.5.2.
I tried to remove and reinstall the package.
Any ideas what went wrong here?
By adding the <PackageReference Include="SourceLink.Embed.AllSourceFiles" Version="2.8.0" PrivateAssets="all" /> tag in my .csproj file, I was able to embed the source files of my library in the nuget package. This was good.
However, when I try to debug into the library from client code, Visual Studio was unable to locate the source because the files it was looking for had absolute paths from the build server, e.g.
Locating source for '/scratch/teamcity/work/d5de3351444bb38d/<ProjectFolder>/<SourceFile.cs>'
Is there something I overlooked that would make this process work correctly?
Update
It appears that the package reference to SourceLink wasn't actually doing anything. Just setting the project to compile an "embedded" DLL was sufficient to get the absolute paths to the source included in the file.
I am building with dotnet on Linux. Is there a compatibility issue with SourceLink.Embed.AllSourceFiles in this context?
How do I reference the FontAwesome.WPF dll from the OtherProject in the Test project.
In the OtherProject I reference it like this:
xmlns:fa="http://schemas.fontawesome.io/icons/"
I know how to reference the project itself:
xmlns:fa="clr-namespace:OtherProject;assembly=OtherProject"
But I think the namespace should change, however I don't know to what and where to find it?
This is the FontAwesome.WPF in the object browser:
I don't know how the first reference would relate to this or might help me or if this is even possible?
So what I want is calling this:
<fa:ImageAwesome Icon="Flag" VerticalAlignment="Center" HorizontalAlignment="Center" />
Without installing the NuGet package in the Test project.
You should read the following accepted answer.
MSBuild doesn't copy references (DLL files) if using project dependencies in solution
In short, you have two options:
Install the NuGet package in the test project as well.
Add some code (not only XAML markup) in the OtherProject that references a type in the FontAwesome assembly.
Then the assembly should be copied to the test project's output directory.
I have a winforms application that I want to deploy via clickonce. What is a little different about this application is that it searches for certain assemblies (by name convention) in the working directory and loads/reflects over them to find ninject modules/providers. The assemblies it loads are not referenced by the VS project. It works a treat, but how do I include these assemblies in the clickonce deployment package?
Add the dll's to your project as files instead of references, and set the type of the Build Action to Content and set Copy to Output Directory to Copy if newer (Copy to output does not effect Click-Once but it does affect local builds)
Once you have set the build action to content the dll's should be included with the deployment, you can check under Project Properties -> Publish -> Application Files...
I have a Visual Studio 2010 solution file with a number of projects in it. There is a mix of Silverlight projects (acting as modules), the Silverlight Shell project and a number of RIA services.
When using TFS 2010 to perform the build, it always fails because the proxy classes generated by the RIA services have not been built first. The only solution I have seen so far is to manually change the build order in my .sln file. No thanks, there are loads of projects.
Rather than break the solution up in to client side and server side solution, I'd like to find a better solution.
Apparently MSBuild 4 ignores the build order in the .sln file.
Does anyone have any ideas/suggestions?
Thank you,
The simplest way I've found is to declare explicitly the dependency between Silverlight project and the project that is hosting RIA service.
You have to open in a text editor your Silverlight project file and add a fragment to it:
<ItemGroup>
<ProjectReference Include="..\Path\Your.Hosting.Project\Your.Hosting.Project.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
This will tell msbuild to build your web service before building your Silverlight app. And it will work only when building with msbuild, VS will throw an error.
To get it built in Visual Studio also, you have to wrap this fragment in a Target and add it to InitialTargets in Project node:
<Target Name="MySpecialReferences">
<ItemGroup>
<ProjectReference Include="..\Path\Your.Hosting.Project\Your.Hosting.Project.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
</Target>
<Project ... InitialTargets="MySpecialReferences" ... >
Visual Studio 2010 will skip this target now but msbuild will use to change built order of projects.
This definitely doesn't seem to be the "proper" solution, but as an interim option what about checking in the generated Generated_Code\*.g.cs files for your RIA services present in your Silverlight projects? If people check in the up-to-date version along with the matching updates to their DomainService classes, all should build as expected.
Below is a sample from an MS Build script that we're using in our project. Basically, we've labelled our web project (containing the RIA services) as a priority project and are building it first.
Please note that the 1st XML tag should be located somewhere in the environment setup stage.
<ItemGroup>
<!-- use this collection to control project build order, projects listed in this array are removed from the current build queue and pushed in the front before compilation-->
<InitialBuildProjects Include="MyProject.Web.RiaServices" />
</ItemGroup>
<ItemGroup>
<PriorityProjects Include="$(ProjectRootDirPath)\Sources\%(InitialBuildProjects.Identity)\%(InitialBuildProjects.Identity).csproj" />
<RemainingSourceProjects Include="$(ProjectRootDirPath)\Sources\**\*.csproj"
Exclude="#(PriorityProjects)" />
<SLTestProjects Include="$(ProjectRootDirPath)\Tests\*.Web\*.Web.csproj" />
<BuildQueue Include="#(PriorityProjects);#(RemainingSourceProjects);#(SLTestProjects)" />
</ItemGroup>
Works for us in private builds + on our TeamCity server.
Does this help ?