I have an Setup project that installs App.exe.
App.exe depends on
1) A third party library NLog.dll which comes with NLog.xml.
2) another project in the solution which has content files Lib.xml.
To the setup project, I added "Primary output from App" and "Content Files from App". The installer didn't pick up the third party lib config (NLog.xml) and the content files of its dependency (Lib.xml). How do I instruct VS to pick up those two?
Note that all these files are available in App/bin/Release/.
Thanks.
Since config files are .config and your dll are using XML, VS assume that those files are the help files for the class..
You should add the files manually to the setup project. VS will not add them.
Related
I have used Specflow/MSTest to create a test suite. I need to be able to package this so that a third party can run the tests etc.
I can use vstest.console.exe to execute the features/scenarios using a number of .runsettings I have.
Problem I have is how to copy the files from the Microsoft.TestPlatform nuget package to my project output folder (whether same folder, sibling folder whatever; that is not an issue, I can work that out no worries). I just can seem to work that out.
I have read a number of posts, on SO and elsewhere, with folk asking same/similar questions but I just cant repro how to do it.
Have tried editing the project file to copy PackageReference 'always', using the 'None' element etc but just can't seem to get it. Microsoft.TestPlatform is used extensively so I'm guessing that i'm missing something simple here; I just cant get Google to be my friend in this instance.
So, if my .NET5.0 (framework may be irrelevant) project has a Nuget Package referenced but is not referencing it in code anywhere how do I instruct Visual Studio to copy the files from that package to whatever folder I need them to go when I do a build?
Try to modify the package management to "Packages.config", it will auto copy the dlls to output folder.
If you want to copy dlls to other folder, you can use xcopy command in post-build event.
dotnet publish is the command you're looking for
dotnet publish compiles the application, reads through its dependencies specified in the project file, and publishes the resulting set of files to a directory. The output includes the following assets:
Intermediate Language (IL) code in an assembly with a dll extension.
A .deps.json file that includes all of the dependencies of the project.
A .runtimeconfig.json file that specifies the shared runtime that the application expects, as well as other configuration options for the runtime (for example, garbage collection type).
The application's dependencies, which are copied from the NuGet cache into the output folder.
https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-publish
Not sure if this is the correct place to ask this but there have been a lot of visual studio questions in the past here.
I am currently creating a lot of npm packages in a solution and as part of the package, I have to create a package.json file.
Once I save the file, it creates a node_modules folder and downloads all the dependent npm packages to it. Now I have got azure dev ops to ignore these files so they aren't checked in by adding the node modules folder to the list of ignored folder names, but I also want to exclude them from my project so that it doesn't lock my computer every time it tries to write all the file names in to the .proj file.
Is there a way to automatically tell the project or solution to auto exclude this folder - like a solution ignore file I can add the name to?
Or is there an option somewhere that folders that aren't created through vs, aren't automatically added to the project - this is how my earlier versions of vs worked - new folders not created through vs would have to be manually included if you wanted them in the project / solution
Ok this is due to the project type that I used when creating the project - I created it as a .net core project and that seems to add files by default and only exclude them if you tell it to, if I change this back to a .net standard project, it works as I would expect - only includes files you drag into the project or tell it to include
My Question is, When i am building any solution all the dll's are copied to bin folder. Can we split this dll's with different-different folder's once build is completed? i.e I am having some third party dlls and some other dlls like DevExpress dll's so i want to separate all of then in thier specified folders.
Please dont suggest for manual copy paste. Developers is pulling code from git hub once it is build then folder structure can be made automatically.
Please suggest if we can do with Post-Build Event.
Thanks in Advance.
You could copy files through Copy task after build. For example, (add to the end of your project file):
I have the following dir. struct
$/
TeamProj1/
Solution1/
<Solution and files etc>
TeamProj2/
Libs/
LibSolution1/
<solution and files etc>
External/
ThirdParty.dll
Solution1 has a project reference to LibSolution1, and has an assembly reference to ThirdParty.dll.
When I do a fresh check out of Solution1 via File->Open from source control TFS correctly checks out the LibSolution1 files, but not the third party dll.
If I manually check out the third party dll everything builds.
How do I force TFS to check out the correct third party dll files?
I can think of two possible methods but don't particularly like either.
1) I could add a libs folder to Solution1 and add the dll there. Then the dll will be checked out when solution1 is checked out. I don't like this method though because there are solutions in addition to Solution1 that will use the third party assembly, and I want to maintain only a single copy of the file.
2) I could create a "dummy" ThirdParty project/solution and add the files to that solution, then add the dummy project to solution1 solution. Then when I check out solution1, it would see the dummy project and check it out along with all the associated files (being the third party dlls)... but that seems unnecessarily complex.
Isn't there a way I can instruct TFS to simply check out the required file?
This solution here is a variation of your option 1 but without having to maintain multiple copies of the DLL's.
Add a new folder to your Solution1 (say Third_Party_DLL). Right CLick the folder -> Add existing item and instead of adding the DLL's physically here (create a link to these third party DLL's from the location where you have saved it). Now after adding the DLL links in the folder, add reference to the DLL's in your project from this folder (Third_party_Dll).
Now when you are getting the latest of the solution file, it should get your DLL's too. I havent tried this out myself for Dll's but have done this for maintaining a single copy of the AssemblyVersion file and it worked well. Try and let me know.
Add Vs Add Link
I have a Visual Studio 2010 project which references some third-party components. Their assemblies are accompanied by XML documentation files, which are useful for us (and only us) developers. And whenever the project is built (either in Debug or Release modes) these XML files are copied to the build directory.
I can't seem to find a setting or switch to disable the copy of those XML files to the build directory, either within Visual Studio or though MSBuild. A post-build script may be an option, but a smelly one. Any ideas? Thank you.
When you build a project the .xml/.pdb files are gathered through the ResolveAssemblyReference task. When ResolveAssemblyReference is called it is passed a list of file extensions for related files. That list of file extensions is captured in the MSBuild property AllowedReferenceRelatedFileExtensions. By default that list will contain ".pdb;.xml".
If you want to exclude all related reference files from being picked up then just override the value of the property to something which related files won't have extensions of. For example you can set AllowedReferenceRelatedFileExtensions to "-".
You can also customize the list of file which are returned by that. If you only want to find only .pdb files then you will need to pass in AllowedReferenceRelatedFileExtensions=".pdb". In that case any references which have .pdb file next to the .dll/.exe they will be copied as well. You can also use this to copy other related files which may not end in .pdb/.xml. For example if you have a referenced assembly named, MyAssembly.dll and in that same folder there exists MyAssembly.pdb and MyAssembly.foo If you set AllowedReferenceRelatedFileExtensions=".pdb;.foo" then both the .pdb and .foo file will be copied to the output directory.
Visual studio project file has the same format as any msbuild file. So you can manually add the condition into corresponding section to not copy your xml files if configuration name is 'Release'.
It should be changing
<ItemGroup>
to
<ItemGroup Condition="'$(CONFIG)'=='RELEASE'">
or something like this.
If the .xml/.pdb are marked as build-action "Content" (etc), you can change them to "None". You should also ensure they copy-to-build-output is false.
Are both of those set?
What is the problem with having the XML files get copied into the folder on release builds? It seems to me that this is fine and that the real problem is with the code that picks up files to place them in the installer. Picking up third party dlls from your own bin\release folder is not a good practice in my opinion. I'd have my installer pick up third party dlls from their own folder in my source tree.
The setting is in the Properties of the project in question, under the "Build" tab, uncheck "XML documentation file". It's also an MSBuild property called <DocumentationFile> under the applicable <PropertyGroup> for your build configuration in the .*proj file.