I've been googling this all afternoon and I found any number of people ask the question, and all of the place a few people would answer it with the same things, and then there's a dozen comments by the rest of the world and the OP about how those answer don't fix it. So I'm going to include what I've tried here, and if your solution is to do one of the things I've already tried, I'm going to be very sad.
I have a solution in Visual Studio 2019 that has a class library, a wpf application, and a setup project (using the setup project extension). The WPF app also references a bunch of assemblies of course, but one of those is from another project I maintain in a different solution. I copy/paste the compiled dll after I update it from its own project to this one. Nothing tricky, everything works.
The problem is the installer. If I build everything and then build the installer, it produces an MSI as expected. If I right click on the project in Visual Studio and choose "Install", everything is perfect.
The problem is after I make some updates to either of the code projects, I then build both and build the setup project, and again if I right click to install it's perfect. If I run the MSI though, it doesn't always update the target files. If I delete the target files it will create them with the new ones, but it won't overwrite the old ones correctly.
AssemblyVersion and AssemblyFileVersion are both being incremented each time and are being kept in sync with the "Version" property of the setup project. I tested with these extensively, the new installer that isn't working properly 100% has updated dlls in it with correctly updated version numbers.
When I change the "version" of the setup, it asks to change the GUID for the ProductCode. I say yes, it changes the code. I have also tested without doing this and that makes it much worse as we all know.
"RemovePreviousVersions" is set to "true" in the installer project
If I right click the project and choose "Install" it seems to be 100% reliable at upgrading the existing installation.
If I run the MSI directly it seems to be 100% unreliable and never gets it right.
Side note, it does seem to usually but not always get the WPF application upgraded and the other project dll I bring in if I remember to update its version, but the class library (which is referenced by the WPF application) almost never works.
Has anyone got this to work reliably?
For all the people finding this in the future, here's the final word:
The build project can be inconsistent, this is well documented all over the internet as I have above. You're not doing anything wrong - it is just inconsistent.
Stop trying to solve it if it's affecting your project and move on (I've had a dozen projects before this one work just fine). The consensus seems to be to use WiX, but I'm not here to discuss the alternatives. Personally I am going to embark on the WiX learning curve though.
Related
We've created a number of C# code snippets. If I import them directly using the Code Snippets Manager they work perfectly as intended.
Since we are going to have people rolling into our project at different moments in time we want to ease the on-boarding process so we want to include these snippets into a VSIX project. For that purpose I followed this process to the letter.
Now there are several issues going on:
1. When I run the VSIX in debug mode I get the experimental instance of visual studio but the scripts' folder is not in the manager and the package does not seem to be installed when I look in the "Extensions and updates".
If I close VS and run the VSIX installer, after re-opening VS I can see the package installed in "Extensions and updates", I can see the custom scripts' folder in the scripts manager and all the scripts are there but, when I open a code file and try to use them they are just not available, the short cuts are not recognized and the scripts are not available in the insert script context menu.
We have tried both approaches in three different environments and the behavior is the same.
We are using Visual Studio 2017 with .Net Framework 4.7.1
I have tripled checked all the settings, made sure there aren't any typos, all the files that need to be added are there in the right place so I do not know what else to check or try.
I am sorry that I do not include any code but there are some things that are deemed confidential but I tried doing it with the Hello World example and I got the same result.
Thank you for any help you can provide.
So as it turned out, there were multiple causes for this behavior.
Environment 1: With the brand new instance of Visual Studio 2017 there was a folder in the Snippets Manager named %LCID%. Within this folder there were two snippets specifically for MVC 4 applications. We do not know why but either these snippets or the folder was preventing our custom ones to be detected, once we removed this folder everything started working as expected.
Environment 2: This environment did not have the %LCID% folder but had ReSharper installed on it and it was configured to use the IntelliJ keyboard schema. As soon as we changed it to use the Visual Studio one then the snippets became available.
Environment 3: In this one the %LCID% folder was not present and the ReSharper keyboard configuration was set to Visual Studio. We disabled ReSharper and the snippets would still not be available. We basically were never able to figure out why the snippets were not available so we ended up going to the file system, cutting them from the custom folder and pasting them under the "My Snippets" default one and they became available.
Hopefully this information will be useful for someone or, even better, somebody might be able to explain why situations one and three would cause the snippets to not be available.
I am having the exact same issue/error as this post from yesterday. Similar SO Post
SIDE NOTE...As you can see, I am new and therefore, only have 45 reputation. As such, I could not simply add a comment to the above existing post and had to create a whole new post even though they are the same issue....seems silly. But I digress....
I wanted to provide additional comments in the hopes to get an answer. My issue started suddenly the a few days ago. I made no major changes to references, VS updates, etc... However, when I right click my csproj in visual studio, I get the error and I have to click it five times before it goes away, at which point I finally get the menu.
Again, I have made no major changes BUT I went ahead and confirmed that:
My target version and Min version is Windows 10(10.0; Build 10586). That is the SDK version that I have installed and am using.
I verified that my NuGet updates are complete and that my Microsoft.NetCore.UniversalWindowsPlatform are installed and update to date (5.2.2 as of now).
I do have a reference also to "Universal Windows". This was created automatically when I created my project and I cannot remove this reference but it is there. When I select it, I do see that it is "UAP,Version=10.0.10586.0" so this should be good. I do notice a possible issue here. Again, this reference was created for me and I cannot remove or change it. However, it is pointed to a folder named
C:\Program Files(x86)\Windows Kits\10\References\Windows.ApplicationModel.Calls.CallsVoipContract\1.0.0.0\
Why did the Windows Universal reference default to that folder and only that folder? I am not using VoIP so I wonder why it chose this one? Also, what if I need some of the other references in the References folder?
I created a brand new Windows Universal project and the same error happens on a fresh project.
Please help, it is annoying. Project still seems to build and work fine though.
Thanks!
I found the issue in my case, it was an extension that I added on to Visual Studio provided by SyncFusion (which their installer actually creates 7 or se extensions in Visual Studio). After troubleshooting my issue and doing some of the same things to resolve (repairing .Net, SDK, Visual Studio) I then thought about the error a bit more. While it is cryptic (and has poor english "An Exception has been occured") these are all clues that it could be any of the frameworks that I have installed via extensions as well.
I also had another clue, the issue started happening a few weeks ago, around the time I updated my SyncFusion controls to the latest version.
So, I went to Tools > Extensions and Updates. I went to Installed > All and found all of the SyncFusion items (there are several) and disabled them all. After I disabled them, and restarted Visual Studio, the problem went away!!!
This is a workaround for now. In the meantime, I put in a support ticket with SyncFusion on the issue. I will certainly update this thread when I get a response from them. Also in the meantime, I then went back and re-enabled each of them again, one at a time, to see who the real culprit was. In my case it was the SyncFusion Web Conversion and Migration extension.
If any of you are not using SyncFusion but having odd Visual Studio issues such as this, I suggest doing something similar by going through your extensions and disable any that you added on, starting with the most recent add ons, especially if they were added around the same time you started having the problem until you find the culprit.
Hope this helps!
we are using the infragistics libraries for a long time now. But now we ran into a problem, that has been solved here Cannot select Infragistics controls in winform designer.
My more specific question now is, why does this problem not occur on all of our colleaques computers, but only on mine? We have the same visual studio solution and all of the source code is from a subversion repository.
We decided to put a copy of the infragistics dlls to our controls directory in the project, so we can deploy it later on very easily by copy and paste the files into the target directory (but still we need a setup tool to install for the first time).
How can we make sure, that the following requirements (useful or not) are met?
Updating the application still possible by copy&paste.
developper tracks the needed infragistic dlls by copying them into the controls directory (that is then copied into the application executable directory).
the problem from the link above doesnt occur
Perhaps we miss something important?
Is it bad practice to update the application by simply copying newer files to the application directory? Or is it even "illegal" in some way?
Do the infragistics tools need to be installed via setup or msi installer? Or is it sufficient to copy them?
[edit #1]:
to clarify things, as i know whats going wrong (see the link above) and what the possible solution is, i need some good arguments for or against not using the controls directory with respect to our practice of deploying the application without setup when it gets updated. We need to give our customer the posibility to update our application without a setup, because in his factory he needs to update a couple of computers at once, and if he is able to do this without the need of a setup, it will be more cost efficient compared to a setup way.
Here is my two cents:
Try setting all Infragistics libraries Copy Local property to True.
This will copy the dll to the bin folder each time you build your
application. This could solve the problem you are having with
updating the application by copy&paste;
It is better each developer to install the libraries into the GAC. I suppose all of you are using the same version of these libraries.
Otherwise, it will be real chaos. If, for some reason, you are not using same versions try to set for each Infragistics dll Specific Version to False
If all the controls are appear in the Component try (down in the designer) this clearly shows, that Designer.dll is broken or is not found. So it is always good idea to install the dlls into GAC - this should add the Infragistics Designer dll there too, and you should not have this problem.
So, install everything into GAC, set Copy Local to true and set Specific Version to false.
Also whenever you need to upgrade project containing Infragistics libraries use their nice tool Version Utility - this could save you many efforts
I'm not sure if this is the correct place to ask, but as it's programming related, here it is:
I have a solution with several projects (all .NET/C# based. some libraries, some WPF, some XNA, some portable class library, all together) and I have problems with performance:
While running my project, when I hit restart (Ctrl+Shift+F5) while debugging, the instance stops, VS recompiles all the projects in the solution again, and then it runs again.
When I stop my running instance. Without touching any code (not even spacebar in the code editor), I hit F5 and similarly, it again recompiles the whole solution.
When I'm working in only one of the projects and hit Debug without touching any code in the other projects in the solution, VS, again, recompiles all the projects in the solution.
This creates a real bottleneck as my project normally starts in <1 sec. but it compiles for a few seconds even on SSD. A few seconds don't seem much but I make some very small changes to only one code file and try something several times by running the application again and again, it becomes a real trouble.
I think that if you have your studio setup to always build, it will do so. Make sure you have the correct settings in studio. See below.
I've found out the reason and the problem is solved. I was using BuildVersionIncrement plugin and it was incrementing the build number every time I compile, and Visual Studio was thinking that, because of the change in files, the project was outdated, thus, bebuilding the whole solution. I changed the BuildVersionIncrement settings to increment only on full rebuild, and the problem is solved.
My C# WinForms solution has two projects.
A DLL which is the main project I'm working on, and an executable WinForms I call "Sandbox" so that I can compile/run/debug the DLL easily in one go.
I'm working in .Net 4.0 for both projects.
Everything was working fine until I added some seemingly innocent code, and a reference to System.Web in the DLL.
Now my Sandbox project can't see the namespace of the DLL project. I didn't change anything which I believe should have affected this.
If I delete the project reference to the DLL from the Sandbox references and re-add it, then the red underlines all disappear and the colour coding comes back for all my classes etc; but as as soon as I try to build the solution, the whole thing falls apart again.
When I right-click the DLL project in the Sandbox's references and view in object browser, I can see the namespace and all the stuff in there.
I have a feeling this might be some sort of bug?
Is this some sort of VS2010 bug? I had this same issue a few months ago and I could only fix it at the time by making a whole new project and re-importing my files. This time, however, I have a bajillion files and will only do that as a last resort!
Edit:
After panickedly going through and undoing all my changes, trying to find what caused the problems, it seems to be this line:
string url = "http://maps.google.com?q=" + HttpUtility.UrlEncode(address);
If I comment out this line, then I get no namespace errors and the project builds fine. I can't see anything wrong with this line though.
I'm ready to declare this a bug in VS2010, this has bitten way too many programmers already. The fix is easy: Project + Properties, Application tab, change Target Framework to ".NET Framework 4" instead of the Client Profile that is selected by default.
System.Web is not included in the client profile. Having this option in the first place is quite silly, the client profile is only 15% smaller than the full version of .NET 4.0. Having it selected by default is even sillier. But I digress.
UPDATE: mercifully this all got fixed in VS2012. Which no longer makes the client profile the default for a new project. And the client profile got retired completely in .NET 4.5, good riddance.
Check to make sure that both projects are using the non-client profile for their target framework (go to each project's properties to do this).
One possibility is that the target .NET Framework version of the class library is higher than that of the project.
I faced this problem, and I solved it by closing visual studio, reopening visual studio, cleaning and rebuilding the solution. This worked for me. On some other posts, I have read the replies and most of users solved the problem by following this way.
Try building only the project with the Sandbox dll first independently.
Then point your executable project to the required dll and ensure copy local is set to true. in reference settings.
Tthen build the executable project.
Changing the target framework from the ".NET Framweork 4 Client Profile" to ".NET Framework 4" worked for me with a similar problem. I agree that the client profile doesn't seem to have much of an advantage to using it. I seem to get nailed with weird errors that I hunt for until I remember that Visual Studio defaults to the client profile. I guess the moral of the story when getting an error is: if "Rebuild Solution" doesn't work, check the Target framework...
If you tried already doing the Framework change, and still not worked, I hope this works for you (as it did for me): Simply add the necessary references from within your projects. Very obvious but I was doing it wrong until I found what was the issue.
I just had this issue and it turned out to be I had multiple namespaces being used that had the same object name (i.e. business objects had the same names as mvc models);
Fully qualifying the names fixed the issue for me.